
My Book® Mirror Edition™ package
As related in a previous post, my old home server was, amongst other things, acting as a home file server. This post is about how I setup my new Opensolaris eMachine home server as a file server. As requirements, I wanted my data to be safe from both hardware failure (drive redundancy) and human mistakes (backups).
I could have bought a commercial NAS (Network Attached Storage). The most commun NASes in the market are thoses ethernet hard drives. As far as I know, they are powered by some kind of embedded Linux, which cannot be that easily modified and feature extended (when possible it requires some obscure hacking…). Another cons are that multidrives models are quite expensive, and also – sorry Linux -, they don’t offer ZFS powerfull features!
To add storage to my Opensolaris eMachine home server, I’ve bought — for my birthday — an external drive: a Western Digital “My Book® Mirror Edition™ 2TB“, that is:
- a dual-drive Raid-1 (Mirror) external USB enclosure (also Raid-0 (Striped) configurable) with
- two Western Digital Caviar 1TB Green Power hard drives: Cool, eco-friendly drives that consume approximately one-third less power than standard one,
- User serviceable: enables me to open the enclosure and replace the drives inside (not hotplug though)
- efficient convection cooling architecture (no fan: less noise and less power consumption),
- intelligent drive management features, including automatic power-up, Safe Shutdown™ (what is that?) and LED status and activity lights (not sure wether this cool feature will work well with the Opensolaris/ZFS combo).

My Book® Mirror Edition™
Upon plugging it into my eMachine, the new “disk” is recognized (using format in expert mode or rmformat):
root# format -e
/pci@0,0/pci10de,cb84@2,1/storage@a/disk@0,0
1. c4d0
/pci@0,0/pci-ide@8/ide@1/cmdk@0,0
2. c8t0d0
/pci@0,0/pci10de,cb84@2,1/device@8/storage@0/disk@0,0
Specify disk (enter its number):
root# rmformat -l
Looking for devices...
[...]
3. Logical Node: /dev/rdsk/c8t0d0p0
Physical Node: /pci@0,0/pci10de,cb84@2,1/device@8/storage@0/disk@0,0
Connected Device: WD My Book 1008
Device Type: Removable
Bus: USB
Size: 953.9 GB
Label:
Access permissions: Medium is not write protected.
Let’s use the new disk c8t0d0 to create a new ZFS pool (zpool):
root# zpool create mybook c8t0d0
root# df
Filesystem 1K-blocks Used Available Use% Mounted on
[...]
mybook 957874125 18 957874107 1% /mybook
Disk Replacement
That’s it: 1 TB of RAID1 protected disks! It couldn’t be more easy, could it?
This will protect my precious data against a drive failure. But what about human mistakes, which actually are much more likely to happend?
To recover from human mistakes, like unintentionally deleted and/or modified files, ZFS brings a killer feature: automatic snapshots at regular intervals, each with different retention times:
- frequent snapshots every 15 mins, keeping 4 snapshots,
- hourly snapshots every hour, keeping 24 snapshots,
- daily snapshots every day, keeping 31 snapshots,
- weekly snapshots every week, keeping 7 snapshots,
- monthly snapshots every month, keeping 12 snapshots.
That is, providing you previously enables the feature on the ZFS in question, you can browse filesystem “back in time”! It’s amazing! (High end filer solutions like NetApp’s do this!). And it’s automatic! You just need to enable it, and that’s it!
This is the way to enable automatic snapshots on a ZFS. In my case I enable it on the first ZFS (the ZFS created upon zpool creation), so all the ZFS created under it will also inherit the property ;-).
root# zfs set com.sun:auto-snapshot=true mybook
I also configure the zfs to show the snapshot (they will appear under ./.zfs/snashot/ in any zfs filesystem). (The same apply here regarding inheritance).
root# zfs set snapdir=visible mybook
root# zfs get all mybook NAME PROPERTY VALUE SOURCE mybook type filesystem - mybook creation Fri May 8 21:51 2009 - mybook used 79.5K - mybook available 913G - mybook referenced 18K - mybook compressratio 1.00x - mybook mounted yes - mybook quota none default mybook reservation none default mybook recordsize 128K default mybook mountpoint /mybook default mybook sharenfs off default mybook checksum on default mybook compression off default mybook atime on default mybook devices on default mybook exec on default mybook setuid on default mybook readonly off default mybook zoned off default mybook snapdir visible local mybook aclmode groupmask default mybook aclinherit restricted default mybook canmount on default mybook shareiscsi off default mybook xattr on default mybook copies 1 default mybook version 3 - mybook utf8only off - mybook normalization none - mybook casesensitivity sensitive - mybook vscan off default mybook nbmand off default mybook sharesmb off default mybook refquota none default mybook refreservation none default mybook primarycache all default mybook secondarycache all default mybook usedbysnapshots 0 - mybook usedbydataset 18K - mybook usedbychildren 61.5K - mybook usedbyrefreservation 0 - mybook com.sun:auto-snapshot true local root#
After some time (even with no file created on the new disk), I have:
root# find /mybook/ /mybook/ /mybook/.zfs /mybook/.zfs/snapshot /mybook/.zfs/snapshot/zfs-auto-snap:hourly-2009-05-08-22:00 /mybook/.zfs/snapshot/zfs-auto-snap:hourly-2009-05-08-22:00/share /mybook/.zfs/snapshot/zfs-auto-snap:frequent-2009-05-08-22:00 /mybook/.zfs/snapshot/zfs-auto-snap:frequent-2009-05-08-22:00/share /mybook/share /mybook/share/.zfs /mybook/share/.zfs/snapshot /mybook/share/.zfs/snapshot/zfs-auto-snap:frequent-2009-05-08-22:00 /mybook/share/.zfs/snapshot/zfs-auto-snap:hourly-2009-05-08-22:00
Now I can share some of the new ZFS files using Samba to my other boxes, and my precious files are protected!
Nevertheless, there is some (annoying) drawbacks to this solution:
- Portability: a ZFS formated USB drive is obviously less portable than a NTFS or FAT32 one, that you could plug on almost any PC. However, keeping a copy of the latest Opensolaris livecd with the drive, I should be able to re-import it and recover the files on another PC with not much trouble (I need to try the procedure!)
- Energy saving: I found ZFS not very friend of smart energy saving drive features. At the beginning o my tests, ZFS would hang after some time (and the drive would be quite hot!). I suspect the drives power saving mode that probably tries to standby them. For the moment a script running every minute creating a random file on the drive is keeping it under some activity, and seems to do the trick (ZFS is’t hungging any more now). It’s not a very nice solution though.
- Booting: the eMachine “server” won’t boot with the USB My Book® Mirror Edition™ plugged, so I manually have to unplug it, boot and plug it (before ZFS imports the zpools). It’s a bit of an hassle, but hopefully shouldn’t happend very often.
- No support for drive status under Opensolaris (for the moment the drivers and tools are for Windows and MacOS), so should a drive fail I’ll have to notice it from the led status. I’m not very satisfied with that either, but I also hope it won’t happend!
- Enclosure failure: should the enclosure fails, the only way to recover the data will be buying the same model (this is the problem with hardware Raid).
What’s next (some open ideas)?
- implement Opensolaris CIFS rather than Samba; I’ll first have to understand Windows and CIFS ACLs…
- find a way to get the status of both physical drives and the Raid status, from Opensolaris…
This morning I had to install some SUNW packages in a remote Solaris 10 x86 system (a Sun Fire X4150). I had the packages in the installation DVD, so I tried to map the DVD as a virtual device using the SUN embedded Light Out Manager console (sun-elom).

Recent Comments