Multiplay Labs

tech hits and tips from Multiplay

Archive for January 14th, 2013

Renaming root zfs pool on FreeBSD

without comments

While not often required its sometimes nice to be able to rename the root zfs pool.

Armed with a mfsbsd cdrom this is a relatively painless process under FreeBSD (8.3-RELEASE in out case).

In this example we’re renaming the default root zpool from tank to zroot
1. Boot from mfsbsd cdrom
2. Import the root pool into an alternative location specifying a cachefile, this is in the important bit, as using -R sets cachefile=none which won’t generate the changes required.

zpool import -o altroot=/mnt -o cachefile=/boot/zfs/zpool.cache tank zroot

3. Copy the new cachefile to zpool updating the existing one.

cp /boot/zfs/zpool.cache /mnt/boot/zfs/zpool.cache

4. Update /mnt/boot/loader.conf with the new details e.g. vfs.root.mountfrom="zfs:zroot/root"
5. Reboot

If you have more thank one pool then always best to import them all even if not renaming them to ensure the new zpool.cache contains all your pools

Written by Dilbert

January 14th, 2013 at 5:01 pm

Posted in FreeBSD,ZFS