The Filesystem Tree

The Unix and Linux filesystem is based on the Filesystem Heirarchy Standard (FHS). (You can research it at .)

There are no C: drives, D: drives or any other lettered drives. Instead, all disks are mounted into a common filesystem tree. You can even mount other computers into this tree. Everyone shares the same filesystem (which is why permissions are so important).

Common Unix/Linux Directories
/ Call this “the root of the filesystem” (which it is), not the “root directory” (which you’ll see listed below: /root).
/bin “Binaries” – actually both binaries and scripts – very basic commands available to all users
/boot Kernel and boot loader files
/dev Device files
/etc Configuration files
/home Users’ homes
/lib Shared libraries, called shared objects in Unix, with a .so extension
/mnt An empty directory, allowing creation of subdirectories for mounting CDs, floppies, etc.
/opt Optional, additional software (usually on the server in NFS networks)
/proc A virtual directory that holds process and kernel information
/root root’s home
/sbin System binary commands, used by administrators
/tmp Temporary files

The vast majority of commands/utilities available to all users, often divided into:


/usr/local Optional, additional software (usually installed on a local workstation in an NFS network)
/var Log files, spoolers, email


See the Partitioning section of the Installation page for information about setting up partitions.


Filesystem Types

See the excellent Novell page, File System Primer, at

Review the list on the page above, then note these filesystems not included in the Novell list:

Additional Unix/Linux Filesystems
bfs Boot filesystem – used at startup on most Unix systems
cdfs Compact Disk filesystem – one way to access CD data as normal files
iso9660 “The” CD-ROM filesystem, based on an ISO standard
udf Universal Disk Format filesystem – used during the creation and burning of CDs
minix The original proto-Linux filesystem
msdos FAT 16-bit filesystem (not FAT32)
vfat FAT compatible filesystem with long filename support
VxFS HP-UX filesystem


For a more comprehensive list of filesystem types, see Guide to Linux Filesystem Mastery by Sheryl Calish at

Learn about Journaling File Systems from Steve Best’s article at

Tuning Filesystems for Performance

Journaling File Systems in particular benefit from performance tuning: See Steve Best’s article “Tuning Journaling File Systems” at


Formatting (Making A Filesystem)

Formatting a Floppy Disk

You’re likely to need to make a file system on (format) a floppy, if it’s new (is there still such a thing?). Use the mkfs command. For a “Linux-only” floppy, you could use ext2 as your file system:

mkfs -t ext2 /dev/fd0

If it needs to be usable under Windows, use FAT instead:

mkfs -t msdos /dev/fd0

If you don’t specify, you’ll get ext2:

mkfs /dev/fd0


Formatting a Partition (creating a filesystem)

Filesystem Creation Commands
mkfs Makes filesystems of most types mkfs -t ext2
Create a DOS FAT filesystem mkdosfs /dev/fd0
Creates an ext2 filesystem mkfs.ext2 /dev/hda2
mke2fs -j
Create an ext3 (journaled) filesystem mkfs.ext3 /dev/hda2
mkisofs Creates a CD-ROM filesystem mkisofs -o iso_file starting_directory
Creata a REISERFS filesystem mkreiserfs /dev/hda3


Tuning Filesystems

ext2 and ext3

Use tune2fs to “adjust tunable filesystem parameters” on ext2 and ext3 filesystems. These include:

  • The number of mounts between filesystem checks
  • The maximum time between filesystem checks
  • Set the volume label
  • Reserve blocks for the filesystem or by group
  • Add journaling, which turns an ext2 filesystem into an ext3 filesystem.

    See man tune2fs for details before using this command.


Checking Filesystems


fsck is the generic filesystem check utility. There are actually whole families of filesystem check utilities, specific to certain filesystems. fsck is actually a “pass-through” utility that invokes the filesystem-specific checkers, which have names like fsck.fstype.

See a typically excellent page at

for a simple rundown. Of course see man fsck for full details (which will refer you through to filesystem-specific details).


fsck wants you to provide a filesystem type. If you don’t it assumes ext2.

fsck -t ext3 /dev/hda1

Filesystem-specific Check Commands
e2fsck Checks ext2 and ext3 filesystems e2fsck /dev/fd0
e2fsck -c
Checks ext2 and ext3 filesystems for bad blocks badblocks /dev/fd0
e2fsck -c /dev/fd0
reiserfsck Checks REISERFS filesystems reiserfsck /dev/hdc1
reiserfsck -c Checks REISERFS filesystems for bad blocks reiserfsck -c /dev/hdc1
mkisofs Creates a CD-ROM filesystem mkisofs -o iso_file starting_directory
Creata a REISERFS filesystem mkreiserfs /dev/hda3


fsck only performs a quick check unless you specify the -f “full” option:

fsck -f -t ext3 /dev/hda1

Common fsck Options
-f Full check
-a Automatically repair errors
-A Check all filesystems marked with a 1 or 2 in /etc/fstab
-Cf Do a full check and display progress line
-AR Check all filesystems marked with a 1 or 2 in /etc/fstab, except the / filesystem
-V Verbose output


Note that you can only check unmounted filesystems. Be particularly clear that you can’t fsck the root filesystem while it’s mounted (that is, while your system’s running). (See – search for fsck when you arrive.)

While the defaults can vary, an ext2 or ext3 filesystem will force a check every 20-40 mounts (which usually means reboots), or every 180 days, whichever comes first. This is one place you can use tune2fs:

tune2fs -i 90d /dev/fd0

The command above, for instance, changes the check interval to 90 days (90d). You can use seconds (the default), days (d), weeks (w) or months (m). A setting of 0 disables interval-based testing.


If fsck can’t repair a file, it places it in the lost+found directory, giving the file its inode number for its name.


Monitoring Filesystems

Disk Usage

The df (disk free space) command is the first tool to know. It gives you a fast audit of free space. Use it by itself:


or with human-readable output:

df -h

in HP-UX:



Perhaps more useful is the du (directory usage) command. Specify a directory to analyse:

du /usr

Or just get a summary:

du -s /usr

Make it human-readable:

du -hs /usr


Check used and available inodes on ext2 and ext3 filesystems with dumpe2fs. To keep it readable, always use the -h option:

dumpe2fs -h /dev/hda1