On Fri, 2022-09-30 at 12:39 +0200, Roberto A. Foglietta wrote:
>
> as you can see my approach is straight simple: if extending the ext4
> fails because it does not match the filesystem type then try with
> btrfs tool. Obviously, the btrfs tool is added as dependencies among
> others before defined.
First: resize2fs does not only support ext4. It supports all of the ext
variants (ext2-ext4) to my understanding.
The man resize2fs said so: ext2/3/4.
Due to the implementation of ext4 and ext2 with the backcompatibility of some features, the resize supported in ext4 is also supported in ext2 because it is a basic feature. Viceversa, a tool that resize ext2 will fail to resize ext4 much probably because the journal.
Second: There might be more reasons why resize2fs could fail. IMHO, it
doesn't make sense to run a btrfs tool on a ext filesystem that failed
to expand.
It is not elegant but it does not hurt to run btrfs on ext4 or resize2fs on btrfs.
Yes, I am a raw penguin! LOL
Third: The mount point (/tmp/btrfs) is never cleaned up in the Robertos
patch.
I do umount but NOT rmdir because if for some reason umount fails (expecially in combination with a bug that do not let the error code be returned, I saw in busybox) I am going to remove the filesystem content. Moreover, polluting the /tmp is usually not an issue.
Thanks for your feedbacks, R.