Fun with ZFS Part 1 (zpools)


Well Happy New Years to everyone i hope your holidays were great. Now we can get into some cool stuff. This is a quick tutorial on the zfs file system, but before jumping into the commands and how things work let me give you a little background on the zfs filesystem, ZFS which stands for Zetabyte File System is a 128bit fileystem that is also a volume manager rolled up in one In reality this is the Sun Volume Manager on Steriods. With the Sun Volume Manager  the admin had to use soft partitions in order to expand disk space, this is not so with the Zfs filesystem simply adding a disk to the disk pool adds disk space this is such a cool filesystem. Over time developers have ported zfs over to linux and freebsd which in my most humble opinion is the best OS (bsd) :). Well enough of the this chatter let me show some of the cool stuff that zfs has to offer. begin with zpools , zpools are the heart of the zfs filesystem, with out zpools there is no zfs periodin order to use zfs you will have to create a zpool by typing in the following command:

# zpool create <name of your pool>(which in my case is nixpool 🙂 ) <name of disk >

# zpool create nixpool c1t0d0s0

List all zpools

# zpool list
nixpool 79.5G 4.84G 74.7G 6% ONLINE –

Getting the Status of all zpools

# zpool status -xv
all pools are healthy

Creating a mirrored zpool

# zpool create pool mirror c0d0 c1do

Creating a mirrored zpool with a hot spare #Note: These devices are not actively used in the pool,but when an active device fails, it is automatically replaced by a hot spare zfs rocks :).

# zpool create pool mirror c0d0 c1d0 spare c2d0 c3d0

Create a zpool with log devices. log devices come in handy sometimes for example databases often require their transactions to be on stable storage devices when returning from a system call. Multiple log devices can also be specified, and they can be mirrored

# zpool create pool c0d0 c1d0 log c2d0  

Another cool thing about zpools is that their properties can be modified. you can get a list of zpool properties by running ther following command:

# zpool get all nixpool

nixpool   size                  79.5G               –
nixpool   used                  4.84G            –
nixpool   available        74.7G              –
nixpool   capacity          6%                   –
nixpool   altroot            –                       default
nixpool   health            ONLINE            –
nixpool guid                  15548639045079529059   default
nixpool version            15                      default
nixpool bootfs             nixpool/ROOT/zboot.csh11 local
nixpool delegation     on                      default
nixpool autoreplace  off                     default
nixpool cachefile         –                         default
nixpool failmode        continue          local
nixpool listsnapshots on                    default

Adding a Mirror to a ZFS Storage Pool Note: The following command adds two mirrored disks to the poolnixpool, assuming the pool is already made up of two-way mirrors.

# zpool add nixpool mirror c1t0d0 c1t1d0

Destroying a zpoo Note: The following command destroys the pool nixpool and any datasets contained within.

# zpool destroy -f nixpool

Well this will conclude Part 1 of  my fun with zfs series.  In part 2 I will get into the zfs filesystem and show you all of the cool tricks for the zfs filesystem if you desire to know more about zpool run the following command on your local unix system man zpool


About Author

Leave A Reply

Welcome, guest maybe you should register or login