Friday, October 16, 2009

Managing Linux Filesystems

To Unix systems, a filesystem is a device (such as a partition) that is formatted to store files. Filesystems can be found on hard drives, floppies, CD-ROMs, USB drives, or other storage media that permit random access.

The exact format and means by which the files are stored are not important; the system provides a common interface for all filesystem types that it recognizes. By default, almost all modern distributions of Linux use a journaling filesystem. When the kernel interacts with a journalling filesystem, writes to disk are first written to a log or journal before they are written to disk. This slows down writes to the filesystem, but reduces the risk of data corruption in the event of a power outage. It also speeds up reboots after a system unexpectedly loses power.

Most current Linux distributions default to the Third Extended (ext3) Filesystem. The ext3 filesystem was developed primarily for Linux and supports 256-character filenames and 4-terabyte maximum filesystem size. This ext3 filesystem is essentially a Second Extended (ext2) filesystem with an added journal. Since it is in all other ways identical to the ext2 system, it is both forward- and backward-compatible with ext2—all ext2 utilities work with ext3 filesystems.

Although not covered in this edition of Linux in a Nutshell, Linux supports other open source journaling filesystems including: IBM’s Journaled Filesystem (JFS), SGI’s Extensible Filesystem (XFS), and the Naming System Venture’s Reiser Filesystem (ReiserFS). In some situations these can be faster than ext3. Some Linux distributions use these alternative filesystems by default. Other common filesystems include the FAT and VFAT filesystems, which allow files on partitions and floppies of Microsoft Windows systems to be accessed under Linux, and the ISO 9660 filesystem used by CD-ROMs.

Common Command about Managing Filesystems

debugfs Debug ext2 filesystem.
dosfsck Check and repair a DOS or VFAT filesystem.
dump Back up data from a filesystem.
dumpe2fs Print information about superblock and blocks group.
e2fsck Check and repair an ext2 filesystem.
e2image Store disaster-recovery data for an ext2 filesystem.
e2label Label an ext2 filesystem.
edquota Edit filesystem quotas with vim.
fdformat Format floppy disk.
fsck Another name for e2fsck.
fsck.ext2 Check and repair an ext2 filesystem.
mke2fs Make a new ext2 filesystem.
mkfs Make a new filesystem.
mkfs.ext2 Another name for mke2fs.
mkfs.ext3 Yet another name for mke2fs.
mklost+found Make lost+found directory.
mkraid Set up a RAID device.
mkswap Designate swapspace.
mount Mount a filesystem.
quotacheck Audit stored quota information.
quotaon Enforce quotas.
quotaoff Do not enforce quotas.
quotastats Display kernel quota statistics.
rdev Describe or change values for root filesystem.
repquota Display quota summary.
resize2fs Enlarge or shrink an ext2 filesystem.
restore Restore data from a dump to a filesystem.
rootflags List or set flags to use in mounting root filesystem.
setquota Edit filesystem quotas.
showmount List exported directories on a remote host.
swapoff Cease using device for swapping.
swapon Begin using device for swapping.
sync Write filesystem buffers to disk.
tune2fs Manage an ext2 filesystem.
umount Unmount a filesystem.
warnquota Mail disk usage warnings to users.

Source of Information : OReilly Linux in a Nutshell 6th Edition

No comments: