Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revisionBoth sides next revision
docs:guide-user:storage:filesystems-and-partitions [2021/07/29 12:54] – [Apple filesystems] palebloodskydocs:guide-user:storage:filesystems-and-partitions [2024/09/04 08:37] – [btrfs] artoria2e5
Line 1: Line 1:
 ====== Filesystems ====== ====== Filesystems ======
-This page contains advanced information about filesystems (file systems) and partitions.+This page contains basic 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.\\
  
-A filesystem is "how data is written in a partition of the storage device".\\  +OpenWrt is a Linux-based operating system and thus typically works best with filesystems native to LinuxHowever it can also read/write data with many filesystems, albeit sometimes slower or less reliable than with native Linux filesystems. In case you wonder, the reason for this reduced performance is patents and other ways to impede the adoption of Microsoft or Apple filesystems by other parties.\\
-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.+
  
-===== Currently supported filesystems ===== +Installing these additional filesystems in OpenWrt is commonly for file sharing using [[:docs:guide-user:storage:usb-drives-quickstart|USB 3.0 storage]] and [[:docs:guide-user:services:nas:cifs.server|Samba]].  
-To see what filesystems can be read by the firmware currently installedwrite ''cat /proc/filesystems''.\\  + 
-This is an example output from a OpenWrt x86 Virtual Machine, it can read many filesystems as space is not an issue for this target. +==== Check available filesystems ==== 
-For most devices, you will have to choose what filesystems you need to be able to access, and install the package with the filesystem driver for it. +To see what filesystems can be read currently, enter ''cat /proc/filesystems''.\\  
-<code>nodev   sysfs + 
-nodev   rootfs +A full list of filesystems available in OpenWrt can be obtained by writing\\  
-nodev   ramfs +''opkg update && opkg list | grep kmod-fs'' 
-nodev   bdev + 
-nodev   proc +The tools for the filesystem of your choosing can be found by writing\\ 
-nodev   tmpfs +''opkg list | grep FILESYSTEM_NAME'' 
-nodev   binfmt_misc + 
-nodev   debugfs +OpenWrt has drivers and filesystem tools available for ext2/3/4, f2fs, btrfs, and many other filesystems supported by Linux.
-nodev   sockfs +
-nodev   bpf +
-nodev   pipefs +
-nodev   devpts +
-        ext3 +
-        ext2 +
-        ext4 +
-        squashfs +
-nodev   overlay +
-        btrfs +
-        f2fs +
-        xfs +
-        vfat</code>+
  
 ===== OpenWrt/Linux filesystems ===== ===== OpenWrt/Linux filesystems =====
-There are 2 main filesystems you are going to be interested in, [[wp>ext4]] and [[wp>f2fs]].\\  +The two most common Linux filesystems are [[wp>ext4]] and [[wp>f2fs]], with [[wp>btrfs]] growing in popularity:\\  
-In short:\\ + 
-  * ext4 is best suited for hard drives +  * ext4 is well suited for HDDs and SSDs (using TRIM) and is the default filesystem of most desktop Linux distributions. 
-  * f2fs is best suited for flash drives (SSDs and usb thumbdrives)+  * f2fs is well suited for flash (SSDs or USB thumbdrives). The format can be incompatible between kernel versions, requiring some time for "fsck" to upgrade the filesystem. 
 +  * btrfs is the default filesystem for more cutting-edge Linux distributions. It is considered the sucessor to ext4, with the author stating "there will be no ext5". It has some more advanced features such as checksumming. 
 + 
 +==== ext4 ====
  
-==== Set up ext4 ==== 
 This command will download the tools needed to create and fix ext4 (and older versions)\\ This command will download the tools needed to create and fix ext4 (and older versions)\\
 ''opkg install e2fsprogs'' ''opkg install e2fsprogs''
Line 46: Line 32:
 ''opkg install kmod-fs-ext4'' ''opkg install kmod-fs-ext4''
  
-==== Set up f2fs ====+==== f2fs ====
 This command will download the tools needed to create and fix f2fs\\ This command will download the tools needed to create and fix f2fs\\
 ''opkg install f2fs-tools'' ''opkg install f2fs-tools''
Line 53: Line 39:
 ''opkg install kmod-fs-f2fs'' ''opkg install kmod-fs-f2fs''
  
-===== Other filesystems ===== +==== btrfs ==== 
-A full list of filesystems available in OpenWrt can be obtained by writing\\  +This command will download the tools needed to create and fix btrfs\\ 
-''opkg update && opkg list | grep kmod-fs''+''opkg install btrfs-progs''
  
