0

Actually I have installed my daily work FreeBSD 13.1-RELEASE system on the ZFS disk ada0 :

=>       40  976773088  ada0  GPT  (466G)

         40     532480     1  efi  (260M)

     532520       1024     2  freebsd-boot  (512K)

     533544        984        - free -  (492K)

     534528    4194304     3  freebsd-swap  (2.0G)

    4728832  972044288     4  freebsd-zfs  (464G)

  976773120          8        - free -  (4.0K)

instead,on the disk ada2 I have installed most of the services and applications that I have installed on the drive ada0 and sometimes I switch to this system (it's the same 13.1-RELEASE,but on a UFS2 fs) :

=>       40  625142368  ada2  GPT  (298G)

         40     532480     1  efi  (260M)

     532520  616030208     2  freebsd-ufs  (294G)

  616562728    8388608     3  freebsd-swap  (4.0G)

  624951336     191072        - free -  (93M)

sometimes,when I'm on the system installed on the disk ada2,I want to mount the root partition of the system installed on /dev/ada0p4 (FreeBSD-ZFS on the disk ada0) and to do that,I use these commands :

zfs mount -a
mount -t zfs -fw zroot/ROOT/31-03-2022-b /mnt/freebsd-zfs

what's the problem ? the problem is that it works a lot of time,but not everytime and I don't understand the reason. Sometimes,like now,it gives the error below. Is there a more secure way to mount the ZFS partition so that it works 100% ? thanks.

mount: zroot/ROOT/31-03-2022-b: No such file or directory

UPDATE : I tried this,it almost worked,but unfortunately I don't see every file and folder stored on the disk :

# zpool import -f -R /mnt/freebsd-zfs zroot 
ls /mnt/freebsd-zfs tmp   
usr    var    zroot

this also didn't work :

# zpool import -f -R /mnt/freebsd-zfs zroot/ROOT/31-03-2022-b 
cannot import 'zroot/ROOT/31-03-2022-b': no such pool available

I want mount the path "zroot/ROOT/31-03-2022-b" :

# sudo zfs list

NAME                      USED  AVAIL     REFER  MOUNTPOINT  

zroot                     216G   230G       96K  /mnt/freebsd-zfs/zroot
zroot/ROOT                203G   230G       96K  none
zroot/ROOT/31-03-2022-a   512K   230G     43.4G  /mnt/freebsd-zfs
zroot/ROOT/31-03-2022-b   203G   230G      175G  /mnt/freebsd-zfs
zroot/tmp                10.6M   230G     10.6M  /mnt/freebsd-zfs/tmp
zroot/usr                11.7G   230G       96K  /mnt/freebsd-zfs/usr
zroot/usr/home            192K   230G      192K  /mnt/freebsd-zfs/usr/home
zroot/usr/ports          8.33G   230G     8.33G  /mnt/freebsd-zfs/usr/ports
zroot/usr/src            3.36G   230G     3.36G  /mnt/freebsd-zfs/usr/src
zroot/var                1.26G   230G       96K  /mnt/freebsd-zfs/var
zroot/var/audit            96K   230G       96K  /mnt/freebsd-zfs/var/audit
zroot/var/crash          1.11G   230G     1.11G  /mnt/freebsd-zfs/var/crash
zroot/var/log            3.59M   230G     3.59M  /mnt/freebsd-zfs/var/log
zroot/var/mail            130M   230G      130M  /mnt/freebsd-zfs/var/mail
zroot/var/tmp            18.1M   230G     18.1M  /mnt/freebsd-zfs/var/tmp

1 Answer 1

0

Try setting the altroot property on the pool to /mnt/freebsd-zfs before importing it or zfs mount-ing any of the datasets.

From man zpoolprops:

altroot

Alternate root directory. If set, this directory is prepended to any mount points within the pool. This can be used when examining an unknown pool where the mount points cannot be trusted, or in an alternate boot environment, where the typical paths are not valid.

altroot is not a persistent property. It is valid only while the system is up.

Setting altroot defaults to using cachefile=none, though this may be overridden using an explicit setting.

Note that it says "not a persistent property". You'll need to do this every time you want to import the pool and mount its datasets into your ufs2 boot environment.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .