File system

From LQWiki
Jump to navigation Jump to search

A file system is one particular way an operating system defines a user's files on a physical disk. What is represented on the disk is not a linear collection of files, placed one after the other, but extensive other data indicating structure and error correcting and other metadata stored alongside the files also - the way this metadata is stored comprises the file system.

About filesystems

When installing your Linux distribution there are a few options as to what filesystem to use. To many a newbie this option is of no consequence as they may not fully understand the relative pros and cons of each system. Hence, it is usually best to accept the distribution default, however this may not best suit the demands placed on your system or user needs.

The file hierarchy on a UNIX computer is usually a composite of several filesystems, held together by the 'master' filesystem VFS. This allows many different filesystems to meld together into one tree. For example, the CD filesystem ISO 9660 may be mounted in any directory on an ext3 partition and programs using the files will not know where one filesystem ends and the next begins. Similarly, files on remote computers may be mounted in directories on the local system, and from then on can be treated as if they were local.

List of filesystems

This list only gives a basic overview of which ones are available, detailed information should be found on the pages of the filesystem types itself.

Common

Journaling

Definiton: See Wikipedia

For users this mainly means no more long fsck checks at startup after a crash, power failure or some other major problem.

On the more technical side this means that the filesystem keeps track of data transactions by writing to a journal. It can either write the whole data or only the metadata. This means it can recover after a failure by reading the journal, which is a lot faster then scanning the whole disk like fsck does. Note however that there still can be some data loss.

  • Ext3 - Adds journaling to ext2 (You can switch between ext2 and ext3 by only remounting)
  • Ext4 - Backward-compatible with ext3 and ext2, making it possible to mount ext3 and ext2 as ext4.
  • ReiserFS - Uses a balanced tree to store filenames and files for very fast retrieval.
  • XFS - SGI's filesystem, originally from their IRIX OS
  • JFS - IBM's Journaled Filesystem.

Other OS

  • FAT-based
    • UMSDOS - A Unix-like filesystem on top of a FAT filesystem, basically allows you to install Linux on a FAT filesystem
    • FAT12/16/32 - Used in MSDOS versions
    • Windows FAT (vfat) - Similar to MSDOS FAT but adds support of long filenames
  • NTFS - New filesystem used in Windows NT,2000,XP
  • MINIX - Used by the MINIX OS and the first versions of Linux
  • UFS - Used by most BSD derivatives
  • HFS - Used by MacOS versions
  • NSS - Used by Novell NetWare for the on-disk storage (don't confuse it with the networked NCP)
  • befs/bfs - Used by BeOS

CD/DVD

  • ISO 9660 - Standard filesystem used on CD-ROMs
  • UDF - Filesystem for CD-RWs and DVDs that allows you to use it like a Harddisk, also knows as Packet writing or DirectCD.

Networked

  • NFS - Network Files Sharing, export directories and files to another system on a network.
  • SMB/CIFS - Standard network file sharing method used in MS Windows
  • NCP - Network filesystem protocol used by Novell NetWare clients and severs (uses the IPX network protocol).
  • Coda - Advanced network filesystem, supports disconnected operation, replication and more.
  • Intermezzo - Network filesystem which supports disconnected operation.
  • AFS - Andrew File System.

In memory or virtual

  • tmpfs - Filesystem that stores all files in virtual memory (mem+swap), dynamically allocates the used memory and every thing is lost on a umount (mainly used for POSIX shared memory on /dev/shm)
  • procfs - Provides information on the running system.
  • devfs - Filesystem that dynamically creates the special character and block device files (been depreciated in 2.6 kernels in favour of udev
  • devpts - virtual filesystem to support Unix98 PTY
  • hugetlbfs - Filesystem to help use huge memory pages supported on some CPU architectures (mmap-ing files on this FS gives you memory backed by huge pages).
  • sysfs - Provides information about the running system, introduced in kernel version 2.6 (Supposed to eventually replace procfs).

Misc.

  • romfs - Simple read-only filesystem, mainly used for initrd
  • cramfs - Similar to romfs, but uses zlib to compress data
  • lufs - Linux Userland Filesystem, allows the filesystem to be implemented in userspace
    • CARDFS
    • CEFS for mounting Windows CE devices
    • GNUTELLAFS Filesystem to use files from the Gnutella file sharing network directly.
    • ftpfs Allows mounting of remote ftp sites in local filesystem, so files on the ftp server can be used directly.
    • sshfs Allows mounting of remote sftp sites in local filesystem, so files on the sftp server can be used directly.
  • JFFS - A journaling file system specially designed for flashcards, does wear leveling to increase lifespan of flashmemory.
  • Btrfs - A B-Tree filesystem originally written by Oracle, now under GPL.

Choosing your filesystem

Stick with the default your distribution selects, which almost always is ext2/ext3, unless you really know what you are doing and have very specific requirements (like real-time multimedia editing, high volume web server or database, etc.).

Resize a filesystem

See also