2

I did a backup of the entire zfs root (zroot) dataset from my laptop to my workstation. The backup dataset got all the mountpoints from the laptop.

tank/backup                                     91.4G  8.50T      192K  /tank/backup
tank/backup/dell                                91.4G  8.50T      192K  none
tank/backup/dell/ROOT                           28.3G  8.50T      192K  none
tank/backup/dell/ROOT/manjaro                   28.3G  8.50T      192K  none
tank/backup/dell/ROOT/manjaro/boot              119M  8.50T      11.1M  /boot
tank/backup/dell/ROOT/manjaro/paccache          5.88G  8.50T     5.88G  /var/cache/pacman
tank/backup/dell/ROOT/manjaro/root              17.7G  8.50T     8.67G  /
tank/backup/dell/ROOT/manjaro/tmp               53.5M  8.50T     53.5M  /tmp
tank/backup/dell/ROOT/manjaro/var               4.58G  8.50T      192K  none
tank/backup/dell/ROOT/manjaro/var/cache         6.88M  8.50T     6.88M  /var/cache
tank/backup/dell/ROOT/manjaro/var/lib           4.57G  8.50T      192K  none
tank/backup/dell/ROOT/manjaro/var/lib/docker    4.57G  8.50T      148M  /var/lib/docker
...

Obviously I don't want to mount tank/backup/dell/ROOT/manjaro/var/lib/docker in /var/lib/docker and so on. I would like to rewrite the / path for tank/backup/dell to all mount at /mnt/backup/dell or sth like this.

I know this is possible for entire an entire zpool with zpool import -R /mnt. Is there a similar functionality to rewrite the dataset mount point?

I am certainly not the first person to do this. Is there a best practice solution on how to access full system snapshots on a remote host like this one?

Dave M
  • 4,514
  • 22
  • 31
  • 30
stfl
  • 123
  • 4

1 Answers1

2

The only way to do this is using a 3 line shell script loop to explicitly change the mountpoint of all the file systems using zfs set mountpoint=...

Gordan Bobić
  • 971
  • 4
  • 11
  • Apparently there wasn't even a feature request for this, so I opened one: https://github.com/openzfs/zfs/issues/10968 – jplitza Sep 23 '20 at 05:33