-The tools for the filesystem of your choosing can be found by writing\\ +If in the list of supported filesystems in your device you don't see btrfs, you must install also the driver itself\\ 
-''opkg list | grep FILESYSTEM_NAME''+''opkg install kmod-fs-btrfs'' 
 + 
 +===== Windows filesystems ===== 
 + 
 +The two most common filesystems used by Windows are [[wp>NTFS]] and [[wp>exFAT]] as described below. 
 + 
 +==== NTFS ==== 
 + 
 +NTFS is the primary Windows filesystem and is available via the ''NTFS-3G'' driver. With kernel 5.15 onward the new [[https://www.phoronix.com/news/NTFS3-For-Linux-5.15|NTFS3 driver]] called ''NTFS3'' aims to provide improved performance as an in-kernel driver similar to other Linux filesystems. Either driver may be used in OpenWrt, however below is written for the legacy driver.\\ 
 + 
 +Download and install via the NTFS-3G driver\\ 
 +''opkg install ntfs-3g'' 
 + 
 +This command will download the tools needed to create and fix NTFS\\  
 +''opkg install ntfsprogs_ntfs-3g'' 
 + 
 +See [[docs:guide-user:storage:writable_ntfs|Writable NTFS]] for important information on mounting options for better performance and features. TRIM is supported under Linux/OpenWRT. 
 + 
 +===== Apple filesystems ===== 
 +In Apple land you have [[wp>HFS]], [[wp>HFS+]] and [[wp>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 support for it in OpenWrt (nor in Linux). 
 + 
 +==== HFS and HFS+ ==== 
 +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''
  
-OpenWrt has drivers and filesystem tools available for ext2/3/4, f2fs, xfs and btrfs, and most other filesystems supported by Linux. 
  
 ===== Multiplatform filesystems ===== ===== Multiplatform filesystems =====
-[[wp>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. +==== FAT32 ==== 
-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. +[[wp>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. 
-These days there are better filesystems that work well with multiple operating systems described below. + 
-==== Set up FAT32 ==== +This command will download the tools needed to create and fix FAT32 (and older versions)\\ 
-this command will download the tools needed to create and fix FAT32 (and older versions)\\ +''opkg install dosfstools'' (The dosfstools package includes the [[https://linux.die.net/man/8/mkfs.vfat|mkfs.fat]] and [[https://linux.die.net/man/8/fsck.vfat|fsck.fat]] utilities, which respectively make and check MS-DOS FAT filesystems.)
-''opkg install dosfstools'' (The dosfstools package includes the [[https://linux.die.net/man/8/mkfs.vfat|mkfs.fat]] and [[https://linux.die.net/man/8/fsck.vfat|fsck.fat]] utilities, which respectively make and check MS-DOS FAT filesystems. Also stated above.)+
  
 If in the list of supported filesystems in your device you don't see **vfat**, you must install also the driver itself\\ 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'' ''opkg install kmod-fs-vfat''
  
-==== Available NLS files ====+=== Available NLS files ===
  
-For some filesystems, like for FAT32, you need to additionally install language packages (codepages / charsets) to handle the filenames.  If your mount fails, look in dmesg - a message like\\+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''\\ ''FAT: codepage cp437 not found''\\
 means that you need NLS codepage 437, and a message like\\ means that you need NLS codepage 437, and a message like\\
Line 82: Line 92:
 means that you need NLS ISO 8859-1. means that you need NLS ISO 8859-1.
  
-Available NLS files and their packages can be listed by writing ''opkg updateopkg list "kmod-nls*"''.+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  ^ ^ Name                ^ Description  ^
Line 90: Line 100:
 | kmod-nls-cp775      | Kernel module for NLS Codepage 775 (Baltic Rim)            | | kmod-nls-cp775      | Kernel module for NLS Codepage 775 (Baltic Rim)            |
 | kmod-nls-cp850      | Kernel module for NLS Codepage 850 (Europe)                | | kmod-nls-cp850      | Kernel module for NLS Codepage 850 (Europe)                |
-| kmod-nls-cp852      | Kernel module for NLS Codepage 852 (Europe)                | 
 | kmod-nls-cp866      | Kernel module for NLS Codepage 866 (Cyrillic)              | | 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-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-iso8859-15 | Kernel module for NLS ISO 8859-15 (Latin 9)                | 
-| kmod-nls-iso8859-2  | Kernel module for NLS ISO 8859-2 (Latin 2)                 | 
 | kmod-nls-koi8r      | Kernel module for NLS KOI8-R (Russian)                     | | kmod-nls-koi8r      | Kernel module for NLS KOI8-R (Russian)                     |
 | kmod-nls-utf8       | Kernel module for NLS UTF-8                                | | kmod-nls-utf8       | Kernel module for NLS UTF-8                                |
  
-===== Windows filesystems ===== +==== exFAT ====
-The primary filesystem used on Windows is [[wp>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 [[wp>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. +
-[[https://www.phoronix.com/scan.php?page=news_item&px=Linux-5.4-Released|Source: Linux kernel 5.4 with exFAT]] +
-==== Set up NTFS ==== +
-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 [[docs:guide-user:storage:writable_ntfs|Writable NTFS]] for important information on mounting options for better performance and features. +
-==== Set up exFAT ==== +
-This command will download the driver to read exfat filesystems, there are no tools available to format and check exfat in OpenWrt (as of 2017).\\ +
-''opkg install kmod-fs-exfat''+
  
-''opkg install libblkid''+exFAT is commonly used by OEMs for external SSDs and SD cards. The downside to this filesystem is the lack of journaling support, which makes breakage during sudden poweroff more likely. exFAT will provide good performance while maintaining compatibility with Windows and macOS.
  
-===== Apple filesystems ===== +As of Linux kernel 5.4 there is a [[https://www.phoronix.com/scan.php?page=news_item&px=Linux-5.4-Released|new exFAT driver]] this is available with low overheadThis new driver is quite performant and will max out gigabit LAN at 120 MB/s using USB 3.0 external drives on some targetsas tested on the [[:toh:linksys:wrt_ac_series]]. 
-In Apple land you have [[wp>HFS]], [[wp>HFS+]] and [[wp>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). +
- +
-==== Set up HFS and HFS+ ==== +
-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''+
  
 +This will install the driver to use exFAT and the tool to be able to run check disk if needed:\\
 +''opkg install kmod-fs-exfat exfat-fsck''
  
 +Under Windows, exFAT does not support TRIM; but under Linux/OpenWRT, it does.
  
-======Partitions =====+===== Partitions =====
  
-A partition is a way to split the storage space in more different sections, each using its own independent filesystem.+[[wp>Disk_partitioning|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.+This can be useful to separate different types of data, for example to keep your expanded firmware separate 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. Discussing advanced partitioning is beyond the scope of this article, as OpenWrt uses the same commandline tools used by any other Linux system.
  • Last modified: 2024/10/31 23:23
  • by palebloodsky