Home > Articles

  • Print
  • + Share This

The Linux Filesystem

The Linux filesystem organizes files and directories into a hierarchical structure. A filesystem provides a way to store files that can be randomly accessed, including hard disk partitions, floppy disks, and CD-ROMs. Because tape drives are accessed sequentially, they do not contain a true filesystem. Some of the common filesystems, not all of which are Linux filesystems, are

  • Extended Filesystem—ext (Linux, has been replaced by ext2)

  • Fast Filesystem—ffs (Amiga)

  • HPFS Filesystem—hpfs (used with the OS/2 operating system; supported in real-mode only)

  • ISO9660 Filesystem—iso9660 (CD-ROM)

  • Linux Swap Filesystem—swap

  • Minix Filesystem—minix (Minix; this was the first filesystem used for Linux)

  • MS-DOS Filesystem—FAT16 msdos (DOS)

  • Network File System—nfs (Data is stored on any machine on a network and access is granted via the network)

  • Novell Filesystem—NCPFS (Novell servers)

  • NT Filesystem—NTFS (Windows NT)

  • proc Filesystem—proc (Virtual filesystem used by the Linux kernel to provide information to the user about processes)

  • Second Extended Filesystem—ext2 (Linux standard filesystem)

  • System V Filesystem—sysc (System V variants; commercial UNIX systems for PCs)

  • Uniform Filesystem—ufs (Used by BSD, SunOS, and NeXTstep; is supported in read-only mode)

  • UMSDOS Filesystem—umsdos (UNIX on MS-DOS; applied on top of a FAT16 filesystem to provide Linux functionality by creating special files; is slow)

  • Virtual FAT Filesystem—VFAT (an extension of the FAT filesystem to support long filenames)

  • Xenix Filesystem—xenix

  • Xia Filesystem—xiafs (An old filesystem; hardly used anymore)

Within the Linux filesystem, the partition or hard drive you are accessing is invisible. Instead, each partition or hard drive is shown relative to the root of the filesystem. The root is represented as /.

If you have the following partitions


and issue an ls / command, the directory listing will appear and the /var and /home filesystems will show up as subdirectories residing with the / directory, even though they are located on different partitions.


Now that you have created your partitions, you must create a filesystem on each one before you can install Linux. Creating a filesystem on your hard disk is similar to formatting a floppy. You create a filesystem by using the mkfs command. Its syntax is

mkfs -t fs-type device blocks

mkfs actually calls another command based on the type of filesystem you specify with the -t fs-type option. The various mkfs commands associated with specific filesystem types are shown in Table 3.3.

Table 3.3  Commands Associated with Specific Filesystem Types Called by the mkfs Utility


Filesystem Type


Create an ext2 filesystem; same as mke2fs


Create an MS-DOS filesystem


Create a Minix filesystem

You can use any of these commands instead of using the mkfs utility as a front end.

To create an ext2 filesystem on the first partition from the earlier example, you would issue the following command:

mkfs -t ext2 /dev/hda1 3686759 

The notes you took while doing the partitioning are used here because you must provide the mkfs utility with the number of blocks on the partition you are formatting. If you did not note those numbers, you can rerun the fdisk command and display your partition table to find them.

When creating a filesystem, be very careful to ensure the device and block arguments are correct. If you designate the wrong device, you can destroy data on another partition. If you pass the wrong number of blocks, you might actually format part of another partition and destroy any data that is there.

The options you can use with the mkfs utility are listed in Table 3.4.

Table 3.4  Options to Use with the mkfs Command



-t fs-type

Defines the type of filesystem to create


Displays all commands used to create the filesystem


Checks for bad blocks before creating the filesystem

-l filename

Uses the named file as a list of known bad blocks

You also can use the mkfs command to create a filesystem on a floppy drive; however, the fdformat command is a better choice. It performs a low-level format to create the sector and track information on the floppy. The syntax for the fdformat command is as follows:

fdformat [option] device

You can use the -n option to prevent verification of the format. Floppy devices are usually /dev/fd0 or /dev/fd1.

Key Concept

Before installing Linux, the disk must be prepared. You do this by creating your partitions, activating your swap partition, and designating the filesystem for each partition. After the partitions have been created, they must have a filesystem created by using the format command.

  • + Share This
  • 🔖 Save To Your Account

Related Resources

There are currently no related titles. Please check back later.