0

My smartphone is booted to the TWRP recovery and I'm running the ADB Shell as root on Windows.

I have fully unmounted /data with the following command:

umount /dev/block/mmcblk0p36

Then checked it's size:

fsck.f2fs /dev/block/mmcblk0p36

Result:

Info: sector size = 512
Info: total sectors = 11 583 232 (in 512 bytes)


Now, how can I delete this volume (aka filesystem), and re-create it with a specified size, i.e. 11 583 168 blocks?
I don't care about the contents of this volume, it's already safe on my computer.

It'd be preferable if it could be done with native Android (Cyanogen v13) binaries, but if the only option is to download and push 3rd-party binaries, so be it.


This is related to my other question How to resize the /data F2FS partition on Android.SE.

1

There is mkfs.f2fs, part of f2fs-tools (just like fsck.f2fs).

Usage: mkfs.f2fs [options] device [sectors]
[options]:
  -a heap-based allocation [default:1]
  -d debug level [default:0]
  -e [extension list] e.g. "mp3,gif,mov"
  -l label
  -o overprovision ratio [default:5]
  -s # of segments per section [default:1]
  -z # of sections per zone [default:1]
  -t 0: nodiscard, 1: discard [default:1]
  -r reserved_bytes [default:0]
    (use only device_size-reserved_bytes for filesystem)
  sectors: number of sectors. [default: determined by device size]

(Emphasis mine)

To create a new F2FS filesystem on device mmcblk0p36 with 11583168 sectors total...

mkfs.f2fs /dev/block/mmcblk0p36 11583168

Do note, however, that invoking fsck.f2fs will still report 11583232 sectors, which is the size of the device, not the filesystem. mkfs.f2fs refers to this as total device sectors (and simply total sectors for the filesystem).


Thanks to Izzy @ Android Enthusiasts SE for pointing out my confusion on partitions/filesystems and also suggesting the mkfs.f2fs command.

  • Has anyone come across clear definitions of what the parameters do, and importantly how they affect performance and compatibility of the FS – TonyH Dec 13 '18 at 20:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.