中文网站
  Advanced Search
Read the latest Blogs from IT professionals in the field. Read and write community created documents. Need IT help? Ask our staff. Connect with your peers. Check our Tech Shop for posters, books and software tools. Home

Unix/Linux File System Structure and Management

The Filesystem Hierarchy Standard (FHS) was developed in early 1996 for all Unix-like systems. The FHS is maintained by the Free Standards Group, a non-profit organization consisting of major software and hardware vendors, such as HP, Red Hat, IBM and Dell. Still, the vast majority of the Linux distributions, including those developed by members of the Free Standards Group, do not follow this proposed standard 100%. In particular, paths specifically created by the FHS editors, such as /srv/, do not see widespread usage. Some Linux systems reject the FHS in favor of a different approach, as in GoboLinux. Since the FHS began as a Linux initiative, other UNIX and Unix-like operating systems generally completely ignore it in favor of their own systems, which sometimes vary wildly -- for example, Mac OS X uses names such as /Library/, /Applications/, and /Users/ in tandem with its traditional UNIX directory hierarchy.

In the FHS all files and directories appear under the root directory "/", even if they are stored on different physical devices. Note however that some of these directories may or may not be present on a Unix system depending on whether certain subsystems, such as the X Window System, are installed.
The majority of these directories exist in all UNIX operating systems and are generally used in much the same way; however, the descriptions here are those used specifically for the FHS, and are not considered authoritative for platforms other than Linux.

Unix/Linux Filesystem Structure

Unix/Linux Filesystem Management Commands

Command Description
debugfs Allows direct access to filesystems data structure.
df Shows the disk free space on one or more filesystems.
dosfsck Check and repair MS-Dos filesystems.
du Shows how much disk space a directory and all its files contain.
dump Used to back up an ext2 filesystem. Complement is restore.
dumpe2fs Dump filesystem superblock and blocks group information. Ex: dumpe2fs /dev/hda2
e2fsck Check a Linux second extended filesystem.
e2label Change the label on an ext2 filesystem.
exportfs Used to set up filesystems to export for nfs (network file sharing).
fdisk Used to fix or create partitions on a hard drive.
fdformat Formats a floppy disk.
fsck Used to add new blocks to a filesystem. Must not be run on a mounted file system.
hdparm Get/set hard disk geometry parameters, cylinders, heads, sectors.
Mkfs Initializes a Linux filesystem. This is a front end that runs a separate program depending on the filesystem's type.
mke2fs Create a Linux second extended filesystem.
mkswap Sets up a Linux swap area on a device or file.
Mount Used to mount a filesystem. Complement is umount.
Rdev Query/set image root device, swap device, RAM disk size of video mode.
Rdump Same as dump.
Restore Used to restore an ext2 filesystem.
setfdprm Set floppy drive parameters.
Swapoff Used to de-activate a swap partition.
Swapon Used to activate a swap partition.
Sync Forces all unwritten blocks in the buffer cache to be written to disk.
tune2fs Adjust tunable filesystem parameters on second extended filesystems.
Umount Unmounts a filesystem. Complement is mount.