Create backups for root with SUSE's subvolume design
- Dominant language
- Perl
- Stars
- 2.1k
- Forks
- 139
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
this is the default subvolume design of SUSE (here SLES 12SP5):
(For simplicity I've filtered any snapshot subvolume.)
```
vlcdbs1p:~ # btrfs su li / | grep -v snapsh
ID 257 gen 2398 top level 5 path @
ID 260 gen 21342 top level 257 path @/boot/grub2/i386-pc
ID 261 gen 21341 top level 257 path @/boot/grub2/x86_64-efi
ID 262 gen 21423 top level 257 path @/home
ID 263 gen 21442 top level 257 path @/opt
ID 264 gen 21340 top level 257 path @/srv
ID 265 gen 21442 top level 257 path @/tmp
ID 266 gen 21336 top level 257 path @/usr/local
ID 267 gen 21424 top level 257 path @/var/cache
ID 268 gen 21334 top level 257 path @/var/crash
ID 269 gen 178 top level 257 path @/var/lib/libvirt/images
ID 270 gen 178 top level 257 path @/var/lib/machines
ID 271 gen 178 top level 257 path @/var/lib/mailman
ID 272 gen 178 top level 257 path @/var/lib/mariadb
ID 273 gen 178 top level 257 path @/var/lib/mysql
ID 274 gen 178 top level 257 path @/var/lib/named
ID 275 gen 178 top level 257 path @/var/lib/pgsql
ID 276 gen 21442 top level 257 path @/var/log
ID 277 gen 178 top level 257 path @/var/opt
ID 278 gen 21442 top level 257 path @/var/spool
ID 279 gen 21423 top level 257 path @/var/tmp
```
And this is the default subvolume:
```
vlcdbs1p:~ # btrfs su get-default /
ID 259 gen 21443 top level 258 path @/.snapshots/1/snapshot
```
This is depending to the functionality of Snapper, means whenever I start a rollback to a snapshot a new default subvolume will be set to this snapshot. Hereby /etc/fstab remains unchanged.
```
vlcdbs1p:~ # cat /etc/fstab
UUID=75466633-932a-4005-852b-37d94a598654 swap swap defaults 0 0
UUID=58b67250-be21-4c17-937c-b0f3603fcce3 / btrfs noatime,defaults 0 0
UUID=58b67250-be21-4c17-937c-b0f3603fcce3 /btrfs btrfs noatime,subvolid=5 0 0
UUID=58b67250-be21-4c17-937c-b0f3603fcce3 /boot/grub2/i386-pc btrfs subvol=@/boot/grub2/i386-pc 0 0
UUID=58b67250-be21-4c17-937c-b0f3603fcce3 /boot/grub2/x86_64-efi btrfs subvol=@/boot/grub2/x86_64-efi 0 0
UUID=58b67250-be21-4c17-937c-b0f3603fcce3 /home btrfs noatime,subvol=@/home 0 0
UUID=58b67250-be21-4c17-937c-b0f3603fcce3 /opt btrfs noatime,subvol=@/opt 0 0
UUID=58b67250-be21-4c17-937c-b0f3603fcce3 /srv btrfs noatime,subvol=@/srv 0 0
UUID=58b67250-be21-4c17-937c-b0f3603fcce3 /tmp btrfs noatime,subvol=@/tmp 0 0
UUID=58b67250-be21-4c17-937c-b0f3603fcce3 /usr/local btrfs noatime,subvol=@/usr/local 0 0
UUID=58b67250-be21-4c17-937c-b0f3603fcce3 /var/cache btrfs noatime,subvol=@/var/cache 0 0
UUID=58b67250-be21-4c17-937c-b0f3603fcce3 /var/crash btrfs noatime,subvol=@/var/crash 0 0
UUID=58b67250-be21-4c17-937c-b0f3603fcce3 /var/lib/libvirt/images btrfs noatime,subvol=@/var/lib/libvirt/images 0 0
UUID=58b67250-be21-4c17-937c-b0f3603fcce3 /var/lib/machines btrfs noatime,subvol=@/var/lib/machines 0 0
UUID=58b67250-be21-4c17-937c-b0f3603fcce3 /var/lib/mailman btrfs noatime,subvol=@/var/lib/mailman 0 0
UUID=58b67250-be21-4c17-937c-b0f3603fcce3 /var/lib/mariadb btrfs noatime,subvol=@/var/lib/mariadb 0 0
UUID=58b67250-be21-4c17-937c-b0f3603fcce3 /var/lib/mysql btrfs noatime,subvol=@/var/lib/mysql 0 0
UUID=58b67250-be21-4c17-937c-b0f3603fcce3 /var/lib/named btrfs noatime,subvol=@/var/lib/named 0 0
UUID=58b67250-be21-4c17-937c-b0f3603fcce3 /var/lib/pgsql btrfs noatime,subvol=@/var/lib/pgsql 0 0
UUID=58b67250-be21-4c17-937c-b0f3603fcce3 /var/log btrfs noatime,subvol=@/var/log 0 0
UUID=58b67250-be21-4c17-937c-b0f3603fcce3 /var/opt btrfs noatime,subvol=@/var/opt 0 0
UUID=58b67250-be21-4c17-937c-b0f3603fcce3 /var/spool btrfs noatime,subvol=@/var/spool 0 0
UUID=58b67250-be21-4c17-937c-b0f3603fcce3 /var/tmp btrfs noatime,subvol=@/var/tmp 0 0
UUID=58b67250-be21-4c17-937c-b0f3603fcce3 /.snapshots btrfs noatime,subvol=@/.snapshots 0 0
```
I have modified this only by adding a mountpoint _/btrfs_ and mount _subvolid=5_ here.
There are no problems to create backups for any subvolume; I just define this _/etc/btrbk/btrbk-vlcdbs1p.conf_:
```
# Backup to external disk (RDB mounted on /backup_rbd_lve_os)
volume /btrfs/@
# no action if external disk is not attached
snapshot_create ondemand
# propagates to all subvolume sections:
target /backup_rbd_lve_os/vlcdbs1p
subvolume var/crash
subvolume usr/sap/hostctrl
subvolume usr/local
subvolume hana/shared
subvolume home
subvolume opt
subvolume srv
subvolume boot/grub2/x86_64-efi
subvolume boot/grub2/i386-pc
```
However, I don't get a backup of root then.
Can you please advise how to fix this?
THX
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.