Solved How to access the zpool and zfs dataset of your installation from the LiveCD?

Hi community,

I have a rather odd question. I admit I'm still not that proficient in handling the ZFS. So how is one supposted to access the zpool(s) and zfs dataset(s) of a harddrive through the FreeBSD LiveCD?

I'm asking because I bricked my FreeBSD installation the other day and needed to access some files in order to repair it and to make it boot again. So I booted the FreeBSD USB installation image and chose the LiveCD option. Shouldn't I be able to see the available zpool on my harddrive with zpool list? That command showed me an empty list. What am I missing?
 
Try running the following and see if your pool is listed:

zpool import

If it is, you should be able to import it with:

zpool import poolname
 
Depends a bit, but it all boils down to logging into the live environment and then using # zfs import to load the required kernel modules after which it will search your environment for usable ZFS pool(s).

After that you can import (and mount) the pool using: # zfs import -fR /mnt <name of pool>. This will force the import of the pool (required because otherwise it'll complain about being in use) and it will assign a temporary mount point on /mnt; that's the designated location to mount stuff on your system.

Warning though: If you automatically installed your system then the so called canmount property on your root filesystem will be turned off, and that will result in a few errors when you use the import command (more detailed: your root filesystem won't automatically mount, after that the system will try to mount any other filesystem(s) you may have defined which will then trigger error messages because you're working on a readonly filesystem).. If this happens to you: follow up using zfs list to check that your pool has been imported and that your filesystem(s) are accessible.

If so then follow up by explicitly mounting your root filesystem: zfs mount zroot/DEFAULT/root (from the top of my head, I don't rely on that automated stuff myself) followed by # zfs mount -a. After that everything will be accessible in /mnt.

If you're wondering: they set this up to cater to beadm usage and as a result this procedure has become seriously overcomplicated (the main reason I'm not a fan of the automated installer).
 
Thank you very much droeders, ShelLuser and Datapanic. With that I'm able to mount my root filesystem. Exporting the zpool before rebooting was actually not necessary, but maybe this is more cleaner? Nevertheless, the problem is solved.
 
Back
Top