Recovering files from a ZFS/FUSE snapshot under Linux

A week ago I had a hairy crash when stopping ZFS/FUSE on my box, which I mentioned on the ZFS/FUSE mailing list. I upgraded from 2.6.25.4 to 2.6.26-rc7 and in the process blew away the kernel build tree for the 2.6.25.4 kernel to recover the disk space. Shortly after that I received a query off-list from Miklos Szeredi, the FUSE maintainer, asking if I could supply him a disassembly of the offending function from the kernel build – which was now consigned to the bit bucket. 🙁

Fortunately I’ve been regularly rsync’ing various important parts of my computer onto ZFS/FUSE partitions and snapshoting them with timestamps so I (theoretically) was only a few commands away from getting to the defunct kernel tree once more. The problem is that unfortunately you can’t look at a ZFS/FUSE snapshot directly at the moment, it’s one of the parts that is still to be gotten working under Linux.

Luckily there is a trick to be able to get access, which is is to create a clone of the snapshot. The ZFS Administration Guide describes a clone thus:

A clone is a writable volume or file system whose initial contents are the same as the dataset from which it was created. As with snapshots, creating a clone is nearly instantaneous, and initially consumes no additional disk space. In addition, you can snapshot a clone.

The magic command to do this was just:

zfs clone ZFS/home@20080606-2201 ZFS/temp

and suddenly I had /srv/ZFS/temp, a fully working version of this machines /home directory as it was around 10pm on the 6th June and in it was the kernel tree.

Very nice!

Leave a Reply

Your email address will not be published. Required fields are marked *