Imagine that you have your server with an external RAID array running a ZFS file system, or even a separate internal array on the box and the OS array is trashed. Now you have your nice redundant ZFS partition, but no operating system to address it! To test this I have my usual HP MicroServer with 3 x 2TB WD Green drives in it and I have removed the OS disk which runs PCBSD. The new OS disk has FreeBSD 9.0 RC1 on it – I was using it to test jails, but would like to now hook up the 3 ZFS drives as they were attached to the old OS. I had a quick scan through the help files
(man zpool) and the
'import' command seemed the most appropriate:
jtest# zpool list no pools available jtest# zpool import pool: DATA id: 8060566178365973247 state: ONLINE status: The pool is formatted using an older on-disk version. action: The pool can be imported using its name or numeric identifier, though some features will not be available without an explicit 'zpool upgrade'. config: DATA ONLINE raidz1-0 ONLINE ada1 ONLINE ada2 ONLINE ada3 ONLINE
Ok so its found the old ‘DATA’ zpool I had set up, seems that I can just import it…
jtest# zpool import DATA jtest# zpool list NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT DATA 5.44T 1.16G 5.44T 0% 1.00x ONLINE -
Right, now i’d like to upgrade the zpool to the latest greatest:
jtest# zpool upgrade This system is currently running ZFS pool version 28. The following pools are out of date, and can be upgraded. After being upgraded, these pools will no longer be accessible by older software versions. VER POOL --- ------------ 15 DATA Use 'zpool upgrade -v' for a list of available versions and their associated features.
That command just displays options, but I’m interested to find out the extra features, so i’ll do as the output advises:
jtest# zpool upgrade -v This system is currently running ZFS pool version 28. The following versions are supported: VER DESCRIPTION --- -------------------------------------------------------- 1 Initial ZFS version 2 Ditto blocks (replicated metadata) 3 Hot spares and double parity RAID-Z 4 zpool history 5 Compression using the gzip algorithm 6 bootfs pool property 7 Separate intent log devices 8 Delegated administration 9 refquota and refreservation properties 10 Cache devices 11 Improved scrub performance 12 Snapshot properties 13 snapused property 14 passthrough-x aclinherit 15 user/group space accounting 16 stmf property support 17 Triple-parity RAID-Z 18 Snapshot user holds 19 Log device removal 20 Compression using zle (zero-length encoding) 21 Deduplication 22 Received properties 23 Slim ZIL 24 System attributes 25 Improved scrub stats 26 Improved snapshot deletion performance 27 Improved snapshot creation performance 28 Multiple vdev replacements For more information on a particular version, including supported releases, see the ZFS Administration Guide.
The deduplication feature looks good so i’ll just go for it!
jtest# zpool upgrade DATA This system is currently running ZFS pool version 28. Successfully upgraded 'DATA' from version 15 to version 28
Fantastic! As you can see all the data is there and readable from before.
cd /DATA/dans_stuff/ jtest# ls -lah total 811440 drwxr-xr-x 3 root wheel 4B Oct 17 20:50 . drwxr-xr-x 3 root wheel 3B Oct 17 20:50 .. dr-xr-xr-x 4 root wheel 4B Oct 17 20:47 .zfs -rw-r--r-- 1 root wheel 1.0G Oct 17 20:50 FreeBSD-8.2-RELEASE-amd64-memstick.img -rw-r----- 1 root wheel 263M Oct 17 20:43 maillog
Last thing is to ensure that deduplication is activated with the following command:
zfs set dedup=on DATA
jtest# zfs get dedup DATA NAME PROPERTY VALUE SOURCE DATA dedup on local