Filesystems
A filesystem (file system) is “how data is written in a partition of the storage device”. OpenWrt being a Linux-based operating system works best with filesystems native to Linux. However, many filesystems are supported, with the caveat that Microsoft/Apple native filesystems may have reduced features or performance due to patents or other ways to impede their adoption.
Installing additional filesystems is commonly used for file sharing with USB 3.0 storage and Samba.
Check available filesystems
To see what filesystems can be read with your current system enter cat /proc/filesystems.
A full list of filesystems available in OpenWrt can be obtained by writing to apk package manager grep kmod-fs.
The tools for the filesystem of your choosing can be found by writing grep FILESYSTEM_NAME.
Linux/OpenWrt filesystems
ext4
ext4 is the default filesystem of most desktop Linux distributions. It is well suited for both HDDs and SSDs (using TRIM), it supports journaling and delayed allocation while being performant and reliable.
Install the ext4 driver and repair tool: kmod-fs-ext4 e2fsprogs
f2fs
f2fs was designed for NAND flash storage (SSDs and USB drives). It is reliable and performant, however the format can be incompatible between kernel versions, requiring some time for “fsck” to upgrade the filesystem.
Install the f2fs driver and repair tool: kmod-fs-f2fs f2fs-tools
btrfs
Btrfs is the default filesystem on several Linux distributions. It has some advanced features built-in such as checksums, snapshots, and compression. It might eventually be the successor to ext4, with the author stating 'there will be no ext5'.
Install the btrfs driver and repair tool: kmod-fs-btrfs btrfs-progs
Windows filesystems
The two most common filesystems used by Windows are NTFS and exFAT. Its older default filesystem FAT32 has been retired but remains available as needed.
NTFS
NTFS is the primary file system used in Windows. Two drivers are available with read/write support in Linux, ntfs-3g, and with kernel 5.15 onward the new in-kernel driver ntfs3. See Writable NTFS for important information on mounting and features. The current recommended driver is ntfs3 but there are pros/cons to both.
Install the NTFS3 driver: kmod-fs-ntfs3
Apple filesystems
In Apple land you have HFS, HFS+ and APFS. There is a driver available for HFS and HFS+ but it has low performance and does not support all features. APFS was introduced in 2017 but there is currently no in-kernel support for it in OpenWrt (nor in Linux).
HFS and HFS+
Install the hfs/hfsplus driver and repair tool: kmod-fs-hfs kmod-fs-hfsplus hfsfsck
Multiplatform filesystems
exFAT
exFAT is commonly used by OEMs for external SSDs and SD cards. It provides good performance while maintaining compatibility across Linux, Windows, and macOS. The Linux driver has become performant enough to max out gigabit LAN at 100-120 MB/s using USB 3.0 external drives on targets with adequate CPU performance, as one user showed on the WRT32X page. Under Windows, exFAT does not support TRIM; but under Linux/OpenWrt, it does.
The main downside of this filesystem is the lack of journaling support, which makes corruption of the file allocation table during sudden power-off likely. If this happens run fsck.exfat for your drive (e.g. fsck.exfat /dev/sda1). Remember to umount or eject your drive first before power removal to avoid this.
Install the exFAT driver and repair tool: kmod-fs-exfat exfat-fsck
FAT32
FAT32 was a common multiplatform file system. It can be read/write by Windows, macOS, Linux, and any other device you might have (smartTV, tablets, car audio with usb, etc). Its has two major drawbacks given its age: it cannot store files larger than 3.9 GB, and it lacks journaling support, meaning it's also prone to corruption if the device is disconnected while writing. This can lead to data loss if the device is written again without running a filesystem check.
The dosfstools package includes the mkfs.fat and fsck.fat utilities, which respectively make and check MS-DOS FAT filesystems.
Install the FAT16/FAT32 driver and repair tool: kmod-fs-vfat dosfstools
Available NLS files
Some filesystems, like FAT32, may need additional Native Language Support (NLS) packages (codepages / charsets) to handle the filenames. If your mount fails, look in dmesg - a message like
FAT: codepage cp437 not found
means that you need NLS codepage 437, and a message like
FAT: IO charset iso8859-1 not found
means that you need NLS ISO 8859-1.
Available NLS packages can be listed by writing list “kmod-nls*”. There will be many available, below are a few examples.
| Name | Description |
|---|---|
| kmod-nls-cp1250 | Kernel module for NLS Codepage 1250 (Eastern Europe) |
| kmod-nls-cp1251 | Kernel module for NLS Codepage 1251 (Russian) |
| kmod-nls-cp437 | Kernel module for NLS Codepage 437 (United States, Canada) |
| kmod-nls-cp775 | Kernel module for NLS Codepage 775 (Baltic Rim) |
| kmod-nls-cp850 | Kernel module for NLS Codepage 850 (Europe) |
| kmod-nls-cp866 | Kernel module for NLS Codepage 866 (Cyrillic) |
| kmod-nls-iso8859-1 | Kernel module for NLS ISO 8859-1 (Latin 1) |
| kmod-nls-koi8r | Kernel module for NLS KOI8-R (Russian) |
| kmod-nls-utf8 | Kernel module for NLS UTF-8 |
Partitions
A partition is a way to split the storage space in more different sections, each using its own independent filesystem. This can be useful to separate different types of data, for example to keep your expanded firmware separate from the data you want to store and share, or data that must be easily accessible from Windows or macOS directly if you disconnect the external drive.
Discussing advanced partitioning is beyond the scope of this article, as OpenWrt uses the same CLI tools used by any other Linux system.
- fdisk tool is used to create/modify partitions on a drive initialized with MBR scheme; it also supports GPT.
- gdisk tool is used to create/modify partitions on a drive initialized with GPT scheme.