Using mount for ZFS file systems is bad practice, the zfs command (#mount /:
mount -t zfs zroot/ROOT/default /tmp/root
# zfs mount
) should be used for that.Using mount for ZFS file systems is bad practice, the zfs command (#mount /:
mount -t zfs zroot/ROOT/default /tmp/root
# zfs mount
) should be used for that.Thanks !You should be able to get to your zfs root this way:
#Boot into Live CD
#run zpool import to get name of zpool (probably zroot)
zpool import
#create a mountpoint for zpool:
mkdir -p /tmp/zroot
#import zpool:
zpool import -fR /tmp/zroot zroot
#create a mountpoint for zfs /:
mkdir /tmp/root
#mount /:
mount -t zfs zroot/ROOT/default /tmp/root
#the directories will now be available in /tmp/root - make changes or save your stuff as needed
#export zpool:
zpool export zroot
#boot normally
[root@rescue-bsd:~ # mkdir /root/a
root@rescue-bsd:~ # mkdir /root/b
/root/a is a directory where we want to mount zfs / filesystem
/root/b for /home partition
root@rescue-bsd:~ # zpool import -d /dev
pool: zroot
id: 2714116618066408679
state: ONLINE
action: The pool can be imported using its name or numeric identifier.
config:
zroot ONLINE
ada0p4 ONLINE
root@rescue-bsd:~ # zpool import -f zroot
cannot mount '/home': failed to create mountpoint
cannot mount '/zroot': failed to create mountpoint
root@rescue-bsd:~ # zfs list
NAME USED AVAIL REFER MOUNTPOINT
zroot 3.84G 1.75T 96K /zroot
zroot/ROOT 3.55G 1.75T 96K none
zroot/ROOT/default 3.55G 192G 3.55G /
zroot/home 294M 1.63T 294M /home
root@rescue-bsd:~ # zfs set mountpoint=/root/a zroot/ROOT/default
root@rescue-bsd:~ # zfs set mountpoint=/root/b zroot/home
root@rescue-bsd:~ # zfs mount zroot/ROOT/default
root@rescue-bsd:~ # zfs mount zroot/home
root@rescue-bsd:~ # cd /root/a
root@rescue-bsd:~/a # ls
.cshrc boot home net sys
.profile boot.config lib proc tmp
.rnd dev libexec rescue usr
COPYRIGHT entropy media root var
bin etc mnt sbin zroot
root@rescue-bsd:~ # zpool export zroot
root@rescue-bsd:~ # zpool import -f zroot
root@rescue-bsd:~ # zfs set mountpoint=/ zroot/ROOT/default
root@rescue-bsd:~ # zfs set mountpoint=/home zroot/home
root@rescue-bsd:~ # df
Filesystem 1K-blocks Used Avail Capacity Mounted on
91.121.XXX.XXX:/home/pub/freebsd11-amd64-rescue 1848410796 347933072 1406560796 20% /
devfs 1 1 0 100% /dev
/dev/md0 29596 2996 24236 11% /etc
/dev/md1 7132 8 6556 0% /mnt
/dev/md2 239516 296 220060 0% /opt
/dev/md3 7132 60 6504 1% /root
procfs 4 4 0 100% /proc
<above>:/opt/local 1848650312 1848411092 220060 100% /usr/local
<above>:/opt/var 1848650312 1848411092 220060 100% /var
/dev/md4 63004 28 57936 0% /tmp
/var/empty 1848650312 1848411092 220060 100% /opt/ovh
root@rescue-bsd:~ # zpool import
pool: zroot
id: 3515742166604024554
state: ONLINE
action: The pool can be imported using its name or numeric identifier.
config:
zroot ONLINE
ada0p4 ONLINE
root@rescue-bsd:~ # mkdir /tmp/mnt
root@rescue-bsd:~ # zpool import -R /tmp/mnt 3515742166604024554
root@rescue-bsd:~ # ls /tmp/mnt/
zroot
root@rescue-bsd:~ # ls /tmp/mnt/zroot/ <--- *** EMPTY ***
root@rescue-bsd:~ # zpool list
NAME SIZE ALLOC FREE EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT
zroot 1.80T 48.8G 1.75T - 1% 2% 1.00x ONLINE /tmp/mnt
root@rescue-bsd:/tmp # zpool list
internal error: failed to initialize ZFS library
root@rescue-bsd:/tmp # zpool status
internal error: failed to initialize ZFS library
root@rescue-bsd:/tmp # w
w: invalid core
geli attach /dev/daxxyy
first. zpool import -af -R /mnt/zfs
where /mnt/zfs
is the local mount point for your pool. If you do not want to mount them use -N
switch. zfs mount -a
/ zfs umount -a
. You can mount given dataset with zfs mount pool/dataset
. zroot/ROOT/default
mount point with zfs set mountpoint=/mnt/zfs/ROOT
, then you need to install that dataset by hand with zfs mount zroot/ROOT/default
because its parent has mountpoint set to none
it will not mount with the rest of datasets.Because this thread bumps up in the search results here are some more hints on how to mount external ZFS pool in case of system crash or other data recovery..
If your ZFS volume is encrypted you need togeli attach /dev/daxxyy
first.
Then you will be able to import ZFS pool withzpool import -af -R /mnt/zfs
where/mnt/zfs
is the local mount point for your pool. If you do not want to mount them use-N
switch.
You can mound and umount all pool datasets withzfs mount -a
/zfs umount -a
. You can mount given dataset withzfs mount pool/dataset
.
In case you are using default layout created by FreeBSD installer, you can modifyzroot/ROOT/default
mount point withzfs set mountpoint=/mnt/zfs/ROOT
, then you need to install that dataset by hand withzfs mount zroot/ROOT/default
because its parent has mountpoint set tonone
it will not mount with the rest of datasets.
zfs mount zroot/ROOT/default
, but ignored it and ran to my success!