any best-practices for converting part of fs to zfs?

hi

i've been reading over the quick start guide for zfs, and i'm wondering if anyone has any stories, tips or tricks for converting part of a fs to zfs on an active, post-install system.

i'd like to use zfs for /usr, as illustrated in the quick start guide. its not clear to me if the steps done in the quick start guide need to be done directly after installation, or if they can be applied to a working system.

any info or anecdotes appreciated
thanks
brad
 
There isn't really anything to it. But you're not going to be able to convert part of a filesystem, assuming that you've got your /usr on a different partition it's just a matter of backing up that data, creating a pool and setting it to mount there on boot.

That tends to be how I run my system, but that's mostly because I'm too lazy to go through the steps to install zfs only. You should find all the information you need in that page you referenced.
 
b7j0c said:
hi

i've been reading over the quick start guide for zfs, and i'm wondering if anyone has any stories, tips or tricks for converting part of a fs to zfs on an active, post-install system.

i'd like to use zfs for /usr, as illustrated in the quick start guide. its not clear to me if the steps done in the quick start guide need to be done directly after installation, or if they can be applied to a working system.

any info or anecdotes appreciated
thanks
brad

lets say you make a filesystem tank and you want to migrate /usr/ to tank These are the steps i'd take:

Code:
zfs create tank/usr
zfs create -o compression=on -o setuid=off tank/usr/ports
zfs create -o compression=off -o exec=off -o setuid=off tank/usr/ports/distfiles
zfs create -o compression=off -o exec=off -o setuid=off tank/usr/ports/packages
zfs create -o compression=on -o exec=off -o setuid=off tank/usr/src
zfs create tank/usr/local

now you should have something like:
Code:
/tank/
/tank/usr
/tank/usr/ports
/tank/usr/ports/distfiles
/tank/usr/ports/packages
/tank/usr/src
/tank/usr/local

so now you need to copy the data over
Code:
find -x /usr/ | cpio -pmd /tank/

if i got my command right (i think i did, doing this from memory) you should now have everything copied over correctly, now all you need to do is set the mountpoint for tank/usr

Code:
zfs set mountpoint=/usr tank/usr
and that should be it
 
And, if things are working correctly, then unmount the ZFS /usr and delete everything in the /usr directory. :) Same for all the other directories. Otherwise, storage will go "missing".

The only bit I do differently is to boot to single-user mode, move the directory to <name>.orig, mount the ZFS filesystem to the correct location, and then run the cpio command to transfer the data. Same result, different path. :)
 
ikbendeman said:
why cpio instead of cp? whats the difference? i feel like maybe im going to get a RTFM...
Cp will screw up soft and hard links.
 
And cp also won't preserve all permissions, especially flags. cpio will.

rsync or tar could also be used. Basically, anything that will preserve ownership, permissions, flags, hard/soft links can be used.

cp and mv don't fall into that category.
 
Back
Top