framps / raspiBackup

Create and keep multiple backup versions of your running Raspberries
https://raspibackup.linux-tips-and-tricks.de
GNU General Public License v3.0
826 stars 75 forks source link

Enhance f2fs support #725

Closed kosi2801 closed 10 months ago

kosi2801 commented 10 months ago

This PR fixes basic backup and restore of f2fs partitions.

The functionality was tested with f2fs-tools version 1.14. Version 1.15 would allow for labeling similar to extX as it would provide a new 'f2fslabel' command, but many Raspberry Pi OSs currently are not yet on the required version (ie. Debian Bookworm).

So setting the label is done in the mkfs.f2fs stage and the labeling stage contains a workaround to not fail at an assertion there.

Basic backup and restore work on my side, booting should also work as long as the f2fs was created with default options. If manual options were used (eg. ext_attr) then the restore succeeds, but the image may not be bootable without manual intervention by fixing the /boot/cmdline.txt or /etc/fstab options. (See https://wiki.archlinux.org/title/F2FS#Remounting_impossible_with_some_options for details on how to perform those changes manually.) But at least the file data itself becomes available again through the restore.

In case later the requirements on the f2fs-tools are raised to >=1.15 then following places can be simplified:

framps commented 10 months ago

Thank you very much for the PR :+1: There are some minor changes I'd like to have :wink: