Score:0

ZFS: Backup a disk with mountpoints that conflict with backup computer?

de flag

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              -

freezed avatar
cn flag
Can you post the result of `zfs list -ro name,mountpoint rpool` for both source and dest?
AveryFreeman avatar
de flag
@freezed sure thing, updated OP.
freezed avatar
cn flag
OK, thanks. But please try to be as concise as possible: suggested commands limits output to usefull data: size information harden reading and understanding. Here I am not on a wide screen to get all data without scrolling… I'll give my answer later when I can read
AveryFreeman avatar
de flag
@freezed you got it, good suggestion. Please see revised.
Score:0
cn flag

Firstly, I have no knowledge in BTFS and I cannot say if sending ZFS snapshots on it works transparently. This could lead to your issue.

Secondly, about ZFS mount related properties:

  • mountpoint can use inheritance
  • canmount manage if a pool is mounted by default
  • overlay manage the case when a mountpoint exists before mount

In 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
  • etc.

…to a destination dataset with a mountpoint properly set:

  • susepool0/backup/qjvcro with mountpoint=/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

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.