Trident ZFS pool /usr/local mystery


#1

I wonder where /usr/local is stored in the Trident ZFS pool. If I import trident using Antergos, I can’t see it.


TrueOS Tips, Tricks, and FAQ
#2
/usr/local is a directory under the boot environment root filesystem.
John
groenveld@acm.org

#3

And since boot environments are basically snapshots, you may need to explicitly mount the snapshot on another system.
With the pool imported on the other system, does “zfs list -t snap” show you the boot environments? If so then you’ll need to pick one and mount the snapshot.


#4

I see the list but I wonder how to mount them. I can’t import them by name.

zpool import trident -R /mnt
[root@ant-pc ant]# zfs list 
NAME                                           USED  AVAIL  REFER  MOUNTPOINT
trident                                       15,8G  2,60G    88K  none
trident/ROOT                                  14,1G  2,60G    88K  none
trident/ROOT/13.0-CURRENT-up-20181113_235408  6,84M  2,60G  7,12G  /mnt
trident/ROOT/13.0-CURRENT-up-20181121_162039  14,1G  2,60G  7,40G  /mnt
trident/ROOT/initial                          7,02M  2,60G  3,56G  /mnt/mnt
trident/tmp                                    144K  2,60G   144K  /mnt/tmp
trident/usr                                   1,65G  2,60G    88K  none
trident/usr/home                              1,65G  2,60G  1,65G  /mnt/usr/home
trident/usr/jails                               88K  2,60G    88K  /mnt/usr/jails
trident/usr/obj                                 88K  2,60G    88K  /mnt/usr/obj
trident/usr/ports                               88K  2,60G    88K  /mnt/usr/ports
trident/usr/src                                 88K  2,60G    88K  /mnt/usr/src
trident/var                                    960K  2,60G    88K  none
trident/var/audit                               88K  2,60G    88K  /mnt/var/audit
trident/var/log                                572K  2,60G   572K  /mnt/var/log
trident/var/mail                               112K  2,60G   112K  /mnt/var/mail
trident/var/tmp                                100K  2,60G   100K  /mnt/var/tmp

[root@ant-pc ant]# zfs list -t snap
NAME                                                               USED  AVAIL  REFER  MOUNTPOINT
trident/ROOT/13.0-CURRENT-up-20181121_162039@2018-11-13-23:45:43  2,23G      -  3,56G  -
trident/ROOT/13.0-CURRENT-up-20181121_162039@2018-11-21-16:11:17  4,47G      -  7,12G  -

[root@ant-pc ant]# mkdir /snap
[root@ant-pc ant]# zpool import trident/ROOT/13.0-CURRENT-up-20181121_162039@2018-11-21-16:11:17 -R /snap
cannot import 'trident/ROOT/13.0-CURRENT-up-20181121_162039@2018-11-21-16:11:17': no such pool available
[root@ant-pc ant]# zpool import trident/ROOT/13.0-CURRENT-up-20181121_162039 -R /snap
cannot import 'trident/ROOT/13.0-CURRENT-up-20181121_162039': no such pool available

#5

man zfs look for the mount command.
If this is on a Linux distro, maybe try mount -t zfs

by default snapshots are readonly when mounting, you may also want to be aware of the mountpoint property of the dataset.


#6

I can’t use the normal mount command under Linux. zfs mount also doesn’t work.

