Best way to backup a physical host running on ZFS?

turnicus

Active Member
Jun 15, 2020
31
3
28
124
Hello,

I am trying to backup a physical computer running Ubuntu 20.04 installed on ZFS. I tried this simple command:

Code:
sudo proxmox-backup-client backup root.pxar:/ --repository <username>@<ip>:<datastore>

But I realized many files were not backed up (nothing in /home/myusername/ for example). I guess it is related to the way Ubuntu created the mountpoints during installation to work with ZSys (see https://didrocks.fr/2020/06/16/zfs-focus-on-ubuntu-20.04-lts-zsys-dataset-layout/):

Code:
zfs list
NAME                                               USED  AVAIL     REFER  MOUNTPOINT
bpool                                              258M  1,50G       96K  /boot
bpool/BOOT                                         257M  1,50G       96K  none
bpool/BOOT/ubuntu_e9emv8                           257M  1,50G      180M  /boot
rpool                                             9,42G   101G      192K  /
rpool/ROOT                                        5,89G   101G      192K  none
rpool/ROOT/ubuntu_e9emv8                          5,89G   101G     3,49G  /
rpool/ROOT/ubuntu_e9emv8/srv                       192K   101G      192K  /srv
rpool/ROOT/ubuntu_e9emv8/usr                       932K   101G      192K  /usr
rpool/ROOT/ubuntu_e9emv8/usr/local                 740K   101G      484K  /usr/local
rpool/ROOT/ubuntu_e9emv8/var                      1,23G   101G      192K  /var
rpool/ROOT/ubuntu_e9emv8/var/games                 192K   101G      192K  /var/games
rpool/ROOT/ubuntu_e9emv8/var/lib                  1,21G   101G      864M  /var/lib
rpool/ROOT/ubuntu_e9emv8/var/lib/AccountsService   516K   101G      248K  /var/lib/AccountsService
rpool/ROOT/ubuntu_e9emv8/var/lib/NetworkManager   1,12M   101G      288K  /var/lib/NetworkManager
rpool/ROOT/ubuntu_e9emv8/var/lib/apt               148M   101G      132M  /var/lib/apt
rpool/ROOT/ubuntu_e9emv8/var/lib/dpkg             87,4M   101G     53,4M  /var/lib/dpkg
rpool/ROOT/ubuntu_e9emv8/var/log                  12,2M   101G     4,51M  /var/log
rpool/ROOT/ubuntu_e9emv8/var/mail                  192K   101G      192K  /var/mail
rpool/ROOT/ubuntu_e9emv8/var/snap                  712K   101G      440K  /var/snap
rpool/ROOT/ubuntu_e9emv8/var/spool                 936K   101G      344K  /var/spool
rpool/ROOT/ubuntu_e9emv8/var/www                   192K   101G      192K  /var/www
rpool/USERDATA                                    3,51G   101G      192K  /
rpool/USERDATA/myusername_qv8k04                       3,51G   101G     3,00G  /home/myusername
rpool/USERDATA/root_qv8k04                        1,39M   101G      372K  /root

So, to backup the equivalent of "/", I run:

Code:
sudo proxmox-backup-client backup root.pxar:/ --repository <username>@<ip>:<datastore> --include-dev '/boot' --include-dev '/' --include-dev '/srv' --include-dev '/usr' --include-dev '/usr/local' --include-dev '/var' --include-dev '/var/games' --include-dev '/var/lib' --include-dev '/var/lib/AccountsService' --include-dev '/var/lib/NetworkManager' --include-dev '/var/lib/apt' --include-dev '/var/lib/dpkg' --include-dev '/var/log' --include-dev '/var/mail' --include-dev '/var/snap' --include-dev '/var/spool' --include-dev '/var/www' --include-dev '/home/myusername' --include-dev '/root'

  • I need to set every paths or the the subdirectories are not included in the backups (for example: --include-dev '/var' does not include '/var/games'). Otherwise, I would just have left --include-dev '/'

  • --exclude doesn't exclude from --include-dev (for example: --include-dev '/home/myusername' --exclude '/home/myusername/.cache' doesn't exclude '/home/myusername/.cache')

What is the correct way to backup a system installed on ZFS?

