Difference between revisions of "File systems"

From ArchWiki
Jump to navigation Jump to search
m (→‎Mount a filesystem: rename for consistency with all other sections)
m (update link)
 
(76 intermediate revisions by 22 users not shown)
Line 1: Line 1:
 
[[Category:File systems]]
 
[[Category:File systems]]
 +
[[Category:Lists]]
 
[[es:File systems]]
 
[[es:File systems]]
 
[[hu:File systems]]
 
[[hu:File systems]]
Line 5: Line 6:
 
[[ja:ファイルシステム]]
 
[[ja:ファイルシステム]]
 
[[pl:File systems]]
 
[[pl:File systems]]
 +
[[pt:File systems]]
 
[[ru:File systems]]
 
[[ru:File systems]]
 +
[[tr:File systems]]
 
[[zh-hans:File systems]]
 
[[zh-hans:File systems]]
 
{{Related articles start}}
 
{{Related articles start}}
{{Related|Core utilities#lsblk}}
+
{{Related|Partitioning}}
 +
{{Related|Device file#lsblk}}
 
{{Related|File permissions and attributes}}
 
{{Related|File permissions and attributes}}
 
{{Related|fsck}}
 
{{Related|fsck}}
 
{{Related|fstab}}
 
{{Related|fstab}}
{{Related|List of applications/Internet#Distributed file systems}}
 
 
{{Related|List of applications#Mount tools}}
 
{{Related|List of applications#Mount tools}}
{{Related|Optical disc drive}}
+
{{Related|QEMU#Mounting a partition from a raw image}}
{{Related|Partitioning}}
 
{{Related|NFS}}
 
{{Related|NTFS-3G}}
 
{{Related|FAT}}
 
{{Related|QEMU#Mounting a partition inside a raw disk image}}
 
{{Related|Samba}}
 
{{Related|tmpfs}}
 
 
{{Related|udev}}
 
{{Related|udev}}
 
{{Related|udisks}}
 
{{Related|udisks}}
 
{{Related|umask}}
 
{{Related|umask}}
 
{{Related|USB storage devices}}
 
{{Related|USB storage devices}}
 
 
{{Related articles end}}
 
{{Related articles end}}
 
 
From [[Wikipedia:File system|Wikipedia]]:
 
From [[Wikipedia:File system|Wikipedia]]:
:In computing, a file system (or filesystem) is used to control how data is stored and retrieved. Without a file system, information placed in a storage medium would be one large body of data with no way to tell where one piece of information stops and the next begins. By separating the data into pieces and giving each piece a name, the information is easily isolated and identified.
+
:In computing, a file system or filesystem controls how data is stored and retrieved. Without a file system, information placed in a storage medium would be one large body of data with no way to tell where one piece of information stops and the next begins. By separating the data into pieces and giving each piece a name, the information is easily isolated and identified. Taking its name from the way paper-based information systems are named, each group of data is called a "file". The structure and logic rules used to manage the groups of information and their names is called a "file system".  
:Taking its name from the way paper-based information systems are named, each group of data is called a "file". The structure and logic rules used to manage the groups of information and their names is called a "file system".
 
  
 
Individual drive partitions can be setup using one of the many different available filesystems. Each has its own advantages, disadvantages, and unique idiosyncrasies. A brief overview of supported filesystems follows; the links are to Wikipedia pages that provide much more information.
 
Individual drive partitions can be setup using one of the many different available filesystems. Each has its own advantages, disadvantages, and unique idiosyncrasies. A brief overview of supported filesystems follows; the links are to Wikipedia pages that provide much more information.
Line 37: Line 30:
 
== Types of file systems ==
 
== Types of file systems ==
  
See {{man|5|filesystems}} for a general overview, and [[Wikipedia:Comparison of file systems]] for a detailed feature comparison. File systems supported by the kernel are listed in {{ic|/proc/filesystems}}.
+
{{Accuracy|{{ic|/proc/filesystems}} only lists file systems whose modules are either built-in or currently loaded. Since [[Kernel#Officially supported kernels|Arch kernels]] have most of the file systems built as loadable modules, {{ic|/proc/filesystems}} will show very few, if any, usable file systems.}}
 +
 
 +
See {{man|5|filesystems}} for a general overview and [[Wikipedia:Comparison of file systems]] for a detailed feature comparison. File systems supported by the kernel are listed in {{ic|/proc/filesystems}}.
  
 
{| class="wikitable sortable"
 
{| class="wikitable sortable"
 +
|+ In-tree and FUSE file systems
 
! File system
 
! File system
 
! Creation command
 
! Creation command
 
! Userspace utilities
 
! Userspace utilities
! [[Archiso]] [https://git.archlinux.org/archiso.git/tree/configs/releng/packages.both]
+
! [[Archiso]] [https://git.archlinux.org/archiso.git/tree/configs/releng/packages.x86_64]
 
! Kernel documentation [https://www.kernel.org/doc/Documentation/filesystems/]
 
! Kernel documentation [https://www.kernel.org/doc/Documentation/filesystems/]
 
! Notes
 
! Notes
Line 55: Line 51:
 
|-
 
|-
 
| [[VFAT]]
 
| [[VFAT]]
| {{man|8|mkfs.vfat|url=https://linux.die.net/man/8/mkfs.vfat}}
+
| {{man|8|mkfs.fat}}
 
| {{Pkg|dosfstools}}
 
| {{Pkg|dosfstools}}
 
| {{Yes}}
 
| {{Yes}}
Line 61: Line 57:
 
|
 
|
 
|-
 
|-
| [[w:exFAT|exFAT]]
+
| [[Wikipedia:exFAT|exFAT]]
| {{man|8|mkfs.exfat|url=}}
+
| {{man|8|mkexfatfs|}}
 
| {{Pkg|exfat-utils}}
 
| {{Pkg|exfat-utils}}
| {{Y|Optional}}
+
| {{Yes}}
 
| N/A (FUSE-based)
 
| N/A (FUSE-based)
 
|
 
|
 
|-
 
|-
 
| [[F2FS]]
 
| [[F2FS]]
| {{man|8|mkfs.f2fs|url=}}
+
| {{man|8|mkfs.f2fs}}
 
| {{Pkg|f2fs-tools}}
 
| {{Pkg|f2fs-tools}}
 
| {{Yes}}
 
| {{Yes}}
Line 79: Line 75:
 
| {{man|8|mke2fs}}
 
| {{man|8|mke2fs}}
 
| {{Pkg|e2fsprogs}}
 
| {{Pkg|e2fsprogs}}
| {{Yes}} ({{Grp|base}})
+
| {{Yes}}
 
| [https://www.kernel.org/doc/Documentation/filesystems/ext3.txt ext3.txt]
 
| [https://www.kernel.org/doc/Documentation/filesystems/ext3.txt ext3.txt]
 
|
 
|
Line 86: Line 82:
 
| {{man|8|mke2fs}}
 
| {{man|8|mke2fs}}
 
| {{Pkg|e2fsprogs}}
 
| {{Pkg|e2fsprogs}}
| {{Yes}} ({{Grp|base}})
+
| {{Yes}}
 
| [https://www.kernel.org/doc/Documentation/filesystems/ext4.txt ext4.txt]
 
| [https://www.kernel.org/doc/Documentation/filesystems/ext4.txt ext4.txt]
 
|
 
|
 
|-
 
|-
| [[w:Hierarchical_File_System|HFS]]
+
| [[Wikipedia:Hierarchical File System|HFS]]
 
| {{man|8|mkfs.hfsplus|url=}}
 
| {{man|8|mkfs.hfsplus|url=}}
| {{Pkg|hfsprogs}}
+
| {{AUR|hfsprogs}}
| {{Y|Optional}}
+
| {{No}}
 
| [https://www.kernel.org/doc/Documentation/filesystems/hfs.txt hfs.txt]
 
| [https://www.kernel.org/doc/Documentation/filesystems/hfs.txt hfs.txt]
| [[w:macOS|macOS]] file system
+
| [[Wikipedia:Classic Mac OS|Classic Mac OS]] file system
 +
|-
 +
| [[Wikipedia:HFS Plus|HFS+]]
 +
| {{man|8|mkfs.hfsplus|url=}}
 +
| {{AUR|hfsprogs}}
 +
| {{No}}
 +
| [https://www.kernel.org/doc/Documentation/filesystems/hfsplus.txt hfsplus.txt]
 +
| [[Wikipedia:macOS|macOS]] (8–10.12) file system
 
|-
 
|-
 
| [[JFS]]
 
| [[JFS]]
| {{man|8|mkfs.jfs|url=}}
+
| {{man|8|mkfs.jfs}}
 
| {{Pkg|jfsutils}}
 
| {{Pkg|jfsutils}}
| {{Yes}} ({{Grp|base}})
+
| {{Yes}}
 
| [https://www.kernel.org/doc/Documentation/filesystems/jfs.txt jfs.txt]
 
| [https://www.kernel.org/doc/Documentation/filesystems/jfs.txt jfs.txt]
 
|
 
|
 
|-
 
|-
 
| [[Wikipedia:NILFS|NILFS2]]
 
| [[Wikipedia:NILFS|NILFS2]]
| {{man|8|mkfs.nilfs2|url=}}
+
| {{man|8|mkfs.nilfs2}}
 
| {{Pkg|nilfs-utils}}
 
| {{Pkg|nilfs-utils}}
 
| {{Yes}}
 
| {{Yes}}
Line 112: Line 115:
 
|-
 
|-
 
| [[NTFS]]
 
| [[NTFS]]
| {{man|8|mkfs.ntfs|url=https://linux.die.net/man/8/mkfs.ntfs}}
+
| {{man|8|mkfs.ntfs}}
 
| {{Pkg|ntfs-3g}}
 
| {{Pkg|ntfs-3g}}
 
| {{Yes}}
 
| {{Yes}}
 
| N/A (FUSE-based)
 
| N/A (FUSE-based)
| [[w:Microsoft_Windows|Windows]] file system
+
| [[Wikipedia:Microsoft Windows|Windows]] file system
 
|-
 
|-
| [[Reiser4]]
+
| [[Wikipedia:ReiserFS|ReiserFS]]
| {{man|8|mkfs.reiser4|url=}}
+
| {{man|8|mkfs.reiserfs}}
| {{AUR|reiser4progs}}
+
| {{Pkg|reiserfsprogs}}
| {{No}}
+
| {{Yes}}
 
|
 
|
 
|
 
|
 
|-
 
|-
| [[w:ReiserFS|ReiserFS]]
+
| [[Wikipedia:Universal Disk Format|UDF]]
| {{man|8|mkfs.reiserfs|url=}}
+
| {{man|8|mkfs.udf}}
| {{Pkg|reiserfsprogs}}
+
| {{Pkg|udftools}}
| {{Yes}} ({{Grp|base}})
+
| {{Y|Optional}}
|
+
| [https://www.kernel.org/doc/Documentation/filesystems/udf.txt udf.txt]
 
|
 
|
 
|-
 
|-
Line 135: Line 138:
 
| {{man|8|mkfs.xfs}}
 
| {{man|8|mkfs.xfs}}
 
| {{Pkg|xfsprogs}}
 
| {{Pkg|xfsprogs}}
| {{Yes}} ({{Grp|base}})
+
| {{Yes}}
 
|
 
|
 
[https://www.kernel.org/doc/Documentation/filesystems/xfs.txt xfs.txt]<br>
 
[https://www.kernel.org/doc/Documentation/filesystems/xfs.txt xfs.txt]<br>
 
[https://www.kernel.org/doc/Documentation/filesystems/xfs-delayed-logging-design.txt xfs-delayed-logging-design.txt]<br>
 
[https://www.kernel.org/doc/Documentation/filesystems/xfs-delayed-logging-design.txt xfs-delayed-logging-design.txt]<br>
 
[https://www.kernel.org/doc/Documentation/filesystems/xfs-self-describing-metadata.txt xfs-self-describing-metadata.txt]
 
[https://www.kernel.org/doc/Documentation/filesystems/xfs-self-describing-metadata.txt xfs-self-describing-metadata.txt]
 +
|
 +
|}
 +
 +
{{Note|The kernel has its own NTFS driver (see [https://www.kernel.org/doc/Documentation/filesystems/ntfs.txt ntfs.txt]), but it has limited support for writing files.}}
 +
 +
{| class="wikitable sortable"
 +
|+ Out-of-tree file systems
 +
! File system
 +
! Creation command
 +
! Kernel patchset
 +
! Userspace utilities
 +
! Notes
 +
|-
 +
| [[Wikipedia:Apple File System|APFS]]
 +
| {{man|8|mkapfs|url=}}
 +
| {{AUR|linux-apfs-dkms-git}}
 +
| {{AUR|apfsprogs-git}}
 +
| [[Wikipedia:macOS|macOS]] (10.13 and newer) file system. Read only, experimental.
 +
|-
 +
| [[Bcachefs]]
 +
| {{man|8|bcachefs|url=}}
 +
| {{AUR|linux-bcachefs-git}}
 +
| {{AUR|bcachefs-tools-git}}
 +
|
 +
|-
 +
| [[Reiser4]]
 +
| {{man|8|mkfs.reiser4|url=}}
 +
| {{AUR|linux-ck-reiser4}}{{Broken package link|package not found}}
 +
| {{AUR|reiser4progs}}
 
|
 
|
 
|-
 
|-
 
| [[ZFS]]
 
| [[ZFS]]
 
|  
 
|  
| {{AUR|zfs-linux}}
+
| {{AUR|zfs-linux}}, {{AUR|zfs-dkms}}
| {{No}}
+
| {{AUR|zfs-utils}}
| N/A ([[w:OpenZFS|OpenZFS]] port)
+
| [[Wikipedia:OpenZFS|OpenZFS]] port
|
 
 
|}
 
|}
 
{{Note|The kernel has its own NTFS driver (see [https://www.kernel.org/doc/Documentation/filesystems/ntfs.txt ntfs.txt]), but it has limited support for writing files.}}
 
  
 
=== Journaling ===
 
=== Journaling ===
  
All the above filesystems with the exception of ext2, FAT16/32, Btrfs and ZFS, use [[Wikipedia:Journaling_file_system|journaling]]. Journaling provides fault-resilience by logging changes before they are committed to the filesystem. In the event of a system crash or power failure, such file systems are faster to bring back online and less likely to become corrupted. The logging takes place in a dedicated area of the filesystem.
+
All the above filesystems with the exception of ext2, FAT16/32, Reiser4 (optional), Btrfs and ZFS, use [[Wikipedia:Journaling file system|journaling]]. Journaling provides fault-resilience by logging changes before they are committed to the filesystem. In the event of a system crash or power failure, such file systems are faster to bring back online and less likely to become corrupted. The logging takes place in a dedicated area of the filesystem.
  
Not all journaling techniques are the same. Ext3 and ext4 offer data-mode journaling, which logs both data and meta-data, as well as possibility to journal only meta-data changes. Data-mode journaling comes with a speed penalty and is not enabled by default. In the same vein, [[Reiser4]] offers so-called [https://reiser4.wiki.kernel.org/index.php/Reiser4_transaction_models "transaction models"], which include pure journaling (equivalent to ext4's data-mode journaling), pure Copy-on-Write approach (equivalent to btrfs' default) and a combined approach which heuristically alternates between the two former.
+
Not all journaling techniques are the same. Ext3 and ext4 offer data-mode journaling, which logs both data and meta-data, as well as possibility to journal only meta-data changes. Data-mode journaling comes with a speed penalty and is not enabled by default. In the same vein, [[Reiser4]] offers so-called [https://reiser4.wiki.kernel.org/index.php/Reiser4_transaction_models "transaction models"] which not only change the features it provides, but in its journaling mode. It uses a different journaling techniques: a special model called [https://reiser4.wiki.kernel.org/index.php/V4#Wandering_Logs wandering logs] which eliminates the need to write to the disk twice, '''write-anywhere'''—a pure copy-on-write approach (mostly equivalent to btrfs' default but with a fundamentally different "tree" design) and a combined approach called '''hybrid''' which heuristically alternates between the two former.
  
{{Note|Reiser4 does not provide an equivalent to ext4's default journaling behavior (meta-data only).}}
+
{{Note|Reiser4 does provide an almost equivalent to ext4's default journaling behavior (meta-data only) with the use of the '''node41''' plugin which also features meta-data and inline checksums, optionally combined with the wandering logs behaviour it provides depending on what transaction model is chosen at mount time.}}
  
The other filesystems provide ordered-mode journaling, which only logs meta-data. While all journaling will return a filesystem to a valid state after a crash, data-mode journaling offers the greatest protection against corruption and data loss. There is a compromise in system performance, however, because data-mode journaling does two write operations: first to the journal and then to the disk. The trade-off between system speed and data safety should be considered when choosing the filesystem type.
+
The other filesystems provide ordered-mode journaling, which only logs meta-data. While all journaling will return a filesystem to a valid state after a crash, data-mode journaling offers the greatest protection against corruption and data loss. There is a compromise in system performance, however, because data-mode journaling does two write operations: first to the journal and then to the disk (which Reiser4 avoids with its "wandering logs" feature). The trade-off between system speed and data safety should be considered when choosing the filesystem type. Reiser4 is the only filesystem that by design operates on full atomicity and also provides checksums for both meta-data and inline data (operations entirely occur, or they entirely do not and does not corrupt or destroy data due to operations half-occurring) and by design is therefor much less prone to data loss than other file systems like [[Btrfs]].
  
Filesystems based on copy-on-write, such as Btrfs and ZFS, have no need to use traditional journal to protect metadata, because they are never updated in-place. Although Btrfs still has a journal-like log tree, it is only used to speed-up fdatasync/fsync.
+
Filesystems based on copy-on-write (also known as write-anywhere), such as Reiser4, Btrfs and ZFS, have no need to use traditional journal to protect metadata, because they are never updated in-place. Although Btrfs still has a journal-like log tree, it is only used to speed-up fdatasync/fsync.
  
 
=== FUSE-based file systems ===
 
=== FUSE-based file systems ===
  
[[Wikipedia:Filesystem in Userspace|Filesystem in Userspace]] (FUSE) is a mechanism for Unix-like operating systems that lets non-privileged users create their own file systems without editing kernel code. This is achieved by running file system code in ''user space'', while the FUSE kernel module provides only a "bridge" to the actual kernel interfaces.
+
See [[FUSE]].
 
 
Some FUSE-based file systems:
 
 
 
* {{App|adbfs-git|Mount an Android device connected via USB.|http://collectskin.com/adbfs/|{{AUR|adbfs-git}}}}
 
* {{App|[[EncFS]]|EncFS is a userspace stackable cryptographic file-system.|https://vgough.github.io/encfs/|{{Pkg|encfs}}}}
 
* {{App|fuseiso|Mount an ISO as a regular user.|http://sourceforge.net/projects/fuseiso/|{{Pkg|fuseiso}}}}
 
* {{App|[[gitfs]]|gitfs is a FUSE file system that fully integrates with git.|https://www.presslabs.com/gitfs/|{{Aur|gitfs}}}}
 
* {{App|xbfuse-git|Mount an Xbox (360) ISO.|http://multimedia.cx/xbfuse/|{{AUR|xbfuse-git}}}}
 
* {{App|xmlfs|Represent an XML file as a directory structure for easy access.|https://github.com/halhen/xmlfs|{{AUR|xmlfs}}}}
 
* {{App|vdfuse|Mounting VirtualBox disk images (VDI/VMDK/VHD).|https://github.com/muflone/virtualbox-includes|{{AUR|vdfuse}}}}
 
 
 
See [[Wikipedia:Filesystem in Userspace#Example uses]] for more.
 
  
 
=== Stackable file systems ===
 
=== Stackable file systems ===
  
* {{App|aufs|Advanced Multi-layered Unification Filesystem, a FUSE based union filesystem, a complete rewrite of Unionfs, was rejected from Linux mainline and instead OverlayFS was merged into the Linux Kernel.|http://aufs.sourceforge.net|{{AUR|aufs}}}}
+
* {{App|aufs|Advanced Multi-layered Unification Filesystem, a FUSE based union filesystem, a complete rewrite of Unionfs, was rejected from Linux mainline and instead OverlayFS was merged into the Linux Kernel.|http://aufs.sourceforge.net|{{AUR|aufs}}{{Broken package link|package not found}}}}
  
 
* {{App|[[eCryptfs]]|The Enterprise Cryptographic Filesystem is a package of disk encryption software for Linux. It is implemented as a POSIX-compliant filesystem-level encryption layer, aiming to offer functionality similar to that of GnuPG at the operating system level.|http://ecryptfs.org|{{Pkg|ecryptfs-utils}}}}
 
* {{App|[[eCryptfs]]|The Enterprise Cryptographic Filesystem is a package of disk encryption software for Linux. It is implemented as a POSIX-compliant filesystem-level encryption layer, aiming to offer functionality similar to that of GnuPG at the operating system level.|http://ecryptfs.org|{{Pkg|ecryptfs-utils}}}}
Line 204: Line 221:
 
* {{App|[[Ceph]]|Unified, distributed storage system designed for excellent performance, reliability and scalability.|https://ceph.com/|{{pkg|ceph}}}}
 
* {{App|[[Ceph]]|Unified, distributed storage system designed for excellent performance, reliability and scalability.|https://ceph.com/|{{pkg|ceph}}}}
 
* {{App|[[Glusterfs]]|Cluster file system capable of scaling to several peta-bytes.|https://www.gluster.org/|{{Pkg|glusterfs}}}}
 
* {{App|[[Glusterfs]]|Cluster file system capable of scaling to several peta-bytes.|https://www.gluster.org/|{{Pkg|glusterfs}}}}
* {{App|[[IPFS]]|A peer-to-peer hypermedia protocol to make the web faster, safer, and more open. IPFS aims replace HTTP and build a better web for all of us. Uses blocks to store parts of a file, each network node stores only content it is interested, provides deduplication, distribution, scalable system limited only by users. (currently in aplha)|https://ipfs.io/|{{Pkg|go-ipfs}}}}
+
* {{App|[[IPFS]]|A peer-to-peer hypermedia protocol to make the web faster, safer, and more open. IPFS aims replace HTTP and build a better web for all of us. Uses blocks to store parts of a file, each network node stores only content it is interested, provides deduplication, distribution, scalable system limited only by users. (currently in alpha)|https://ipfs.io/|{{Pkg|go-ipfs}}}}
* {{App|[[Wikipedia: MooseFS|MooseFS]]|MooseFS is a fault tolerant, highly available and high performance scale-out network distributed file system.|https://www.gluster.org/|{{Pkg|moosefs}}}}
+
* {{App|[[Wikipedia: MooseFS|MooseFS]]|MooseFS is a fault tolerant, highly available and high performance scale-out network distributed file system.|https://moosefs.com|{{Pkg|moosefs}}}}
 
* {{App|[[OpenAFS]]|Open source implementation of the AFS distributed file system|http://www.openafs.org|{{AUR|openafs}}}}
 
* {{App|[[OpenAFS]]|Open source implementation of the AFS distributed file system|http://www.openafs.org|{{AUR|openafs}}}}
 
* {{App|[[Wikipedia: OrangeFS|OrangeFS]]|OrangeFS is a scale-out network file system designed for transparently accessing multi-server-based disk storage, in parallel. Has optimized MPI-IO support for parallel and distributed applications. Simplifies the use of parallel storage not only for Linux clients, but also for Windows, Hadoop, and WebDAV. POSIX-compatible. Part of Linux kernel since version 4.6. |http://www.orangefs.org/}}
 
* {{App|[[Wikipedia: OrangeFS|OrangeFS]]|OrangeFS is a scale-out network file system designed for transparently accessing multi-server-based disk storage, in parallel. Has optimized MPI-IO support for parallel and distributed applications. Simplifies the use of parallel storage not only for Linux clients, but also for Windows, Hadoop, and WebDAV. POSIX-compatible. Part of Linux kernel since version 4.6. |http://www.orangefs.org/}}
* {{App|Sheepdog|Distributed object storage system for volume and container services and manages the disks and nodes intelligently.|https://sheepdog.github.io/sheepdog/}}
+
* {{App|Sheepdog|Distributed object storage system for volume and container services and manages the disks and nodes intelligently.|https://sheepdog.github.io/sheepdog/|{{AUR|sheepdog}}}}
 
* {{App|[[Wikipedia:Tahoe-LAFS|Tahoe-LAFS]]|Tahoe Least-Authority Filesystem is a free and open, secure, decentralized, fault-tolerant, peer-to-peer distributed data store and distributed file system.
 
* {{App|[[Wikipedia:Tahoe-LAFS|Tahoe-LAFS]]|Tahoe Least-Authority Filesystem is a free and open, secure, decentralized, fault-tolerant, peer-to-peer distributed data store and distributed file system.
 
|https://tahoe-lafs.org/|{{AUR|tahoe-lafs}}}}
 
|https://tahoe-lafs.org/|{{AUR|tahoe-lafs}}}}
Line 226: Line 243:
 
== Create a file system ==
 
== Create a file system ==
  
File systems are usually created on a [[partition]], inside logical containers such as [[LVM]], [[RAID]] and [[dm-crypt]], or on a regular file (see [[w:Loop device]]). This section describes the partition case.
+
File systems are usually created on a [[partition]], inside logical containers such as [[LVM]], [[RAID]] and [[dm-crypt]], or on a regular file (see [[Wikipedia:Loop device]]). This section describes the partition case.
  
{{Note|1=File systems can be written directly to a disk, known as a [https://msdn.microsoft.com/en-us/library/windows/hardware/dn640535(v=vs.85).aspx#gpt_faq_superfloppy superfloppy] or ''partitionless disk''. Certain limitations are involved with this method, particularly if [[Arch boot process|booting]] from such a drive. See [[Btrfs#Partitionless Btrfs disk]] for an example.}}
+
{{Note|1=File systems can be written directly to a disk, known as a ''superfloppy'' or [[Partitioning#Partitionless disk|partitionless disk]]. Certain limitations are involved with this method, particularly if [[Arch boot process|booting]] from such a drive. See [[Btrfs#Partitionless Btrfs disk]] for an example.}}
  
 
{{Warning|
 
{{Warning|
 
* After creating a new filesystem, data previously stored on this partition can unlikely be recovered. '''Create a backup of any data you want to keep'''.
 
* After creating a new filesystem, data previously stored on this partition can unlikely be recovered. '''Create a backup of any data you want to keep'''.
*The purpose of a given partition may restrict the choice of file system. For example, an [[EFI System Partition]] must contain a FAT32 ({{ic|mkfs.vfat}}) file system, and the file system containing the {{ic|/boot}} directory must be supported by the [[boot loader]].
+
*The purpose of a given partition may restrict the choice of file system. For example, an [[EFI system partition]] must contain a [[FAT32]] file system, and the file system containing the {{ic|/boot}} directory must be supported by the [[boot loader]].
 
}}
 
}}
  
Line 245: Line 262:
 
}}
 
}}
  
Mounted file systems '''must''' be [[#Umount a file system|unmounted]] before proceeding. In the above example an existing filesystem is on {{ic|/dev/sda2}} and is mounted at {{ic|/mnt}}. It would be unmounted with:
+
Mounted file systems '''must''' be [[#Unmount a file system|unmounted]] before proceeding. In the above example an existing filesystem is on {{ic|/dev/sda2}} and is mounted at {{ic|/mnt}}. It would be unmounted with:
  
 
  # umount /dev/sda2
 
  # umount /dev/sda2
Line 258: Line 275:
  
 
{{Tip|
 
{{Tip|
* Use the {{ic|-L}} flag of ''mkfs.ext4'' to specify a [[Persistent_block_device_naming#by-label|file system label]]. ''e2label'' can be used to change the label on an existing file system.
+
* Use the {{ic|-L}} flag of ''mkfs.ext4'' to specify a [[Persistent block device naming#by-label|file system label]]. ''e2label'' can be used to change the label on an existing file system.
* File systems may be ''resized'' after creation, with certain limitations. For example, an [[XFS]] filesystem's size can be increased, but it cannot reduced. See [[w:Comparison_of_file_systems#Resize_capabilities|Resize capabilities]] and the respective file system documentation for details.}}
+
* File systems may be ''resized'' after creation, with certain limitations. For example, an [[XFS]] filesystem's size can be increased, but it cannot reduced. See [[Wikipedia:Comparison of file systems#Resize capabilities]] and the respective file system documentation for details.}}
  
 
The new file system can now be mounted to a directory of choice.
 
The new file system can now be mounted to a directory of choice.
Line 290: Line 307:
  
 
See these related articles and the article of the filesystem of interest for more information.
 
See these related articles and the article of the filesystem of interest for more information.
 +
 +
{{Tip|File systems can also be mounted with ''systemd-mount'' instead of ''mount''. If the mount point is not specified, the file system will be mounted at {{ic|/run/media/system/''device_identifier''/}}. This allows to easily mount a file system without having to decide where to mount it. See {{man|1|systemd-mount}} for usage and more details.}}
  
 
=== List mounted file systems ===
 
=== List mounted file systems ===
Line 303: Line 322:
 
''findmnt'' gathers information from {{ic|/etc/fstab}}, {{ic|/etc/mtab}}, and {{ic|/proc/self/mounts}}.
 
''findmnt'' gathers information from {{ic|/etc/fstab}}, {{ic|/etc/mtab}}, and {{ic|/proc/self/mounts}}.
  
=== Umount a file system ===
+
=== Unmount a file system ===
  
 
To unmount a file system use {{man|8|umount}}. Either the device containing the file system (e.g., {{ic|/dev/sda1}}) or the mount point (e.g., {{ic|/mnt}}) can be specified:
 
To unmount a file system use {{man|8|umount}}. Either the device containing the file system (e.g., {{ic|/dev/sda1}}) or the mount point (e.g., {{ic|/mnt}}) can be specified:
Line 309: Line 328:
 
  # umount /dev/sda1
 
  # umount /dev/sda1
  
Or
+
or
  
 
  # umount /mnt
 
  # umount /mnt
Line 316: Line 335:
  
 
* {{man|5|filesystems}}
 
* {{man|5|filesystems}}
 +
* {{man|1|systemd-mount}}
 
* [https://www.kernel.org/doc/Documentation/filesystems/ Documentation of file systems supported by linux]
 
* [https://www.kernel.org/doc/Documentation/filesystems/ Documentation of file systems supported by linux]
 
* [[Wikipedia:File systems]]
 
* [[Wikipedia:File systems]]
 
* [[Wikipedia:Mount (Unix)]]
 
* [[Wikipedia:Mount (Unix)]]

Latest revision as of 15:24, 22 February 2020

From Wikipedia:

In computing, a file system or filesystem controls how data is stored and retrieved. Without a file system, information placed in a storage medium would be one large body of data with no way to tell where one piece of information stops and the next begins. By separating the data into pieces and giving each piece a name, the information is easily isolated and identified. Taking its name from the way paper-based information systems are named, each group of data is called a "file". The structure and logic rules used to manage the groups of information and their names is called a "file system".

Individual drive partitions can be setup using one of the many different available filesystems. Each has its own advantages, disadvantages, and unique idiosyncrasies. A brief overview of supported filesystems follows; the links are to Wikipedia pages that provide much more information.

Types of file systems

Tango-inaccurate.pngThe factual accuracy of this article or section is disputed.Tango-inaccurate.png

Reason: /proc/filesystems only lists file systems whose modules are either built-in or currently loaded. Since Arch kernels have most of the file systems built as loadable modules, /proc/filesystems will show very few, if any, usable file systems. (Discuss in Talk:File systems#)

See filesystems(5) for a general overview and Wikipedia:Comparison of file systems for a detailed feature comparison. File systems supported by the kernel are listed in /proc/filesystems.

In-tree and FUSE file systems
File system Creation command Userspace utilities Archiso [1] Kernel documentation [2] Notes
Btrfs mkfs.btrfs(8) btrfs-progs Yes btrfs.txt Stability status
VFAT mkfs.fat(8) dosfstools Yes vfat.txt
exFAT mkexfatfs(8) exfat-utils Yes N/A (FUSE-based)
F2FS mkfs.f2fs(8) f2fs-tools Yes f2fs.txt Flash-based devices
ext3 mke2fs(8) e2fsprogs Yes ext3.txt
ext4 mke2fs(8) e2fsprogs Yes ext4.txt
HFS mkfs.hfsplus(8) hfsprogsAUR No hfs.txt Classic Mac OS file system
HFS+ mkfs.hfsplus(8) hfsprogsAUR No hfsplus.txt macOS (8–10.12) file system
JFS mkfs.jfs(8) jfsutils Yes jfs.txt
NILFS2 mkfs.nilfs2(8) nilfs-utils Yes nilfs2.txt
NTFS mkfs.ntfs(8) ntfs-3g Yes N/A (FUSE-based) Windows file system
ReiserFS mkfs.reiserfs(8) reiserfsprogs Yes
UDF mkfs.udf(8) udftools Optional udf.txt
XFS mkfs.xfs(8) xfsprogs Yes

xfs.txt
xfs-delayed-logging-design.txt
xfs-self-describing-metadata.txt

Note: The kernel has its own NTFS driver (see ntfs.txt), but it has limited support for writing files.
Out-of-tree file systems
File system Creation command Kernel patchset Userspace utilities Notes
APFS mkapfs(8) linux-apfs-dkms-gitAUR apfsprogs-gitAUR macOS (10.13 and newer) file system. Read only, experimental.
Bcachefs bcachefs(8) linux-bcachefs-gitAUR bcachefs-tools-gitAUR
Reiser4 mkfs.reiser4(8) linux-ck-reiser4AUR[broken link: package not found] reiser4progsAUR
ZFS zfs-linuxAUR, zfs-dkmsAUR zfs-utilsAUR OpenZFS port

Journaling

All the above filesystems with the exception of ext2, FAT16/32, Reiser4 (optional), Btrfs and ZFS, use journaling. Journaling provides fault-resilience by logging changes before they are committed to the filesystem. In the event of a system crash or power failure, such file systems are faster to bring back online and less likely to become corrupted. The logging takes place in a dedicated area of the filesystem.

Not all journaling techniques are the same. Ext3 and ext4 offer data-mode journaling, which logs both data and meta-data, as well as possibility to journal only meta-data changes. Data-mode journaling comes with a speed penalty and is not enabled by default. In the same vein, Reiser4 offers so-called "transaction models" which not only change the features it provides, but in its journaling mode. It uses a different journaling techniques: a special model called wandering logs which eliminates the need to write to the disk twice, write-anywhere—a pure copy-on-write approach (mostly equivalent to btrfs' default but with a fundamentally different "tree" design) and a combined approach called hybrid which heuristically alternates between the two former.

Note: Reiser4 does provide an almost equivalent to ext4's default journaling behavior (meta-data only) with the use of the node41 plugin which also features meta-data and inline checksums, optionally combined with the wandering logs behaviour it provides depending on what transaction model is chosen at mount time.

The other filesystems provide ordered-mode journaling, which only logs meta-data. While all journaling will return a filesystem to a valid state after a crash, data-mode journaling offers the greatest protection against corruption and data loss. There is a compromise in system performance, however, because data-mode journaling does two write operations: first to the journal and then to the disk (which Reiser4 avoids with its "wandering logs" feature). The trade-off between system speed and data safety should be considered when choosing the filesystem type. Reiser4 is the only filesystem that by design operates on full atomicity and also provides checksums for both meta-data and inline data (operations entirely occur, or they entirely do not and does not corrupt or destroy data due to operations half-occurring) and by design is therefor much less prone to data loss than other file systems like Btrfs.

Filesystems based on copy-on-write (also known as write-anywhere), such as Reiser4, Btrfs and ZFS, have no need to use traditional journal to protect metadata, because they are never updated in-place. Although Btrfs still has a journal-like log tree, it is only used to speed-up fdatasync/fsync.

FUSE-based file systems

See FUSE.

Stackable file systems

  • aufs — Advanced Multi-layered Unification Filesystem, a FUSE based union filesystem, a complete rewrite of Unionfs, was rejected from Linux mainline and instead OverlayFS was merged into the Linux Kernel.
http://aufs.sourceforge.net || aufsAUR[broken link: package not found]
  • eCryptfs — The Enterprise Cryptographic Filesystem is a package of disk encryption software for Linux. It is implemented as a POSIX-compliant filesystem-level encryption layer, aiming to offer functionality similar to that of GnuPG at the operating system level.
http://ecryptfs.org || ecryptfs-utils
  • mergerfs — a FUSE based union filesystem.
https://github.com/trapexit/mergerfs || mergerfsAUR
  • mhddfs — Multi-HDD FUSE filesystem, a FUSE based union filesystem.
http://mhddfs.uvw.ru || mhddfsAUR
  • overlayfs — OverlayFS is a filesystem service for Linux which implements a union mount for other file systems.
https://www.kernel.org/doc/Documentation/filesystems/overlayfs.txt || linux
  • Unionfs — Unionfs is a filesystem service for Linux, FreeBSD and NetBSD which implements a union mount for other file systems.
http://unionfs.filesystems.org/ || not packaged? search in AUR
  • unionfs-fuse — A user space Unionfs implementation.
https://github.com/rpodgorny/unionfs-fuse || unionfs-fuse

Read-only file systems

  • SquashFS — SquashFS is a compressed read only filesystem. SquashFS compresses files, inodes and directories, and supports block sizes up to 1 MB for greater compression.
http://squashfs.sourceforge.net/ || squashfs-tools

Clustered file systems

  • Ceph — Unified, distributed storage system designed for excellent performance, reliability and scalability.
https://ceph.com/ || ceph
  • Glusterfs — Cluster file system capable of scaling to several peta-bytes.
https://www.gluster.org/ || glusterfs
  • IPFS — A peer-to-peer hypermedia protocol to make the web faster, safer, and more open. IPFS aims replace HTTP and build a better web for all of us. Uses blocks to store parts of a file, each network node stores only content it is interested, provides deduplication, distribution, scalable system limited only by users. (currently in alpha)
https://ipfs.io/ || go-ipfs
  • MooseFS — MooseFS is a fault tolerant, highly available and high performance scale-out network distributed file system.
https://moosefs.com || moosefs
  • OpenAFS — Open source implementation of the AFS distributed file system
http://www.openafs.org || openafsAUR
  • OrangeFS — OrangeFS is a scale-out network file system designed for transparently accessing multi-server-based disk storage, in parallel. Has optimized MPI-IO support for parallel and distributed applications. Simplifies the use of parallel storage not only for Linux clients, but also for Windows, Hadoop, and WebDAV. POSIX-compatible. Part of Linux kernel since version 4.6.
http://www.orangefs.org/ || not packaged? search in AUR
  • Sheepdog — Distributed object storage system for volume and container services and manages the disks and nodes intelligently.
https://sheepdog.github.io/sheepdog/ || sheepdogAUR
  • Tahoe-LAFS — Tahoe Least-Authority Filesystem is a free and open, secure, decentralized, fault-tolerant, peer-to-peer distributed data store and distributed file system.
https://tahoe-lafs.org/ || tahoe-lafsAUR

Identify existing file systems

To identify existing file systems, you can use lsblk:

$ lsblk -f
NAME   FSTYPE LABEL     UUID                                 MOUNTPOINT
sdb                                                          
└─sdb1 vfat   Transcend 4A3C-A9E9

An existing file system, if present, will be shown in the FSTYPE column. If mounted, it will appear in the MOUNTPOINT column.

Create a file system

File systems are usually created on a partition, inside logical containers such as LVM, RAID and dm-crypt, or on a regular file (see Wikipedia:Loop device). This section describes the partition case.

Note: File systems can be written directly to a disk, known as a superfloppy or partitionless disk. Certain limitations are involved with this method, particularly if booting from such a drive. See Btrfs#Partitionless Btrfs disk for an example.
Warning:
  • After creating a new filesystem, data previously stored on this partition can unlikely be recovered. Create a backup of any data you want to keep.
  • The purpose of a given partition may restrict the choice of file system. For example, an EFI system partition must contain a FAT32 file system, and the file system containing the /boot directory must be supported by the boot loader.

Before continuing, identify the device where the file system will be created and whether or not it is mounted. For example:

$ lsblk -f
NAME   FSTYPE   LABEL       UUID                                 MOUNTPOINT
sda
├─sda1                      C4DA-2C4D                            
├─sda2 ext4                 5b1564b2-2e2c-452c-bcfa-d1f572ae99f2 /mnt
└─sda3                      56adc99b-a61e-46af-aab7-a6d07e504652 

Mounted file systems must be unmounted before proceeding. In the above example an existing filesystem is on /dev/sda2 and is mounted at /mnt. It would be unmounted with:

# umount /dev/sda2

To find just mounted file systems, see #List mounted file systems.

To create a new file system, use mkfs(8). See #Types of file systems for the exact type, as well as userspace utilities you may wish to install for a particular file system.

For example, to create a new file system of type ext4 (common for Linux data partitions) on /dev/sda1, run:

# mkfs.ext4 /dev/sda1
Tip:
  • Use the -L flag of mkfs.ext4 to specify a file system label. e2label can be used to change the label on an existing file system.
  • File systems may be resized after creation, with certain limitations. For example, an XFS filesystem's size can be increased, but it cannot reduced. See Wikipedia:Comparison of file systems#Resize capabilities and the respective file system documentation for details.

The new file system can now be mounted to a directory of choice.

Mount a file system

To manually mount filesystem located on a device (e.g., a partition) to a directory, use mount(8). This example mounts /dev/sda1 to /mnt.

# mount /dev/sda1 /mnt

This attaches the filesystem on /dev/sda1 at the directory /mnt, making the contents of the filesystem visible. Any data that existed at /mnt before this action is made invisible until the device is unmounted.

fstab contains information on how devices should be automatically mounted if present. See the fstab article for more information on how to modify this behavior.

If a device is specified in /etc/fstab and only the device or mount point is given on the command line, that information will be used in mounting. For example, if /etc/fstab contains a line indicating that /dev/sda1 should be mounted to /mnt, then the following will automatically mount the device to that location:

# mount /dev/sda1

Or

# mount /mnt

mount contains several options, many of which depend on the file system specified. The options can be changed, either by:

See these related articles and the article of the filesystem of interest for more information.

Tip: File systems can also be mounted with systemd-mount instead of mount. If the mount point is not specified, the file system will be mounted at /run/media/system/device_identifier/. This allows to easily mount a file system without having to decide where to mount it. See systemd-mount(1) for usage and more details.

List mounted file systems

To list all mounted file systems, use findmnt(8):

$ findmnt

findmnt takes a variety of arguments which can filter the output and show additional information. For example, it can take a device or mount point as an argument to show only information on what is specified:

$ findmnt /dev/sda1

findmnt gathers information from /etc/fstab, /etc/mtab, and /proc/self/mounts.

Unmount a file system

To unmount a file system use umount(8). Either the device containing the file system (e.g., /dev/sda1) or the mount point (e.g., /mnt) can be specified:

# umount /dev/sda1

or

# umount /mnt

See also