Hi,
I purged most of my backups and I now I was thinking about excluding my linux swap and windows cache virtual disks from the backups so that this often changing (so not deduplicatable) but unimportant data doesn't fill up my PBS datastore. Especially because I plan to store more backups for many years so backing up swap would accumulate over time.
All VMs are already setup to use a dedicated virtual disk for swap/caching because in the past I put these on a HDD pool to prevent wear on my consumer SSD pool. Meanwhile everything is on the same enterprise SSD ZFS pool or single disk enterprise SSD LVM-thin.
But if I would exclude these cache/swap disks from the backups and would try to restore the VMs I got the problem that the initramfs can't start because this swap disk is setup in fstab but not available anymore.
Last time I tried to restore a already existing VM with excluded disks this was problematic and deleted a existing but excluded disk. So I had no backup (because it was excluded) and also lost the working existing virtual disk because it looks like PVE is deleting the complete VM with all its virtual disks before create a new VM with the same VMID when doing a restore. So its basically wiping all the virtual disks without asking for permissio nto do that when doing a restore.
Is there already a feature request for an option to tell PVE not to delete all disks and just replace existing virtual disks so disks excluded from backups will still remain on the VM storage? This would really help when restoring a backup with excluded disk of a already existing VM. In that case restoring a VM with excluded swap disk wouldn't be a problem because the excluded swap disk would still be existing and could be reused again by the restored VM.
Previously I had no idea to handle this but with PVE7.1 we got 2 new features that could be useful. First it is now possible to protect backups from pruning and secondly we can now easily move disks between VMs using the webUI.
So my idea was to do a initial backup for all VMs but just with the empty swap disk included (so all root/data disks excluded via the VM config). Then I could set a comment like "swap disk only" and enable pruning protection so it won't get auto deleted. After that I could invert the disk settings so all regular backups will only include the root/data disks but swap/cache disks will be excluded.
If I then for example would want to restore a existing VM (lets say VMID100 with a root disk and a swap disk) I would first restore the normal backup as VMID100. This will replace the root disk with the one of the backup and will delete the swap disk. Then I could restore the "swap only" backup as temporary VMID 999, move that swap disk from VMID 999 VM to VMID 100 VM, attach it to my VMID 100 VM and delete the VMID 999 VM again.
If I'm not wrong this should work as a workaround?
And can someone confirm that it s not problematic to loose the swap data? As far as I know with linux swap is just swapped out RAM and RAM is volatile and would be lost anyway with "snapshot" mode backups. And with "stop" mode backups the RAM (and so the swap) should be empty anyway. So I guess this won't be a problem when the swap disk is replaced with a empty one (but with same UUID) when restoring a snapshot. But how is this with Win10 and its swap file? Same as with linux? There I got a 16GB virtual disk partitioned with NTFS that is setup to be used for a 8GB windows swap file and for stuff like my browser cache.
How do you handle backups and temporary data like swap?
I purged most of my backups and I now I was thinking about excluding my linux swap and windows cache virtual disks from the backups so that this often changing (so not deduplicatable) but unimportant data doesn't fill up my PBS datastore. Especially because I plan to store more backups for many years so backing up swap would accumulate over time.
All VMs are already setup to use a dedicated virtual disk for swap/caching because in the past I put these on a HDD pool to prevent wear on my consumer SSD pool. Meanwhile everything is on the same enterprise SSD ZFS pool or single disk enterprise SSD LVM-thin.
But if I would exclude these cache/swap disks from the backups and would try to restore the VMs I got the problem that the initramfs can't start because this swap disk is setup in fstab but not available anymore.
Last time I tried to restore a already existing VM with excluded disks this was problematic and deleted a existing but excluded disk. So I had no backup (because it was excluded) and also lost the working existing virtual disk because it looks like PVE is deleting the complete VM with all its virtual disks before create a new VM with the same VMID when doing a restore. So its basically wiping all the virtual disks without asking for permissio nto do that when doing a restore.
Is there already a feature request for an option to tell PVE not to delete all disks and just replace existing virtual disks so disks excluded from backups will still remain on the VM storage? This would really help when restoring a backup with excluded disk of a already existing VM. In that case restoring a VM with excluded swap disk wouldn't be a problem because the excluded swap disk would still be existing and could be reused again by the restored VM.
Previously I had no idea to handle this but with PVE7.1 we got 2 new features that could be useful. First it is now possible to protect backups from pruning and secondly we can now easily move disks between VMs using the webUI.
So my idea was to do a initial backup for all VMs but just with the empty swap disk included (so all root/data disks excluded via the VM config). Then I could set a comment like "swap disk only" and enable pruning protection so it won't get auto deleted. After that I could invert the disk settings so all regular backups will only include the root/data disks but swap/cache disks will be excluded.
If I then for example would want to restore a existing VM (lets say VMID100 with a root disk and a swap disk) I would first restore the normal backup as VMID100. This will replace the root disk with the one of the backup and will delete the swap disk. Then I could restore the "swap only" backup as temporary VMID 999, move that swap disk from VMID 999 VM to VMID 100 VM, attach it to my VMID 100 VM and delete the VMID 999 VM again.
If I'm not wrong this should work as a workaround?
And can someone confirm that it s not problematic to loose the swap data? As far as I know with linux swap is just swapped out RAM and RAM is volatile and would be lost anyway with "snapshot" mode backups. And with "stop" mode backups the RAM (and so the swap) should be empty anyway. So I guess this won't be a problem when the swap disk is replaced with a empty one (but with same UUID) when restoring a snapshot. But how is this with Win10 and its swap file? Same as with linux? There I got a 16GB virtual disk partitioned with NTFS that is setup to be used for a 8GB windows swap file and for stuff like my browser cache.
How do you handle backups and temporary data like swap?