Thursday, July 26, 2007

Learning to think in Z

In the traditional disk mounting world we had a device uner the /dev directory which is mounted on a (aptly named) mount point. For example:

# mount /dev/dsk/c0t2d0s0 /export/install

On a large database server you might see the common convention of mounting disks with /uXX names...

# ls -1d /u*

This is the frame of reference I used when walking into the building of my new JumpStart server. My goal was to stick as close as possible to standard mount points. The first file system was to be mounted on /export/install. The second file system would serve as my home directory, and I didn't much care where it lived since I'd use the auto mounter.

The default zfs configuration is to mount a complete pool under its pool name. I tried to be creative in coming up with a naming convention, but slipped into mediocrity with a "z##" name. Hey, I'm tired of seeing /u##; It's amazing what a difference one letter can make in spicing up a server. Having come up with my name, I created the pool from my second disk:

# zpool create z01 c0t2d0
# zfs create z01/install
# zfs create z01/home
# Hmm, why not make my home its own fs?
# zfs create z01/home/cgh

Wow. That was easy!

But now there's a sort of a problem. I can't quite get past seeing the JumpStart directory under /z01. It's not intuitive there. The world of Solaris sysadmins looks for JumpStart files in /export/install. So, how can we get this sweet ZFS file system to show up where I want it? Turns out this is pretty easy as well.

# zfs set mountpoint=/export/install z01/install

It even unmounts and remounts the file system for me. Oh yes, I'm a fan at this point.

One thing that's interesting is that once you move a mountpoint from its default, it can be easy to "loose" that file system. For example, if I list the contents of z01 at this point, I only see home. "install" no longer shows up there because its mounted on /export/install. In this example it's hard to loose anything, but on a large production server there could be many pools and many file systems. As you would expect, there's an easy command to list the file systems and their mount point:

# zfs list
z01 1.61M 36.7G 26.5K /z01
z01/home 1.49M 36.7G 1.45M /z01/home
z01/home/cgh 35.5K 36.7G 35.5K /z01/home/cgh
z01/install 28.5K 36.7G 28.5K /export/install

I decided to leave the z01/home in place and just repoint the auto-mounter. From zero to "get it done!" in about 20 minutes with some play time. I love it.

No comments: