A filesystem is Linux's mechanism for organizing the contents of the various types of mass storage (e.g., hard disk, floppy disk, or CD-ROM) and presenting them to the user. To better understand the applicable commands, the following cursory description of the structure of a filesystem is presented next (see also the diagram in Figure 12-1).
The boot block contains information necessary for Linux to access the filesystem. The superblock contains information about the structure of the filesystem itself (length, size, and location of the inode tables; usage information; size of the cylinder groups). The inode list is a collection of data structures which contain information about individual files within the system. Data blocks are fixed-length sections of disk space used for storing the actual information within the files.
We speak of filesystems being either mounted or unmounted, depending on whether or not the disk space they represent is currently available for use. At boot time, the init process tries to mount those filesystems specified for automounting in the /etc/fstab file. If you have root privileges, you can mount and unmount those (and any other existing filesystems) at will, provided that they are not currently in use.
Mounted filesystems are arranged in a hierarchy rooted at the "/" directory. This hierarchy is more commonly referred to as the directory tree.
Filesystems may be of different types, depending on the information they contain. For example, although the most common type is ext2, you might use a filesystem of type msdos to access MS-DOS files.
Some important properties of filesystems are:
mount point | The point in the directory tree at which the filesystem is attached (e.g., /tmp, /home, /usr/local). |
type | One of: minix, ext, ext2, xiafs, hpfs, msdos, umsdos, vfat, proc, nfs, iso9660, smbfs, ncpfs, affs, ufs, romfs, sysv, xenix, coherent. |
device name | The device file which corresponds to a given filesystem (e.g., /dev/hda1 or /dev/sda2 ). |
The following commands are covered in this section:
Debugfs | Inspect and possibly debug a filesystem. |
Df | Display information about filesystems. |
dumpe2fs | Superblock and group information for an e2fs. |
e2fsck | Consistency check on an e2fs. |
fsck | Consistency check on a filesystem. |
fsck.minix | Consistency check on a minix filesystem. |
fuser | Process id's of processes using the specified filesystems. |
lsattr | List attributes of files on filesystem. |
lsof | List open files. |
mke2fs | Make e2fs filesystem. |
mkfs | Make filesystem. |
mkfs.minix | Make minix filesystem. |
mklost+found | Make lost+found directory on current filesystem. |
mkswap | Create swap space on a device. |
mount | Mount the current filesystem. |
rdev | Display root device. |
swapoff | Disable swapping. |
swapon | Enable swapping. |
sync | Write out buffered memory. |
tune2fs | Tweak e2fs filesystem parameters. |
umount | Unmount a filesystem. |