Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Device size is not sufficient" when resizing f2fs partition #109

Open
chrisirwin opened this issue May 2, 2021 · 9 comments
Open

"Device size is not sufficient" when resizing f2fs partition #109

chrisirwin opened this issue May 2, 2021 · 9 comments

Comments

@chrisirwin
Copy link
Contributor

Flashed Release 9 onto a 32GB SD card. System boots and is functional, though as noted in the release notes, the partition is not automatically resized.

However, while I am able to successfully resize the partition using parted, I'm unable to resize the filesystem itself:

$ sudo resize.f2fs /dev/mmcblk0p2 
Info: Segments per section = 1
Info: Sections per zone = 1
Info: sector size = 512
Info: total sectors = 61809664 (30180 MB)
Info: MKFS version
  "Linux version 5.11.0-0.rc4.129.fc34.x86_64 ([email protected]) (gcc (GCC) 11.0.0 20210116 (Red Hat 11.0.0-0), GNU ld version 2.35.1-21.fc34) #1 SMP Mon Jan 18 07:07:56 UTC 2021"
Info: FSCK version
  from "Linux version 5.11.0-0.rc4.129.fc34.x86_64 ([email protected]) (gcc (GCC) 11.0.0 20210116 (Red Hat 11.0.0-0), GNU ld version 2.35.1-21.fc34) #1 SMP Mon Jan 18 07:07:56 UTC 2021"
    to "Linux version 5.11.16-300.fc34.x86_64 ([email protected]) (gcc (GCC) 11.0.1 20210324 (Red Hat 11.0.1-0), GNU ld version 2.35.1-41.fc34) #1 SMP Wed Apr 21 13:18:33 UTC 2021"
Info: superblock features = 0 : 
Info: superblock encrypt level = 0, salt = 00000000000000000000000000000000
Info: total FS sectors = 8486912 (4144 MB)
Info: CKPT version = 4cb3f394
	Error: Device size is not sufficient for F2FS volume, more segment needed =5023

To eliminate the SD Card itself as a problem, I flashed the image to the Internal 32GB eMMC of my Pinephone Beta using jumpdrive over usb, but encountered the same issue as above (but with different device names)

To eliminate my computer's tools (Fedora 34), I booted this fedora image via SD and attempted to resize the internal emmc filesystem, encountering the same issue.

Noting that both SD and EMMC are 32GB, I attempted with various partition sizes via parted, instead of setting the end to 100%, I attempted 90% and 80% as well. Both failed, but with a higher "More segment needed" as the partition was made smaller.

It looks like resize.f2fs might be favouring large filesystems, either by design or by some settings at filesystem create time. There does not seem to be a tune.f2fs to attempt changing any settings, and I've well exhausted my f2fs knowledge.

My current assumption is that using a >32 GB SD card would probably resize correctly, but would like some confirmation before I order one.

@Be-ing
Copy link

Be-ing commented May 4, 2021

I ran into the same problem with release 9. I tried using GParted after flashing again and it failed the same way. When I tried to dnf update, there was insufficient space available on the root filesystem.

@Be-ing
Copy link

Be-ing commented May 4, 2021

I can reproduce this with releases 7 and 8 as well.

@Be-ing
Copy link

Be-ing commented May 4, 2021

Well this is interesting. Flashing release 9 to my 128 GB microSD card and enlarging the partition & filesystem in GParted worked. When I mount that partition, df -h says it has 42 GB used, but du -h says it only has 2.8 GB used... 😕

@Be-ing
Copy link

Be-ing commented May 5, 2021

After researching different filesystems and discussion on Matrix, I think the best solution for this would be to switch to btrfs for the root filesystem. f2fs is a mess due to incompatibilities between filesystems manipulated by different kernel versions:
https://bugs.archlinux.org/task/69363
https://bugzilla.opensuse.org/show_bug.cgi?id=1109665#c0
https://www.reddit.com/r/openSUSE/comments/enlu5b/speaking_of_lack_of_f2fs_support_by_tumbleweed/fe20niv/

@Funky185540
Copy link

Funky185540 commented May 13, 2021

Found a fix for it!

My best guess is that the f2fs-tools on F34 and newer are somehow incompatible to these F2FS filesystems. On F33 resizing works as expected. Here's how you do the resize from a F33 container running any Fedora host that has podman installed:

sudo podman run --rm --device="/dev/<F2FS PARTITION>:/dev/f2fspart:rwm" --entrypoint '["/bin/bash", "-c"]' fedora:33 "dnf -y install f2fs-tools && resize.f2fs /dev/f2fspart"

Make sure you replace <F2FS PARTITION> with whatever block device your root partition is located on!

Edit 2021.05.18: Fixed the entrypoint to make it an actual oneliner...

@Be-ing
Copy link

Be-ing commented May 14, 2021

Thanks for sharing that workaround. IMO that confirms that F2FS is a bad filesystem to use unless maybe you're an Android device manufacturer that intends to never update the kernel. It would be better to switch these scripts to btrfs.

@Funky185540
Copy link

I dunno... eMMC doesn't have integrated wear-leveling electronics, so it's a good idea if the FS is flash aware to the point where it does wear leveling on its own. Does BTRFS do something like that? I'm not sure, haven't found anything yet...

@chrisirwin
Copy link
Contributor Author

I believe btrfs should be fairly flash friendly, as a COW filesystem.

@returnofthelambda
Copy link

Downgrading f2fs-tools from 1.14.0-2 to 1.14.0-1 worked for me, as suggested here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants