Filesystems

This page contains advanced information about filesystems (file systems) and partitions.

A filesystem is “how data is written in a partition of the storage device”.
Windows, macOS, and Linux use different default filesystems, and not all filesystems work equally well across operating systems.
OpenWrt is a Linux-based operating system. It can read and write data from Windows and macOS filesystems, however it can be slower, more limited and less reliable than data from native Linux filesystems. So if you want to transfer data it may be good enough, but for a storage device permanently attached to your OpenWrt device, using a native Linux filesystem is recommended.
In case you wonder, the reason for this lack of performance/reliability is patents, trade secrets and other ways to impede the adoption of Windows or Apple filesystems by other parties.

To see what filesystems can be read currently, enter cat /proc/filesystems.
Below is an example output from an OpenWrt clean install for the mvebu target. Kernel modules can be installed for additional filesystems as needed (e.g. exFAT or NTFS for USB 3.0 drives) as described further down this page.

nodev   sysfs
nodev   tmpfs
nodev   bdev
nodev   proc
nodev   cgroup
nodev   cgroup2
nodev   cpuset
nodev   debugfs
nodev   sockfs
nodev   bpf
nodev   pipefs
nodev   ramfs
nodev   devpts
        ext3
        ext2
        ext4
        squashfs
nodev   jffs2
nodev   overlay
        f2fs
nodev   mqueue
nodev   ubifs

There are 2 main native Linux filesystems you are going to be interested in, ext4 and f2fs.
In short:

  • ext4 is best suited for hard drives
  • f2fs is best suited for flash drives (SSDs and usb thumbdrives)

This command will download the tools needed to create and fix ext4 (and older versions)
opkg install e2fsprogs

If in the list of supported filesystems in your device you don't see ext4, you must install also the driver itself
opkg install kmod-fs-ext4

This command will download the tools needed to create and fix f2fs
opkg install f2fs-tools

If in the list of supported filesystems in your device you don't see f2fs, you must install also the driver itself
opkg install kmod-fs-f2fs

A full list of filesystems available in OpenWrt can be obtained by writing
opkg update && opkg list | grep kmod-fs

The tools for the filesystem of your choosing can be found by writing
opkg list | grep FILESYSTEM_NAME

OpenWrt has drivers and filesystem tools available for ext2/3/4, f2fs, xfs and btrfs, and most other filesystems supported by Linux.

FAT32 is a common multiplatform file system. It will be read/write by Windows, macOS, Linux, and any other device you might have (smartTV, tablets, car sound systems with usb port…). Its main drawback (for a data drive) is that it cannot store a file bigger than 3.9 GiB even if the drive itself is bigger than that. Its lack of journaling support means it's also prone to corruption if the device is disconnected while still writing, which can lead to data loss if the device is written again without running a filesystem check. These days there are better filesystems that work well with multiple operating systems described below.

This command will download the tools needed to create and fix FAT32 (and older versions)
opkg install dosfstools (The dosfstools package includes the mkfs.fat and fsck.fat utilities, which respectively make and check MS-DOS FAT filesystems.)

If in the list of supported filesystems in your device you don't see vfat, you must install also the driver itself
opkg install kmod-fs-vfat

For some filesystems, like FAT32, 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 opkg update && opkg 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-iso8859-13 Kernel module for NLS ISO 8859-13 (Latin 7; Baltic)
kmod-nls-koi8r Kernel module for NLS KOI8-R (Russian)
kmod-nls-utf8 Kernel module for NLS UTF-8

The primary filesystem used on Windows is NTFS, on OpenWrt (Linux) it is available but its CPU overhead is higher. For better read/write performance you will want to install and setup the NTFS-3G driver which is described in the NTFS linked in a section below.
Another filesystem that commonly placed by OEMs on newer external SSDs and SD cards with capacity over 32 GiB is exFAT. This is available and often has better performance than NTFS-3G on OpenWrt, also as of Linux kernel 5.4, a native driver is now available for improved performance. Source: Linux kernel 5.4 with exFAT

This command will download the tools needed to create and fix NTFS
opkg install ntfsprogs_ntfs-3g

If in the list of supported filesystems in your device you don't see ntfs, you must install also the driver itself
opkg install ntfs-3g

See Writable NTFS for important information on mounting options for better performance and features.

This command will download the driver to read exfat filesystems, there are currently no tools in OpenWrt to format/check exFAT.
opkg install kmod-fs-exfat

opkg install libblkid1

exFAT will provide good performance OpenWrt with kernel 5.4 while maintaining compatability with Windows and macOS. The downside to this filesystem is the lack of journaling support. Performance will max out gigabit LAN at 120 MB/s with USB 3.0 external drives as tested on the wrt_ac_series targets.

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 is new as of 2017 and there is currently no support for it in OpenWrt (nor in Linux).

This command will download the tools needed to create and fix HFS and HFS+
opkg install hfsfsck

If in the list of supported filesystems in your device you don't see hfs and hfsplus, you must install also the drivers
opkg install kmod-fs-hfs kmod-fs-hfsplus

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, like for example to keep your expanded firmware system separated from the actual 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 commandline tools used by any other Linux system.

fdisk tool is used to create/modify partitions on a drive initialized with MBR scheme
gdisk tool is used to create/modify partitions on a drive initialized with GPT scheme

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
  • Last modified: 2021/07/29 22:39
  • by palebloodsky