[FreeBSD] Root-on-ZFS recovery by using snapshots

Posted by on March 29, 2014 in FreeBSD, Tech, ZFS

Root-on-ZFS recovery by using snapshots


An HDD for a rootFS of my FreeBSD machine has broken.
I installed a new HDD and recovered the rootFS from ZFS snapshots.


The new HDD is recognized as /dev/da1.
In this section, da1 is conformed to a broken disk.

Create zpool for rootFS

I named a new zpool rpool2.
An original (broken) zpool was rpool.
If a same name was used, several trouble would be occurred.

Recovery from snapshots

The snapshots have been saved in a zpool named tank.

Then, I recovered the data from the snapshots.


Rename zpool of rootFS

After input above commands, all zfs related commands will stop and give errors.
This is no surprise since the system has two root mountpoints and they conflict.

Create zpool.cache

A zpool.cache is required by the OS for recognition of its storage pools.

Set properties to rootFS

Operation check

Finally, I rebooted the OS and confirmed that the system worked well.
If the system couldn’t mount rootFS, the mountpoint may be wrong.
One of the solutions is changing the mountpoint by


My solution is just an example. Please let me know other easy ways if you know.