[root@ant-pc ant]# mount -t zfs /dev/sda5 /trident/
filesystem 'trident' cannot be mounted using 'mount'.
Use 'zfs set mountpoint=legacy' or 'zfs mount trident'.
See zfs(8) for more information.
[root@ant-pc ant]# zfs mount  -o mountpoint=legacy trident/ROOT/13.0-CURRENT-up-20181121_162039
cannot mount '/mnt': directory is not empty
[root@ant-pc ant]# zpool export trident
[root@ant-pc ant]# zpool import trident -R /trident
[root@ant-pc ant]# zfs mount  -o mountpoint=legacy trident/ROOT/13.0-CURRENT-up-20181121_162039
cannot mount '/trident': directory is not empty
[root@ant-pc ant]# zfs mount  -o mountpoint=/mnt trident/ROOT/13.0-CURRENT-up-20181121_162039
cannot mount '/trident': directory is not empty
[root@ant-pc ant]# zfs set mountpoint=legacy trident
[root@ant-pc ant]# mount -t zfs /dev/sda5 /trident/
[root@ant-pc ant]# l /trident/
insgesamt 5
drwxr-xr-x  2 root root    2 13. Nov 20:10 .
drwxr-xr-x 23 root root 4096 25. Nov 21:31 ..

#7

Even for /dev/sda3 it doesn’t work:

[root@ant-pc ant]# umount /trident
[root@ant-pc ant]# mount -t zfs /dev/sda3 /trident/
[root@ant-pc ant]# l /trident/
insgesamt 5
drwxr-xr-x  2 root root    2 13. Nov 20:10 .
drwxr-xr-x 23 root root 4096 25. Nov 21:31 ..
[root@ant-pc ant]# df
Dateisystem    1K-Blöcke   Benutzt Verfügbar Verw% Eingehängt auf
dev              3010532         0   3010532    0% /dev
run              3051412      1168   3050244    1% /run
/dev/sda1       59950980  15473676  43846520   27% /
tmpfs            3051412    178800   2872612    6% /dev/shm
tmpfs            3051412         0   3051412    0% /sys/fs/cgroup
tmpfs            3051412        48   3051364    1% /tmp
/dev/sda2       34482952  15298092  17403512   47% /home
/dev/sdc4      807194152 455943512 310177900   60% /backup-home
/dev/sdb2      503833832 462108060  40685388   92% /data
tmpfs             610280        20    610260    1% /run/user/1000
trident          2626432         0   2626432    0% /trident

#8

man zfs, there should be a “zfs mount” command that you use to mount the snapshot, not the pool or the partition.

if you google “zfs mount snapshot” you get a boatload of links, here’s one https://docs.oracle.com/cd/E19253-01/819-5461/6n7ht6r4j/index.html
After you did the zpool import, zfs list showed

Those are BOOT ENVIRONMENTS, which are basically snaphots, you can do a zfs mount on them giving an alternate mountpoint or you can go and cd /mnt/trident/ROOT/13.0-CURRENT-up-20181121_162039 and do an ls there. You will find the “old” /usr and /usr/local.

The reasonI am suggesting trying to mount them is I’m assuming you are wanting to modify them and by default snapshots are readonly.


#9

Ok, I’ve got it: I HAVE TO set the mountpoint for the snapshots first, NOT use the “-o mountpoint=” option during zfs mount.

zpool import trident -R /trident/
zfs set mountpoint=/mnt trident/ROOT/13.0-CURRENT-up-20181113_235408
zfs mount trident/ROOT/13.0-CURRENT-up-20181113_235408
df
trident/tmp                                    1837568       256   1837312    1% /trident/tmp
trident/usr/home                               2367104    529792   1837312   23% /trident/usr/home
trident/usr/jails                              1837440       128   1837312    1% /trident/usr/jails
trident/usr/obj                                1837440       128   1837312    1% /trident/usr/obj
trident/usr/ports                              1837440       128   1837312    1% /trident/usr/ports
trident/usr/src                                1837440       128   1837312    1% /trident/usr/src
trident/var/audit                              1837440       128   1837312    1% /trident/var/audit
trident/var/log                                1837824       512   1837312    1% /trident/var/log
trident/var/mail                               1837440       128   1837312    1% /trident/var/mail
trident/var/tmp                                1837440       128   1837312    1% /trident/var/tmp
trident/ROOT/13.0-CURRENT-up-20181113_235408   9305856   7468544   1837312   81% /trident/mnt