ZFS Flash Drives

As an experiment, I created a small (8GB) ZFS volume in a mirror configuration using two 8GB USB Flash drives.

The purpose was to put “small, but really important things” on this storage system.

It actually ended up being two discrete pieces of work. First, setting up a VirtualBox FreeNas 9 image with “USB passthrough”. Second, running the FreeNas/BSD commands to create the volume by hand, since FreeNas insists on using 2G (fixed) per disk when it creates volumes. 2GB of 1000GB isn’t even a drip; 2GB of 8GB is significant.

So, second things first: creating the partition and volume and getting FreeNas to acknowledge it.

Once you know the two devices in FreeNas (for me it was /dev/ada1 and /dev/ada2), you can run these commands:

gpart create -s gpt /dev/ada1

gpart add -i 1 -t freebsd-zfs /dev/ada1
# now run ls -l /dev/gptid, make note of the new entry,
#   e.g.  d50a7a3b-aeb0-11e6-86a2-080027bed2b8

gpart add -i 1 -t freebsd-zfs /dev/ada2
# make note of that gptid too, 
#    e.g.  e9c860e9-aeb0-11e6-86a2-080027bed2b8

Since my two USB drives were not exactly the same (7.4G versus 7.2G), the zpool create required the “-f” flag:

zpool create -f  usb8 mirror /dev/gptid/d50a7a3b-aeb0-11e6-86a2-080027bed2b8 /dev/gptid/e9c860e9-aeb0-11e6-86a2-080027bed2b8

zpool status
  pool: usb8
 state: ONLINE      
  scan: none requested 
config:   
        NAME                                            STATE     READ WRITE CKSUM  
        usb8                                            ONLINE       0     0     0 
          mirror-0                                      ONLINE       0     0     0    
            gptid/d50a7a3b-aeb0-11e6-86a2-080027bed2b8  ONLINE       0     0     0 
            gptid/e9c860e9-aeb0-11e6-86a2-080027bed2b8  ONLINE       0     0     0  

Then, to get FreeNas to acknowledge it:

zpool export usb8

Finally, in the FreeNas GUI, run “Import Volume”, no encryption, selecting the volume name in the drop-down list. Under “Disks”, you should see two “7.xGiB” entries, not the “5.xGiB” the the 2GB swap partition would have given you.

If you didn’t make note of the gptid as you created the partitions, you can run

gpart list

And look for the “Name: ada1p1” entry to get the “rawuuid” value to use with /dev/gptid/hxhxhx….

Using the gptid/rawuuid, instead of /dev/adaX, is a good idea in general. In this particular case, remember that the device is actually a VirtualBox-created “Disk”, with a VirtualBox serial number, and a VirtualBox gptid.

See the next post on how the “pass-through” was created in VirtualBox.

This entry was posted in ZFS. Bookmark the permalink.

Comments are closed.