I'm working towards backing up a laptop running Ubuntu on ZFS. I have a backup server also running ZFS on some ancillary volumes (not the root).
I made a snapshot of bpool
today and sent it to the backup server using zfs send / recv
commands:
export SNAPSHOT=first-backup-2022-01-27
zfs snapshot -r bpool@$SNAPSHOT
zfs send -LRc bpool@$SNAPSHOT | pv | ssh [email protected] zfs recv -F susepool0/sets/1M/os-images/Ubuntu-thinkpad-t460s/bpool@$SNAPSHOT
This works fine for the first backup, but when I went to the server where the backups will be stored, the mountpoint is still set to /boot
:
zfs list | grep t460s
susepool0/sets/1M/os-images/Ubuntu-thinkpad-t460s/bpool@first-backup-2022-01-27 591M 3.83T 96K /boot
susepool0/sets/1M/os-images/Ubuntu-thinkpad-t460s/bpool/BOOT@first-backup-2022-01-27 591M 3.83T 96K none
susepool0/sets/1M/os-images/Ubuntu-thinkpad-t460s/bpool/BOOT/ubuntu_qjvcro@first-backup-2022-01-27 591M 3.83T 162M /boot
How can I best configure this backup so its mountpoints don't conflict with the server they will be stored on? The rpool
has everything, like /usr
, /var
, /etc
- I could see that being a real mess if those were allowed to re-mount remotely.
Edit: Someone asked me to post the ZFS mountpoints on the source and destination because they thought it might be helpful, so I am happy to oblige:
Edit edit (1-30-2021): I was asked to make these lists less voluminous, so these lists only include the most pertinent filesystem mounts to demonstrate what I'm saying about how the zfs mountpoints will conflict with the unix file paths if a snapshot image is sent containing the same mounts
I'm thinking a possible solution could be to set an alternate root for the snapshots, either before or after the snapshot is sent, but I am not sure how to do that or what command would be responsible.
Client (source) - This is the machine running ZFS root (Ubuntu 21.10):
❯ for i in bpool rpool/ROOT; do echo ' '; zfs list -t filesystem -o name,mountpoint -d 4 $i; done
NAME MOUNTPOINT
bpool /boot
bpool/BOOT none
bpool/BOOT/ubuntu_qjvcro /boot
NAME MOUNTPOINT
rpool/ROOT none
rpool/ROOT/ubuntu_qjvcro /
rpool/ROOT/ubuntu_qjvcro/srv /srv
rpool/ROOT/ubuntu_qjvcro/usr /usr
rpool/ROOT/ubuntu_qjvcro/usr/local /usr/local
rpool/ROOT/ubuntu_qjvcro/var /var
rpool/ROOT/ubuntu_qjvcro/var/games /var/games
rpool/ROOT/ubuntu_qjvcro/var/lib /var/lib
rpool/ROOT/ubuntu_qjvcro/var/lib/AccountsService /var/lib/AccountsService
rpool/ROOT/ubuntu_qjvcro/var/lib/NetworkManager /var/lib/NetworkManager
rpool/ROOT/ubuntu_qjvcro/var/lib/apt /var/lib/apt
rpool/ROOT/ubuntu_qjvcro/var/lib/dpkg /var/lib/dpkg
rpool/ROOT/ubuntu_qjvcro/var/lib/machines /var/lib/machines
rpool/ROOT/ubuntu_qjvcro/var/log /var/log
rpool/ROOT/ubuntu_qjvcro/var/mail /var/mail
rpool/ROOT/ubuntu_qjvcro/var/snap /var/snap
rpool/ROOT/ubuntu_qjvcro/var/spool /var/spool
rpool/ROOT/ubuntu_qjvcro/var/www /var/www
Server (destination) - note, this machine uses btrfs for its root filesystem, but that doesn't mean a if rpool/ROOT
tries to mount to /
it won't be a problem:
❯ ssh osuse-leap zfs list -t filesystem,volume -o name,mountpoint -d 2
NAME MOUNTPOINT
susepool0 /mnt/susepool0
susepool0/sets /mnt/susepool0/sets
susepool0/sets/16K /mnt/susepool0/sets/16K
susepool0/sets/1M /mnt/susepool0/sets/1M
susepool0/sets/4K /mnt/susepool0/sets/4K
susepool0/sets/64K /mnt/susepool0/sets/64K
susepool0/sets/chipmunk-user-folder /mnt/ubuntu/home/avery
susepool0/snapper-backup /mnt/snapper
susepool0/snapper-backup/vols /mnt/snapper/vols
susepool0/vols /mnt/susepool0/vols
susepool0/vols/endpoint-bob-image -
susepool0/vols/macosvol0 -
susepool0/vols/real-endpoint-bob -
susepool0/vols/testvol -
susepool0/vols/vmfspool0 -
Firstly, I have no knowledge in
BTFS
and I cannot say if sendingZFS
snapshots on it works transparently. This could lead to your issue.Secondly, about
ZFS
mount related properties:mountpoint
can use inheritancecanmount
manage if a pool is mounted by defaultoverlay
manage the case when a mountpoint exists before mountIn your case, I do not understand what are your source/destination dataset and I cannot see a dataset used as parent on destination. If you send
rpool/ROOT/ubuntu_qjvcro
, it will be mounted on/
on dest.You can combine properties above to avoid mounting on
/
But a more clever way will be using child datasets…
rpool/ROOT/ubuntu_qjvcro/srv
rpool/ROOT/ubuntu_qjvcro/var/www
…to a destination dataset with a mountpoint properly set:
susepool0/backup/qjvcro
withmountpoint=/mnt/backup/qjvcro/
(for instance)In this case, a source like
rpool/ROOT/ubuntu_qjvcro/srv
will be mounted on dest to/mnt/backup/qjvcro/srv