Difference between revisions of "File systems"

From ArchWiki
Jump to: navigation, search
m (Title hierarchy fixed)
m (Special purpose file systems)
 
(72 intermediate revisions by 27 users not shown)
Line 1: Line 1:
 
[[Category:File systems]]
 
[[Category:File systems]]
[[es:File Systems]]
+
[[es:File systems]]
[[It:File Systems]]
+
[[hu:File systems]]
[[ja:File Systems]]
+
[[it:File systems]]
[[pl:File Systems]]
+
[[ja:ファイルシステム]]
[[zh-cn:File Systems]]
+
[[pl:File systems]]
{{Article summary start}}
+
[[zh-cn:File systems]]
{{Article summary text|An overview of the types of file systems available.}}
+
{{Related articles start}}
{{Article summary heading|Related}}
+
{{Related|fstab}}
{{Article summary wiki|Partitioning}}
+
{{Related|Mount}}
{{Article summary end}}
+
{{Related|Partitioning}}
 +
{{Related|tmpfs}}
 +
{{Related|NFS}}
 +
{{Related|Samba}}
 +
{{Related|List of applications/Internet#Distributed file systems}}
 +
{{Related articles end}}
 +
 
 
From [[Wikipedia:File system|Wikipedia]]:
 
From [[Wikipedia:File system|Wikipedia]]:
:''A file system (or filesystem) is a means to organize data expected to be retained after a program terminates by providing procedures to store, retrieve and update data, as well as manage the available space on the device(s) which contain it. A file system organizes data in an efficient manner and is tuned to the specific characteristics of the device.''
+
:A file system (or filesystem) is a means to organize data expected to be retained after a program terminates by providing procedures to store, retrieve and update data, as well as manage the available space on the device(s) which contain it. A file system organizes data in an efficient manner and is tuned to the specific characteristics of the device.
  
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.
  
 
Before being formatted, a drive should be [[Partitioning|partitioned]].
 
Before being formatted, a drive should be [[Partitioning|partitioned]].
  
== Type of File Systems ==
+
== Types of file systems ==
  
* [[Wikipedia:Btrfs|Btrfs]] - Also known as "Better FS", is a '''new filesystem with powerful features similar to Sun/Oracle's excellent ZFS'''. These include snapshots, multi-disk striping and mirroring (software RAID without mdadm), checksums, incremental backup, and on-the-fly compression that can give a significant performance boost as well as save space. As of January 2011, Btrfs is considered unstable although it has been merged into the mainline kernel with an experimental status. Btrfs appears to be the future of GNU/Linux filesystems and is offered as a root filesystem option in all major distribution installers.
+
* [[Btrfs]] — the B-tree file system is "a new copy on write (CoW) filesystem for Linux aimed at implementing advanced features while focusing on fault tolerance, repair and easy administration." [https://btrfs.wiki.kernel.org/index.php/Main_Page] These features include snapshots, multi-disk striping and mirroring (software RAID without mdadm), checksums, incremental backup, and on-the-fly compression that can give a significant performance boost as well as save space. It has been merged into the mainline kernel Btrfs and is considered stable. [https://btrfs.wiki.kernel.org/index.php/Main_Page#Stability_status] Btrfs appears to be the future of GNU/Linux filesystems and is offered as a root filesystem option in all major distribution installers.
* [[Wikipedia:exFAT|exFAT]] - '''Microsoft file system optimized for flash drives'''. Unlike NTFS, exFAT cannot pre-allocate disk space for a file by just marking arbitrary space on disk as 'allocated'. As in FAT, when creating a file of known length, exFAT must perform a complete physical write equal to the size of the file.
+
* '''exFAT''' — '''Microsoft file system optimized for flash drives'''. Like NTFS, exFAT can pre-allocate disk space for a file by just marking arbitrary space on disk as 'allocated'.
* [[Wikipedia:ext2|ext2]] - '''Second Extended Filesystem''' is an established, mature GNU/Linux filesystem that is very stable. A drawback is that it does not have journaling support or barriers. Lack of journaling can result in data loss in the event of a power failure or system crash. It may also be '''not''' convenient for root ({{ic|/}}) and {{ic|/home}} partitions because file-system checks can take a long time. An ext2 filesystem can be [[Convert_ext2_to_ext3|converted to ext3]].
+
* [[Wikipedia:ext2|ext2]] '''Second Extended Filesystem''' is an established, mature GNU/Linux filesystem that is very stable. A drawback is that it does not have journaling support or barriers. Lack of journaling can result in data loss in the event of a power failure or system crash. It may also be '''not''' convenient for root ({{ic|/}}) and {{ic|/home}} partitions because file-system checks can take a long time. An ext2 filesystem can be [[Convert_ext2_to_ext3|converted to ext3]].
* [[Wikipedia:ext3|ext3]] - '''Third Extended Filesystem''' is essentially the ext2 system with journaling support and write barriers. It is backward compatible with ext2, well tested, and extremely stable.
+
* [[ext3]] '''Third Extended Filesystem''' is essentially the ext2 system with journaling support and write barriers. It is backward compatible with ext2, well tested, and extremely stable.
* [[Wikipedia:ext4|ext4]] - '''Fourth Extended Filesystem''' is a newer filesystem that is also compatible with ext2 and ext3. It provides support for volumes with sizes up to 1 exabyte (i.e. 1,048,576 terabytes) and files sizes up to 16 terabytes. It increases the 32,000 subdirectory limit in ext3 to 64,000. It also offers online defragmentation capability.
+
* [[ext4]] '''Fourth Extended Filesystem''' is a newer filesystem that is also compatible with ext2 and ext3. It provides support for volumes with sizes up to 1 exabyte (i.e. 1,048,576 terabytes) and files sizes up to 16 terabytes. It increases the 32,000 subdirectory limit in ext3 to unlimited. It also offers online defragmentation capability.
* [[Wikipedia:F2FS|F2FS]] - '''Flash-Friendly File System''' is a flash file system created by Kim Jaegeuk (Hangul: 김재극) at Samsung for the Linux operating system kernel. The motivation for F2FS was to build a file system that from the start takes into account the characteristics of NAND flash memory-based storage devices (such as solid-state disks, eMMC, and SD cards), which have been widely being used in computer systems ranging from mobile devices to servers.
+
* [[F2FS]] '''Flash-Friendly File System''' is a flash file system created by Kim Jaegeuk (Hangul: 김재극) at Samsung for the Linux operating system kernel. The motivation for F2FS was to build a file system that from the start takes into account the characteristics of NAND flash memory-based storage devices (such as solid-state disks, eMMC, and SD cards), which have been widely being used in computer systems ranging from mobile devices to servers.
* [[Wikipedia:JFS (file system)|JFS]] - IBM's '''Journaled File System''' was the first filesystem to offer journaling. It had many years of development in the IBM AIX® operating system before being ported to GNU/Linux. JFS makes the smallest demand on CPU resources of any GNU/Linux filesystem. It is very fast at formatting, mounting, and filesystem checks (fsck). JFS offers very good all-around performance especially in conjunction with the deadline I/O scheduler. It is not as widely supported as the ext series or ReiserFS, but still very mature and stable.
+
* [[Wikipedia:Hierarchical_File_System|HFS]] — '''Hierarchical File System''' is a proprietary file system developed by Apple Inc. for use in computer systems running Mac OS.
* [[Wikipedia:NILFS|NILFS2]] - '''New Implementation of a Log-structured File System''' was developed by NTT. It records all data in a continuous log-like format that is only appended to and never overwritten. It is designed to reduce seek times and minimize the type of data loss that occurs after a crash with conventional Linux filesystems.
+
* [[JFS]] IBM's '''Journaled File System''' was the first filesystem to offer journaling. It had many years of development in the IBM AIX® operating system before being ported to GNU/Linux. JFS makes the smallest demand on CPU resources of any GNU/Linux filesystem. It is very fast at formatting, mounting, and filesystem checks (fsck). JFS offers very good all-around performance especially in conjunction with the deadline I/O scheduler. It is not as widely supported as the ext series or ReiserFS, but still very mature and stable.
* [[Wikipedia:NTFS|NTFS]] - '''File system used by Windows'''. NTFS has several technical improvements over FAT and HPFS (High Performance File System), such as improved support for metadata, and the use of advanced data structures to improve performance, reliability, and disk space utilization, plus additional extensions, such as security access control lists (ACL) and file system journaling.
+
* [[Wikipedia:MINIX file system|MINIX File System]] — '''MINIX File System''' is the native filesystem of the MINIX operating system, both of which were designed by Andrew S. Tanenbaum. The Linux kernel provides read/write support for version 1, 2 and 3 of the MINIX filesystem.  
* [[Wikipedia:Reiser4|Reiser4]] - '''Successor to the ReiserFS file system''', developed from scratch by Namesys and sponsored by DARPA as well as Linspire, it uses B*-trees in conjunction with the dancing tree balancing approach, in which underpopulated nodes will not be merged until a flush to disk except under memory pressure or when a transaction completes. Such a system also allows Reiser4 to create files and directories without having to waste time and space through fixed blocks.
+
* [[Wikipedia:NILFS|NILFS2]] '''New Implementation of a Log-structured File System''' was developed by NTT. It records all data in a continuous log-like format that is only appended to and never overwritten. It is designed to reduce seek times and minimize the type of data loss that occurs after a crash with conventional Linux filesystems.
* [[Wikipedia:ReiserFS|ReiserFS]] - '''Hans Reiser's high-performance journaling FS (v3)''' uses a very interesting method of data throughput based on an unconventional and creative algorithm. ReiserFS is touted as very fast, especially when dealing with many small files. ReiserFS is fast at formatting, yet comparatively slow at mounting. Quite mature and stable. ReiserFSv3 is not being actively developed at this time. Generally regarded as a good choice for {{ic|/var}}.
+
* [[NTFS]] '''File system used by Windows'''. NTFS has several technical improvements over FAT and HPFS (High Performance File System), such as improved support for metadata, and the use of advanced data structures to improve performance, reliability, and disk space utilization, plus additional extensions, such as security access control lists (ACL) and file system journaling.
* [[Wikipedia:Paging|Swap]] - Filesystem used for swap partitions.
+
* [[Reiser4]] '''Successor to the ReiserFS file system''', developed from scratch by Namesys and sponsored by DARPA as well as Linspire, it uses B*-trees in conjunction with the dancing tree balancing approach, in which underpopulated nodes will not be merged until a flush to disk except under memory pressure or when a transaction completes. Such a system also allows Reiser4 to create files and directories without having to waste time and space through fixed blocks.
* [[Wikipedia:File Allocation Table#VFAT|VFAT]] - '''Virtual File Allocation Table''' is technically simple and supported by virtually all existing operating systems. This makes it a useful format for solid-state memory cards and a convenient way to share data between operating systems. VFAT supports long file names.
+
* [[Wikipedia:ReiserFS|ReiserFS]] '''Hans Reiser's high-performance journaling FS (v3)''' uses a very interesting method of data throughput based on an unconventional and creative algorithm. ReiserFS is touted as very fast, especially when dealing with many small files. ReiserFS is fast at formatting, yet comparatively slow at mounting. Quite mature and stable. ReiserFSv3 is not being actively developed at this time. Generally regarded as a good choice for {{ic|/var}}.
* [[Wikipedia:XFS|XFS]] - '''Early journaling filesystem originally developed by Silicon Graphics''' for the IRIX operating system and ported to GNU/Linux. It provides very fast throughput on large files and filesystems and is very fast at formatting and mounting. Comparative benchmark testing has shown it to be slower when dealing with many small files. XFS is very mature and offers online defragmentation capability.
+
* [[Wikipedia:File Allocation Table#VFAT|VFAT]] '''Virtual File Allocation Table''' is technically simple and supported by virtually all existing operating systems. This makes it a useful format for solid-state memory cards and a convenient way to share data between operating systems. VFAT supports long file names.
* [[Wikipedia:ZFS|ZFS]] - '''Combined file system and logical volume manager designed by Sun Microsystems'''. The features of ZFS include protection against data corruption, support for high storage capacities, integration of the concepts of filesystem and volume management, snapshots and copy-on-write clones, continuous integrity checking and automatic repair, RAID-Z and native NFSv4 ACLs.
+
* [[XFS]] '''Early journaling filesystem originally developed by Silicon Graphics''' for the IRIX operating system and ported to GNU/Linux. It provides very fast throughput on large files and filesystems and is very fast at formatting and mounting. Comparative benchmark testing has shown it to be slower when dealing with many small files. XFS is very mature and offers online defragmentation capability.
 +
* [[ZFS]] '''Combined file system and logical volume manager designed by Sun Microsystems'''. The features of ZFS include protection against data corruption, support for high storage capacities, integration of the concepts of filesystem and volume management, snapshots and copy-on-write clones, continuous integrity checking and automatic repair, RAID-Z and native NFSv4 ACLs.  
  
 
=== Journaling ===
 
=== Journaling ===
  
All the above filesystems with the exception of ext2, FAT16/32, 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, 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. Only ext3 and ext4 offer data-mode journaling, which logs both data and meta-data. Data-mode journaling comes with a speed penalty and is not enabled by default. 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.
+
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. ''It should be noted that reiser4 does not provide an equivalent to ext4's default journaling behavior (meta-data only).''
 +
 
 +
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.
  
 
=== Arch Linux support ===
 
=== Arch Linux support ===
  
 
* {{App|btrfs-progs|[[Btrfs]] support.|http://btrfs.wiki.kernel.org/|{{Pkg|btrfs-progs}}}}
 
* {{App|btrfs-progs|[[Btrfs]] support.|http://btrfs.wiki.kernel.org/|{{Pkg|btrfs-progs}}}}
* {{App|dosfstools|VFAT support.|http://www.daniel-baumann.ch/software/dosfstools/|{{Pkg|dosfstools}}}}
+
* {{App|dosfstools|VFAT support.|https://github.com/dosfstools/dosfstools|{{Pkg|dosfstools}}}}
* {{App|exfat-utils|exFAT support.|http://code.google.com/e/exfat/|{{Pkg|exfat-utils}}}}
+
* {{App|exfat-utils|exFAT support.|https://github.com/relan/exfat|{{Pkg|exfat-utils}}}}
* {{App|fuse-exfat|exFAT mount support.|http://code.google.com/p/exfat/|{{Pkg|fuse-exfat}}}}
+
* {{App|f2fs-tools|[[F2FS]] support.|https://git.kernel.org/cgit/linux/kernel/git/jaegeuk/f2fs-tools.git|{{Pkg|f2fs-tools}}}}
 
* {{App|e2fsprogs|ext2, [[ext3]], [[ext4]] support.|http://e2fsprogs.sourceforge.net|{{Pkg|e2fsprogs}}}}
 
* {{App|e2fsprogs|ext2, [[ext3]], [[ext4]] support.|http://e2fsprogs.sourceforge.net|{{Pkg|e2fsprogs}}}}
 +
* {{App|hfsprogs|HFS support.|http://www.opensource.apple.com|{{Pkg|hfsprogs}}}}
 
* {{App|jfsutils|[[JFS]] support.|http://jfs.sourceforge.net|{{Pkg|jfsutils}}}}
 
* {{App|jfsutils|[[JFS]] support.|http://jfs.sourceforge.net|{{Pkg|jfsutils}}}}
* {{App|nilfs-utils|NILFS support.|http://www.nilfs.org/|{{Pkg|nilfs-utils}}}}
+
* {{App|nilfs-utils|NILFS support.|http://nilfs.sourceforge.net/|{{Pkg|nilfs-utils}}}}
 
* {{App|ntfs-3g|[[NTFS]] support.|http://www.tuxera.com/community/ntfs-3g-download/|{{Pkg|ntfs-3g}}}}
 
* {{App|ntfs-3g|[[NTFS]] support.|http://www.tuxera.com/community/ntfs-3g-download/|{{Pkg|ntfs-3g}}}}
 
* {{App|reiser4progs|[[Reiser4|ReiserFSv4]] support.|http://sourceforge.net/projects/reiser4/|{{AUR|reiser4progs}}}}
 
* {{App|reiser4progs|[[Reiser4|ReiserFSv4]] support.|http://sourceforge.net/projects/reiser4/|{{AUR|reiser4progs}}}}
 
* {{App|reiserfsprogs|ReiserFSv3 support.|https://www.kernel.org/|{{Pkg|reiserfsprogs}}}}
 
* {{App|reiserfsprogs|ReiserFSv3 support.|https://www.kernel.org/|{{Pkg|reiserfsprogs}}}}
* {{App|util-linux|[[Swap]] support.|http://www.kernel.org/pub/linux/utils/util-linux/|{{Pkg|util-linux}}}}
 
 
* {{App|xfsprogs|[[XFS]] support.|http://oss.sgi.com/projects/xfs/|{{Pkg|xfsprogs}}}}
 
* {{App|xfsprogs|[[XFS]] support.|http://oss.sgi.com/projects/xfs/|{{Pkg|xfsprogs}}}}
* {{App|zfs|[[ZFS]] support.|http://zfsonlinux.org/|{{AUR|zfs}}}}
+
* {{App|zfs|[[ZFS]] support.|http://zfsonlinux.org/|{{AUR|zfs-linux}}, {{AUR|zfs-linux-git}}}}
* {{App|zfs-fuse|[[ZFS_on_FUSE|ZFS]] support via FUSE.|http://zfs-fuse.net/|{{AUR|zfs-fuse}}}}
+
 
{{Note|The ZFS filesystem cannot be shrunk by disk utilities such as gparted.}}
+
=== 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.
 +
 
 +
Some FUSE-based file systems:
 +
 
 +
* {{App|acd-fuse|FUSE filesystem driver for Amazon's Cloud Drive.|https://github.com/handyman5/acd_fuse|{{AUR|acdfuse-git}}{{Broken package link|{{aur-mirror|acdfuse-git}}}}}}
 +
* {{App|adbfs-git|Mount an Android device filesystem.|http://collectskin.com/adbfs/|{{AUR|adbfs-git}}}}
 +
* {{App|cddfs|Mount audio CDs.|http://castet.matthieu.free.fr/|{{AUR|cddfs}}{{Broken package link|{{aur-mirror|cddfs}}}}}}
 +
* {{App|fuseiso|Mount an ISO as a regular user.|http://sourceforge.net/projects/fuseiso/|{{Pkg|fuseiso}}}}
 +
* {{App|vdfuse|Mounting VirtualBox disk images (VDI/VMDK/VHD).|https://github.com/muflone/virtualbox-includes|{{AUR|vdfuse}}}}
 +
* {{App|wiifuse|Mount a Gamecube or Wii DVD disc image read-only.|http://wiibrew.org/wiki/Wiifuse|{{AUR|wiifuse}}{{Broken package link|{{aur-mirror|wiifuse}}}}}}
 +
* {{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|zfs-fuse|[[ZFS_on_FUSE|ZFS support via FUSE]].|http://zfs-fuse.net/|{{AUR|zfs-fuse}}{{Broken package link|{{aur-mirror|zfs-fuse}}}}}}
 +
* {{App|[[EncFS]]|EncFS is a userspace stackable cryptographic file-system.|https://vgough.github.io/encfs/|{{Pkg|encfs}}}}
 +
* {{App|[[gitfs]]|gitfs is a FUSE file system that fully integrates with git.|https://www.presslabs.com/gitfs/|{{Aur|gitfs}}}}
 +
 
 +
See [[Wikipedia:Filesystem in Userspace#Example uses]] for more.
 +
 
 +
=== Special purpose file systems ===
 +
 
 +
* {{App|[[Wikipedia: cramfs|CramFS]]|'''Compressed ROM filesystem''' is a read only filesystem designed with simplicity and efficiency in mind. Its maximum file size is less 16MB and the maximum file system size is around 272MB.|http://sourceforge.net/projects/cramfs/|{{Pkg|util-linux}}}}
 +
* {{App|[[eCryptfs]]|'''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|[[Wikipedia: SquashFS|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/|{{Pkg|squashfs-tools}}}}
 +
 
 +
== Create a file system ==
  
== Format a device ==
+
{{Expansion|It is also possible to create a file system on an actual file, e.g. to access VMs from the host}}
 +
{{Note|
 +
* If you want to change the partition layout, see [[Partitioning]].
 +
* If you want to create a swap partition, see [[Swap]].
 +
}}
  
{{Warning|formatting a device removes everything on it, make sure to backup everything you want to keep.}}
+
=== Identify the devices ===
  
=== Requirements ===
+
{{Merge|Partitioning|You also need to know device names before partitioning the drive}}
  
Before starting, you need to know which name Linux gave to your device. Hard drives and USB sticks show up as {{ic|/dev/sd''x''}}, where "x" is a lowercase letter, while partitions show up as {{ic|/dev/sd''xY''}}, where "Y" is a number.
+
The first step is to identify the devices where the new system will be installed. The following command will show all the available devices:
  
If the device you want to format is mounted, it will show up in the ''MOUNTPOINT'' column from:
+
# lsblk
  
$ lsblk
+
This will list all devices connected to your system along with their partition schemes. On [[installation]], this includes those used to host and boot live Arch media, such as a USB drive. Not all devices listed are therefore viable or appropriate mediums for installation; results ending in {{ic|rom}}, {{ic|loop}} or {{ic|airoot}} can be ignored.
  
If your device is not mounted:
+
Devices (e.g. hard disks) will be listed as {{ic|sd'''x'''}}, where {{ic|'''x'''}} is a lower-case letter starting from {{ic|a}} for the first device ({{ic|sda}}), {{ic|b}} for the second device ({{ic|sdb}}), and so on. ''Existing'' partitions on those devices will be listed as {{ic|sdx'''Y'''}}, where {{ic|'''Y'''}} is a number starting from {{ic|1}} for the first partition, {{ic|2}} for the second, and so on. In the example below, only one device is available ({{ic|sda}}), and that device has only one partition ({{ic|sda1}}):
  
  # mount /dev/sd''xY'' /some/directory
+
  NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
 +
sda              8:0    0    80G  0 disk
 +
└─sda1            8:1    0    80G  0 part
  
And to unmount it, you can use ''umount'' on the directory you mounted the disk on:
+
{{Note|Usually filesystems are created on a partition, but they can also be created inside of logical containers like [[LVM]], [[RAID]], or [[dm-crypt]].}}
  
# umount /some/directory
+
=== Formatting ===
  
{{Note|Your device must be unmounted to format and create a new file system.}}
+
To create a new filesystem on a partition, the existing filesystem located on the partition must not be mounted. If the partition you want to format contains a mounted filesystem, it will show up in the ''MOUNTPOINT'' column of lsblk.
  
Manipulate the partition table as you like. For that you can use '''fdisk''' for MBR or '''gdisk''' for GPT or [[#GUI tools|GUI tools]]. See [[partitioning]] for more information.
+
To unmount it, you can use ''umount'' on the directory where the filesystem was mounted to:
  
Now you can create new file systems through console tools or graphic interface tools.
+
# umount /mountpoint
  
=== Console tools ===
+
To create a new file system of type ''fstype'' on a partition do:
  
To create a file system you just have to use '''mkfs''':
+
{{Warning|After creating a new filesystem, data previously stored on this partition can likely not be recovered. Make a backup of any data you want to keep.}}
  
  # mkfs -t ext4 /dev/''<partition>''
+
  # mkfs.''fstype'' /dev/''partition''
  
As '''mkfs''' is just a unified front-end for the different {{ic|mkfs.''fstype''}} tools.
+
See the article in [[#Types of file systems]] corresponding to file system you wish to create for the exact command as well as userspace utilities you may wish to install for a particular file system.
  
To create a swap file system, use '''mkswap''':
+
For example, to create a new file system of type [[ext4]] on a partition do:
  
  # mkswap /dev/''<partition>''
+
  # mkfs.ext4 /dev/''partition''
  
=== GUI tools ===
+
== See also ==
  
There are several GUI tools for partition management:
+
* [[wikipedia:Comparison of file systems]]
* {{App|[[Gparted]]|GTK+ Partition Magic clone, frontend to GNU Parted.|http://gparted.sourceforge.net|{{Pkg|gparted}}}}
+
* {{App|gnome-disk-utility|Disk management utility for GNOME.|http://www.gnome.org|{{Pkg|gnome-disk-utility}}}}
+
* {{App|KDE Partition Manager|KDE utility that allows you to manage disks, partitions, and file systems.|https://sourceforge.net/projects/partitionman/|{{AUR|partitionmanager}}}}
+

Latest revision as of 13:39, 26 August 2016

From Wikipedia:

A file system (or filesystem) is a means to organize data expected to be retained after a program terminates by providing procedures to store, retrieve and update data, as well as manage the available space on the device(s) which contain it. A file system organizes data in an efficient manner and is tuned to the specific characteristics of the device.

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.

Before being formatted, a drive should be partitioned.

Types of file systems

  • Btrfs — the B-tree file system is "a new copy on write (CoW) filesystem for Linux aimed at implementing advanced features while focusing on fault tolerance, repair and easy administration." [1] These features include snapshots, multi-disk striping and mirroring (software RAID without mdadm), checksums, incremental backup, and on-the-fly compression that can give a significant performance boost as well as save space. It has been merged into the mainline kernel Btrfs and is considered stable. [2] Btrfs appears to be the future of GNU/Linux filesystems and is offered as a root filesystem option in all major distribution installers.
  • exFATMicrosoft file system optimized for flash drives. Like NTFS, exFAT can pre-allocate disk space for a file by just marking arbitrary space on disk as 'allocated'.
  • ext2Second Extended Filesystem is an established, mature GNU/Linux filesystem that is very stable. A drawback is that it does not have journaling support or barriers. Lack of journaling can result in data loss in the event of a power failure or system crash. It may also be not convenient for root (/) and /home partitions because file-system checks can take a long time. An ext2 filesystem can be converted to ext3.
  • ext3Third Extended Filesystem is essentially the ext2 system with journaling support and write barriers. It is backward compatible with ext2, well tested, and extremely stable.
  • ext4Fourth Extended Filesystem is a newer filesystem that is also compatible with ext2 and ext3. It provides support for volumes with sizes up to 1 exabyte (i.e. 1,048,576 terabytes) and files sizes up to 16 terabytes. It increases the 32,000 subdirectory limit in ext3 to unlimited. It also offers online defragmentation capability.
  • F2FSFlash-Friendly File System is a flash file system created by Kim Jaegeuk (Hangul: 김재극) at Samsung for the Linux operating system kernel. The motivation for F2FS was to build a file system that from the start takes into account the characteristics of NAND flash memory-based storage devices (such as solid-state disks, eMMC, and SD cards), which have been widely being used in computer systems ranging from mobile devices to servers.
  • HFSHierarchical File System is a proprietary file system developed by Apple Inc. for use in computer systems running Mac OS.
  • JFS — IBM's Journaled File System was the first filesystem to offer journaling. It had many years of development in the IBM AIX® operating system before being ported to GNU/Linux. JFS makes the smallest demand on CPU resources of any GNU/Linux filesystem. It is very fast at formatting, mounting, and filesystem checks (fsck). JFS offers very good all-around performance especially in conjunction with the deadline I/O scheduler. It is not as widely supported as the ext series or ReiserFS, but still very mature and stable.
  • MINIX File SystemMINIX File System is the native filesystem of the MINIX operating system, both of which were designed by Andrew S. Tanenbaum. The Linux kernel provides read/write support for version 1, 2 and 3 of the MINIX filesystem.
  • NILFS2New Implementation of a Log-structured File System was developed by NTT. It records all data in a continuous log-like format that is only appended to and never overwritten. It is designed to reduce seek times and minimize the type of data loss that occurs after a crash with conventional Linux filesystems.
  • NTFSFile system used by Windows. NTFS has several technical improvements over FAT and HPFS (High Performance File System), such as improved support for metadata, and the use of advanced data structures to improve performance, reliability, and disk space utilization, plus additional extensions, such as security access control lists (ACL) and file system journaling.
  • Reiser4Successor to the ReiserFS file system, developed from scratch by Namesys and sponsored by DARPA as well as Linspire, it uses B*-trees in conjunction with the dancing tree balancing approach, in which underpopulated nodes will not be merged until a flush to disk except under memory pressure or when a transaction completes. Such a system also allows Reiser4 to create files and directories without having to waste time and space through fixed blocks.
  • ReiserFSHans Reiser's high-performance journaling FS (v3) uses a very interesting method of data throughput based on an unconventional and creative algorithm. ReiserFS is touted as very fast, especially when dealing with many small files. ReiserFS is fast at formatting, yet comparatively slow at mounting. Quite mature and stable. ReiserFSv3 is not being actively developed at this time. Generally regarded as a good choice for /var.
  • VFATVirtual File Allocation Table is technically simple and supported by virtually all existing operating systems. This makes it a useful format for solid-state memory cards and a convenient way to share data between operating systems. VFAT supports long file names.
  • XFSEarly journaling filesystem originally developed by Silicon Graphics for the IRIX operating system and ported to GNU/Linux. It provides very fast throughput on large files and filesystems and is very fast at formatting and mounting. Comparative benchmark testing has shown it to be slower when dealing with many small files. XFS is very mature and offers online defragmentation capability.
  • ZFSCombined file system and logical volume manager designed by Sun Microsystems. The features of ZFS include protection against data corruption, support for high storage capacities, integration of the concepts of filesystem and volume management, snapshots and copy-on-write clones, continuous integrity checking and automatic repair, RAID-Z and native NFSv4 ACLs.

Journaling

All the above filesystems with the exception of ext2, FAT16/32, 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. It should be noted that reiser4 does not provide an equivalent to ext4's default journaling behavior (meta-data only).

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.

Arch Linux support

  • btrfs-progsBtrfs support.
http://btrfs.wiki.kernel.org/ || btrfs-progs
  • dosfstools — VFAT support.
https://github.com/dosfstools/dosfstools || dosfstools
  • exfat-utils — exFAT support.
https://github.com/relan/exfat || exfat-utils
  • f2fs-toolsF2FS support.
https://git.kernel.org/cgit/linux/kernel/git/jaegeuk/f2fs-tools.git || f2fs-tools
  • e2fsprogs — ext2, ext3, ext4 support.
http://e2fsprogs.sourceforge.net || e2fsprogs
  • hfsprogs — HFS support.
http://www.opensource.apple.com || hfsprogs
  • jfsutilsJFS support.
http://jfs.sourceforge.net || jfsutils
  • nilfs-utils — NILFS support.
http://nilfs.sourceforge.net/ || nilfs-utils
  • ntfs-3gNTFS support.
http://www.tuxera.com/community/ntfs-3g-download/ || ntfs-3g
http://sourceforge.net/projects/reiser4/ || reiser4progsAUR
  • reiserfsprogs — ReiserFSv3 support.
https://www.kernel.org/ || reiserfsprogs
  • xfsprogsXFS support.
http://oss.sgi.com/projects/xfs/ || xfsprogs
  • zfsZFS support.
http://zfsonlinux.org/ || zfs-linuxAUR, zfs-linux-gitAUR

FUSE-based file systems

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.

Some FUSE-based file systems:

  • acd-fuse — FUSE filesystem driver for Amazon's Cloud Drive.
https://github.com/handyman5/acd_fuse || acdfuse-gitAUR[broken link: archived in aur-mirror]
  • adbfs-git — Mount an Android device filesystem.
http://collectskin.com/adbfs/ || adbfs-gitAUR
  • cddfs — Mount audio CDs.
http://castet.matthieu.free.fr/ || cddfsAUR[broken link: archived in aur-mirror]
  • fuseiso — Mount an ISO as a regular user.
http://sourceforge.net/projects/fuseiso/ || fuseiso
  • vdfuse — Mounting VirtualBox disk images (VDI/VMDK/VHD).
https://github.com/muflone/virtualbox-includes || vdfuseAUR
  • wiifuse — Mount a Gamecube or Wii DVD disc image read-only.
http://wiibrew.org/wiki/Wiifuse || wiifuseAUR[broken link: archived in aur-mirror]
  • xbfuse-git — Mount an Xbox (360) ISO.
http://multimedia.cx/xbfuse/ || xbfuse-gitAUR
  • xmlfs — Represent an XML file as a directory structure for easy access.
https://github.com/halhen/xmlfs || xmlfsAUR
http://zfs-fuse.net/ || zfs-fuseAUR[broken link: archived in aur-mirror]
  • EncFS — EncFS is a userspace stackable cryptographic file-system.
https://vgough.github.io/encfs/ || encfs
  • gitfs — gitfs is a FUSE file system that fully integrates with git.
https://www.presslabs.com/gitfs/ || gitfsAUR

See Wikipedia:Filesystem in Userspace#Example uses for more.

Special purpose file systems

  • CramFSCompressed ROM filesystem is a read only filesystem designed with simplicity and efficiency in mind. Its maximum file size is less 16MB and the maximum file system size is around 272MB.
http://sourceforge.net/projects/cramfs/ || util-linux
  • eCryptfsEnterprise 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
  • SquashFSSquashFS 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

Create a file system

Tango-view-fullscreen.pngThis article or section needs expansion.Tango-view-fullscreen.png

Reason: It is also possible to create a file system on an actual file, e.g. to access VMs from the host (Discuss in Talk:File systems#)
Note:
  • If you want to change the partition layout, see Partitioning.
  • If you want to create a swap partition, see Swap.

Identify the devices

Merge-arrows-2.pngThis article or section is a candidate for merging with Partitioning.Merge-arrows-2.png

Notes: You also need to know device names before partitioning the drive (Discuss in Talk:File systems#)

The first step is to identify the devices where the new system will be installed. The following command will show all the available devices:

# lsblk

This will list all devices connected to your system along with their partition schemes. On installation, this includes those used to host and boot live Arch media, such as a USB drive. Not all devices listed are therefore viable or appropriate mediums for installation; results ending in rom, loop or airoot can be ignored.

Devices (e.g. hard disks) will be listed as sdx, where x is a lower-case letter starting from a for the first device (sda), b for the second device (sdb), and so on. Existing partitions on those devices will be listed as sdxY, where Y is a number starting from 1 for the first partition, 2 for the second, and so on. In the example below, only one device is available (sda), and that device has only one partition (sda1):

NAME            MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda               8:0    0    80G  0 disk
└─sda1            8:1    0    80G  0 part
Note: Usually filesystems are created on a partition, but they can also be created inside of logical containers like LVM, RAID, or dm-crypt.

Formatting

To create a new filesystem on a partition, the existing filesystem located on the partition must not be mounted. If the partition you want to format contains a mounted filesystem, it will show up in the MOUNTPOINT column of lsblk.

To unmount it, you can use umount on the directory where the filesystem was mounted to:

# umount /mountpoint

To create a new file system of type fstype on a partition do:

Warning: After creating a new filesystem, data previously stored on this partition can likely not be recovered. Make a backup of any data you want to keep.
# mkfs.fstype /dev/partition

See the article in #Types of file systems corresponding to file system you wish to create for the exact command 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 on a partition do:

# mkfs.ext4 /dev/partition

See also