Make the drive migration safe against lost data and interrupted runs #3
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "migration-safety"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Four defects of the drive migration, each of which could lose data or leave a drive that the tool could no longer finish. Three commits.
List what lies next to a library in the same folder
A top-level folder that contains a Steam library was skipped as a whole, and so was the library's own folder. With a library in
Games/SteamLibrary,Games/Heroicnext to it was neither offered for backup nor listed as unprotected, and the re-download method formatted it away without a warning. The same held for theuserdataof a whole Steam installation and for folders insteamappsthat Steam does not restore, such assourcemods. Such folders are now entered, and what is not part of the library becomes an item of its own.Delete only the backup, not the folder it is in
ogc migrate plan --backup-dir /mnt/backupstored the folder as given, anddelete-backupthen removed the whole folder with everything else in it. The command line now gives the backup a folder of its own (opengamecompressor-backup/<drive id>), as the desktop app already did. Deleting removes only what the backup wrote, so plans written by earlier versions are safe too.Check fstab before the drive is touched, and resume after it was
Two halves of one problem in the privileged helper:
/etc/fstabwas validated only after the drive had been converted or formatted. An entry byLABEL=,PARTUUID=or a/dev/disk/by-*path made the helper fail at that point, with a btrfs drive and an fstab that still described the old filesystem.What changes:
/var/lib/opengamecompressor/migrate/, where only root can write, including the UUID the new filesystem gets (chosen beforehand). A later run that finds the drive changed goes on only with such a record, and then acts on the record instead of on its arguments.ogc migrate abort --forceis the way out.Behaviour users can notice
LABEL=entries in fstab becomeUUID=.nosuid,nodev./etc/fstab, stops the migration until that is fixed./var/lib/opengamecompressor/migrate/.Accepted limits are listed in
docs/ROADMAP.md: a short window in which fstab still describes the old filesystem, an empty drive without any ID after a reboot, and migrations that version 0.1.0 left interrupted after formatting NTFS or FAT.Testing
cargo fmt --check, clippy with-D warnings(with and without the GUI),cargo test --locked: green. 97 library tests, 4 image tests with the realmkfs,wipefsandbtrfs-convert.scripts/vm-e2e.sh: all four scenarios pass, including the two new ones.labelhas fstab name the drive byLABEL=and checks that a duplicate entry and an unmounted drive are refused before anything is touched.resumeinterrupts a re-download from FAT32 after the wipe, after the format and after the helper finished, and checks that nothing is formatted twice.The VM test is not part of CI, so CI does not exercise the helper as root.