ZFS on the go
By artem on Nov 17, 2005
It looks like this blog entry is still getting hits from search engines and the USB FAQ, so here's an update. Since I wrote the entry, the project I said was under way has now been integrated in Nevada Build 36, Solaris Express 4/06 and Solaris 10 6/06 Release. It is mentioned in Dan's what's new blog as:
\* Hotpluggable drives are now better able to accomodate EFI-labels and device IDs, both of which are very important to supporting ZFS on USB and Firewire disk drives. 
If you use one of these releases or later, the hack described below is not necessary (and as Brian noted, may cause some error messages).
ZFS is awesome. I'd bust some zeerleading moves for y'all, but I misplaced my pom poms and it wasn't going to be pretty anyway. Instead I will tell you how to try ZFS on your laptop (or any computer without a spare fixed disk). There is no supported way to create ZFS pools on USB disks yet, although a project is under way to rectify this (you can have limited ZFS functionality using lofi(7D)). What follows is a hack, use it at your own risk.
Before we proceed, you should get vold(1M) out of the way:
# svcadm disable volfs
An important thing to know in this context is that you can't create a pool on removable media devices, i.e. the ones whose storage media can be removed. DVD drives and flash readers are removable media, hard disks are not. So you'll need one or more USB hard disks. Most USB hard disks and IDE-to-USB enclosures should work. Thumb drives are not likely to work. In this experiment I'm using two USB 2.0 disks: a 20GB LaCie and a 40GB IOGEAR.
For the reasons that are beyond this blog entry, the Solaris USB driver presents any USB storage device as removable media. A simple command to list removable and non-removable disks is format(1M). Quoting the man page:
Removable media devices are listed only when users execute format in expert mode (option -e).
Run format with and without -e and notice the difference:
# format Searching for disks...done AVAILABLE DISK SELECTIONS: 0. c1d0
/pci@0,0/pci-ide@8/ide@0/cmdk@0,0 Specify disk (enter its number): \^C # format -e Searching for disks...done AVAILABLE DISK SELECTIONS: 0. c1d0 /pci@0,0/pci-ide@8/ide@0/cmdk@0,0 1. c4t0d0 /pci@0,0/pci1297,a550@2,2/storage@6/disk@0,0 2. c5t0d0 /pci@0,0/pci1297,a550@2,2/storage@5/disk@0,0 Specify disk (enter its number): \^C
c4t0d0 and c5t0d0 are USB disks.
What we're going to do is tell the USB driver not to treat hard disks as removable media. This can be done by appending the following line to /kernel/drv/scsa2usb.conf file:
attribute-override-list = "vid=\* removable=false";
Reboot for these changes to take effect. Now all your USB hard disks are going to be treated as fixed (but you can still hotplug them). You can verify that by running format without -e option - if it still doesn't list your USB disk, most likely it's one of the rare samples that pretends to be removable media and that's a hack for another day.
Now you can use these disks just like any fixed disk:
# zpool create usbpool mirror c4t0d0 c5t0d0 # zpool list NAME SIZE USED AVAIL CAP HEALTH ALTROOT usbpool 27.8G 33.0K 27.7G 0% ONLINE - # zpool status pool: usbpool state: ONLINE scrub: none requested config: NAME STATE READ WRITE CKSUM usbpool ONLINE 0 0 0 mirror ONLINE 0 0 0 c4t0d0 ONLINE 0 0 0 c5t0d0 ONLINE 0 0 0 # zfs list NAME USED AVAIL REFER MOUNTPOINT usbpool 32K 27.5G 8K /usbpool