Difference between revisions of "File systems"
(cleanup Related articles, not any article that mentions file systems is related, articles in the same category don't need to be in Related articles)
(→FUSE-based file systems: either put the text here or just link to the category (transclusion is useless and visual duplication confusing))
|Line 166:||Line 166:|
=== FUSE-based file systems ===
=== FUSE-based file systems ===
=== Stackable file systems ===
=== Stackable file systems ===
Revision as of 18:00, 14 April 2018
- 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.
- 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
See Wikipedia:Comparison of file systems for a detailed feature comparison. File systems supported by the kernel are listed in
|File system||Creation command||Userspace utilities||Archiso ||Kernel documentation ||Notes|
|HFS||AUR||No||hfs.txt||macOS file system|
|NTFS||Yes||N/A (FUSE-based)||Windows file system|
|ZFS||AUR||No||N/A (OpenZFS port)|
All the above filesystems with the exception of ext2, FAT16/32, 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 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.
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.
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.
FUSE-based file systems
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 || AUR
- 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.
- mergerfs — a FUSE based union filesystem.
- mhddfs — Multi-HDD FUSE filesystem, a FUSE based union filesystem.
- http://mhddfs.uvw.ru || AUR
- overlayfs — OverlayFS is a filesystem service for Linux which implements a union mount for other file systems.
- Unionfs — Unionfs is a filesystem service for Linux, FreeBSD and NetBSD which implements a union mount for other file systems.
- unionfs-fuse — A user space Unionfs implementation.
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.
Clustered file systems
- Ceph — Unified, distributed storage system designed for excellent performance, reliability and scalability.
- Glusterfs — Cluster file system capable of scaling to several peta-bytes.
- 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)
- MooseFS — MooseFS is a fault tolerant, highly available and high performance scale-out network distributed file system.
- OpenAFS — Open source implementation of the AFS distributed file system
- http://www.openafs.org || AUR
- 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.
- Sheepdog — Distributed object storage system for volume and container services and manages the disks and nodes intelligently.
- 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
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
Create a file system
- 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 (
mkfs.vfat) file system, and the file system containing the
/bootdirectory 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 #Types of file systems for the exact type, as well as userspace utilities you may wish to install for a particular file system.. See
For example, to create a new file system of type ext4 (common for Linux data partitions) on
# mkfs.ext4 /dev/sda1
- Use the
-Lflag 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 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 /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.
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
# mount /mnt
mount contains several options, many of which depend on the file system specified. The options can be changed, either by:
- using flags on the command line with mount
- editing fstab
- creating udev rules
- compiling the kernel yourself
- or using filesystem-specific mount scripts (located at
See these related articles and the article of the filesystem of interest for more information.
List mounted file systems
To list all mounted file systems, use:
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
Umount a file system
To unmount a file system use
/dev/sda1) or the mount point (e.g.,
/mnt) can be specified:
# umount /dev/sda1
# umount /mnt