Filesystem Tasks: Formatting, Integrity & Repair 💽¶
Every partition needs a filesystem structure to store files, directories, and permissions. This guide explains how to format drives, choose the right filesystem, run health checks (fsck), repair corruption, and mount filesystems in fparted.
1. Choosing the Right Filesystem¶
Not sure which filesystem to pick? Here is a practical comparison based on real-world use cases:
| Filesystem | Best Used For | Pros | Considerations |
|---|---|---|---|
| ext4 | Linux rootfs, Termux chroots, internal storage, backups | Standard Linux filesystem; rock-solid journaling, POSIX permissions, fast recovery | Windows and macOS cannot read ext4 without third-party drivers. |
| exFAT | MicroSD cards, USB OTG flash drives, camera storage | Cross-platform (Android, Windows, macOS, Linux); supports files $>4\text{ GB}$ | No native POSIX permissions or journaling; sensitive to sudden disconnects. |
| FAT32 | Small USB drives ($<32\text{ GB}$), EFI System Partitions (ESP) | Maximum compatibility with every operating system, car stereo, and game console | Maximum single file size is strictly limited to 4 GiB. |
| F2FS | High-speed internal flash memory, benchmark performance | Specifically engineered for NAND flash pages; fast random I/O write speeds | Shrinking is not supported by filesystem toolchain. |
| NTFS | Windows external backup hard drives, large video storage | Journaled, supported by modern Windows PCs | Linux/Android write drivers run via FUSE or kernel module. |
| Btrfs | Advanced storage setups, subvolumes, snapshots | Copy-on-Write (CoW), checksum integrity protection | Requires modern kernel and careful mount parameter management. |
| Linux Swap | Virtual memory paging space for Android | Lowers RAM pressure on multitasking and Android-x86 | Not a data filesystem; invisible in file managers. |
2. Formatting a Partition¶
Formatting replaces the existing filesystem structure with a clean, initialized volume.
┌────────────────────────────────────────────────────────────────────────┐
│ Format Partition: /dev/block/mmcblk1p1 │
│ │
│ Filesystem: [ ext4 ▼ ] │
│ Volume Label: [ USB_BACKUP ] (Max 16 chars for ext4/FAT) │
│ │
│ Advanced Options: │
│ [x] Force 4096-byte block size (Optimized for flash performance) │
│ [ ] Create LUKS Encrypted container │
│ [ Cancel ] [ Format ]│
└────────────────────────────────────────────────────────────────────────┘
Step-by-Step¶
- Select the partition you want to format in the list or graph.
- Tap Format (or press Ctrl + F).
- Select your desired filesystem from the dropdown.
- Enter an optional Volume Label (e.g.,
FlashDrive,RootFS). - Tap Format to stage the formatting command into the Operations Queue.
[!WARNING] Formatting permanently erases all existing files and directory structures inside that partition. Ensure you have backed up any critical files before clicking Apply.
3. Checking & Repairing Filesystems (fsck)¶
If a USB drive was unplugged without safely ejecting, or your Android device rebooted unexpectedly during heavy writes, the filesystem metadata may be marked as "dirty" or corrupted.
flowchart LR
A["Select Unmounted Partition"] --> B["Tap Check & Repair"]
B --> C{"Choose Mode"}
C -->|"Read-Only Check"| D["Non-destructive inspection (e2fsck -n / fsck.fat -v)"]
C -->|"Automatic Repair"| E["Fix bad superblocks & orphans (e2fsck -fy / fsck.fat -a)"]
How to Run a Check¶
- Ensure the partition is Unmounted (mounted partitions cannot be safely checked).
- Tap Check & Repair (or press Ctrl + K).
- Select your mode:
- Read-Only Check Mode: Inspects directory trees, inode tables, and allocation maps without modifying a single bit on disk. Safe to run anytime.
- Automatic Repair Mode: Automatically resolves orphan inodes, updates superblock transaction journals, and restores corrupted allocation clusters (
-fy/-aflags). - Tap Run Check. The live terminal output from the underlying utility (
e2fsck,fsck.fat,fsck.f2fs,ntfsfix,btrfs check) streams in real-time.
4. Mounting & Unmounting Volumes¶
Mounting attaches a partition's filesystem tree to Android's Virtual File System (VFS) so you can browse its files.
Mounting¶
- Select the partition and tap Mount (or press Ctrl + Shift + M).
fpartedmounts the filesystem to/mnt/runtime/default/<device_name>or your chosen custom mount point.- You can now access the files through root file managers (such as MiXplorer, Solid Explorer) or Termux.
Unmounting¶
- Select the mounted partition.
- Tap Unmount (or press Ctrl + Shift + U).
fpartedflushes all cached dirty pages to flash memory (sync) and cleanly unlinks the VFS mount point.
[!IMPORTANT] Always unmount your drives before physically unplugging USB cables or swapping SD cards to prevent filesystem corruption!