tasket / wyng-backup

Fast backups for logical volumes & disk images
GNU General Public License v3.0
248 stars 16 forks source link

Documentation improvement request #217

Open Eric678 opened 5 days ago

Eric678 commented 5 days ago

New user here, great work - sorely needed for Qubes, a couple of issues: There is no mention of receiving "other" volumes, question: is the path bundled into the archive or does every vol receive require a separate wyng command with --saveto? (Guessing yes, should be documented) How to format the json for this scenario? The other is I feel there should be a paragraph right up front describing the wyng archive storage format uses a huge number of inodes. In my case backup drives are mkfs'd with a relatively small number, has never been a issue. A single 10T offline backup drive's 1.2M inodes are wiped out by a 70GB wyng archive, which is not big, using the default chunk size of 128K. Does bring up another question, does wyng send check that there are enough inodes when it is checking space in advance? If it runs out, does it fail atomically and roll back the whole session? Just the last part vol? Thanks!

tasket commented 5 days ago

Hi @Eric678

The local path is not saved in the archive, its specified with the --local command line parameter which is required for most commands. It acts like an absolute base path (or path prefix) so you can restore multiple volumes at once, much like you can backup multiple vols at once. --local can also be added as a default setting to /etc/wyng/wyng.ini to avoid typing it repeatedly.

The --saveto option is for special cases when you need to restore to a very specific path and/or there is no suitable snapshot-capable storage setup on the local system. Only one vol may be restored at a time with --saveto.

wyng archive storage format uses a huge number of inodes. In my case backup drives are mkfs'd with a relatively small number,

That does seem like a special case but also worth a mention in the docs. FWIW, I've done some testing with Ext4, XFS and Btrfs and the only time it seemed to come near to causing inode exhaustion was when the archive chunk size was set to 64KB and the data was especially compressible (hence very small files) and no deduplication was used (dedup has an effect of conserving inodes, if there is substantial duplication). The two obvious ways out of this is doing mkfs with the default ratio of inodes or creating a new Wyng archive with larger chunk size; a third route is to enhance Wyng with an option that lets you set the maximum archive size.

does wyng send check that there are enough inodes when it is checking space in advance? If it runs out, does it fail atomically and roll back the whole session? Just the last part vol?

No, it doesn't do this. It could conceivably provide a warning when a limit is being approached, or warn anytime an fs doesn't have at least 1 inode per 16KB... but most archive utilities (like tar) which can extract large number of small files don't do this.

If it runs out, does it fail atomically and roll back the whole session? Just the last part vol?

It will fail atomically per volume, meaning you may have some volumes completed for a given session number, while the session doesn't exist for other volumes including the vol being backed up when the error occurred. There will also be (in that one archive volume) some unassociated data that will be deleted the next time Wyng runs.

Eric678 commented 4 days ago

@tasket thank you for a prompt response. You did not really answer the first question, with "other" non LVM volumes the path+filename is specified after :|: as part of the volume name for send. I was asking about receiving those volumes - does --saveto have to be used with each volume, in separate wyng receive commands, or is the vol name sufficient? (the vol name may not be the related to the filename, eg a block device). Yes an offline an backup drive is special, in my case has few big files on it. Yes I have dedup = 1 in wyng.ini. Wyng is rather unusual in that the backup image has the huge number of inodes. Since number of inodes in a filesystem cannot be changed, it won't get fixed here until a new offline backup drive gets rotated in. Needs to be planned for in advance. I need to tar up the wyng archive to put it offline. That process is surprisingly slow.

tasket commented 4 days ago

@Eric678 Oh, I see. When using --import-other-from.

You don't have to use --saveto with those vols. Receive will save them under the local path (i.e. the LVM pool) using the vol's archival name. This can create problems since LVM is very restrictive about volume name characters and length; receiving a vol named "hello/there" having a "/" would require either --saveto (using a non-LVM path, or an LVM path with a volume you created manually) or first renaming the archive vol before receiving.

Wyng is rather unusual in that the backup image has the huge number of inodes

FWIW, this is the first time I recall someone complaining about inode exhaustion even though the sparsebundle-like format has been used in Wyng since 2018. Apple has employed this sparsebundle volume strategy in Time Machine to accelerate backup processes, and that's where I got the idea.

One workaround you could do is to create a disk image on the backup drive (i.e. truncate -s 2000G /mnt/backups/wyngcontainer.img ), then format the img normally and copy the archive into it or create a new archive in it.

Eric678 commented 3 days ago

@tasket thanks, so if you want to actually restore a backup of a block device you have to use --saveto. That should be mentioned in the section on receive. I notice the --saveto option also appears as --save-to in the doco - which is correct, or both? I am wanting to restore the /boot and /boot/efi block devices from a full Qubes dom0 backup as described here: https://github.com/tasket/wyng-util-qubes/issues/4#issuecomment-2436280239