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:
REQUIRED_COMMANDS_F2FS should be changed to f2fslabel instead of f2fstat
the if/else in the mkfs.f2fs section can be reduced to cmd="mkfs.f2fs -f" like it is for the other FSs
the workaround in the labeling section can be reduced to f2fs) cmd="f2fslabel"
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:
f2fslabel
instead off2fstat
cmd="mkfs.f2fs -f"
like it is for the other FSsf2fs) cmd="f2fslabel"