Thanks for any help!
 
Last edited:
Hi,
thanks for reporting! The issue with exclusion was a bug (we didn't have an initial slash in the path we matched). A fix for it is in git, please try it out when the next version of the proxmox-backup-client package is available.

Regarding the other issue, there is an all-file-systems option for pxar which would include all such sub-datasets. The thing is, it's not yet exposed for the proxmox-backup-client. I'll test it and see if it's safe to expose and report back then (there's an upcoming release for PVE, so I might not have time to do so immediately). For now, you'll need include all datasets explicitly.
 
Thanks Fabian. I'll just keep including all datasets "manually" until it is implemented in the client then. I was just worried that Ubuntu changes its datasets structure in the future but I'll stick with 20.04 for the moment anyway.
 
Last edited:
BTW: The Ubuntu ZFS-structure is really crazy. Lots of totally unnessary file systems, which make things really complicated. I looks like someone had the task to create as much file systems as possible. :-(. In my installations I tend to go the old way and convert an existing installation to ZFS to reduce the number of file systems. Hopefully Ubuntu changes this crazy structure at some time to something simpler (or at least give the option for this).
 
BTW: The Ubuntu ZFS-structure is really crazy. Lots of totally unnessary file systems, which make things really complicated. I looks like someone had the task to create as much file systems as possible. :-(. In my installations I tend to go the old way and convert an existing installation to ZFS to reduce the number of file systems. Hopefully Ubuntu changes this crazy structure at some time to something simpler (or at least give the option for this).
I guess it is needed for ZSsys to work correctly. For example, you can restore the system files to a previous snapshot but preserve the user data of the actual snapshot. Quite handy sometimes...
 
I guess it is needed for ZSsys to work correctly. For example, you can restore the system files to a previous snapshot but preserve the user data of the actual snapshot. Quite handy sometimes...
It is a good thing to have user data and the system on two different zfs file systems. Proxmox does it also. But there is no reason to split up the system data into 18 diferent file systems.
 
Hi,
thanks for reporting! The issue with exclusion was a bug (we didn't have an initial slash in the path we matched). A fix for it is in git, please try it out when the next version of the proxmox-backup-client package is available.

Regarding the other issue, there is an all-file-systems option for pxar which would include all such sub-datasets. The thing is, it's not yet exposed for the proxmox-backup-client. I'll test it and see if it's safe to expose and report back then (there's an upcoming release for PVE, so I might not have time to do so immediately). For now, you'll need include all datasets explicitly.
FYI, new packages with the above fix and feature are now available.
 
Thanks. I updated to the last version (proxmox-backup-client 1.0.8) but I still have a problem with --exclude:

--include-dev '/home/myusername' --exclude '/home/myusername/.cache' doesn't exclude '/home/myusername/.cache'

Is there a problem with my syntax?
 
Thanks. I updated to the last version (proxmox-backup-client 1.0.8) but I still have a problem with --exclude:

--include-dev '/home/myusername' --exclude '/home/myusername/.cache' doesn't exclude '/home/myusername/.cache'

Is there a problem with my syntax?
Could you share the full command you are using? Note that the path to exlude needs to be relative to the archive's root, e.g.
Code:
proxmox-backup-client backup --backup-id test --repository 192.168.20.180:datastore test.pxar:/path/to/archive/root --include-dev /path/to/archive/root/mount --exclude /mount/exclude.me

When you browse the backup on PBS, there should be a .pxarexclude-cli file in the top level of the archive. What are its contents?
 
Ooh thanks. I got it now, I was using absolute paths instead of relative paths... (the --exclude argument is relative to --include-dev).

To make it clear for other people:
  • INCORRECT way = proxmox-backup-client backup home_<pc_username>.pxar:/home/<pc_username> --repository <pbs_user>@<pbs_ip>:<pbs_datastore> --include-dev "/home/<pc_username>" --exclude /home/<pc_username>/.cache

  • CORRECT way = proxmox-backup-client backup home_<pc_username>.pxar:/home/<pc_username> --repository <pbs_user>@<pbs_ip>:<pbs_datastore> --include-dev "/home/<pc_username>" --exclude /.cache

Thanks!
 
Last edited:

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!