This section covers a list of commands related to filesystem maintenance.
fsck - check and repair a Linux filesystem
Main options:
use alternative superblck
check for bad blocks
force checking even when partition is marked clean
automatic repair
answer yes to all question
sync - flush filesystem buffers
Updates modified superblocks and inodes and executes delayed writes. The
operating system keeps data in RAM in order to speed up operations. This
may cause data to be lost in the event of a crash unless sync is executed.
Sync will simply call the sync system call.
Another way of doing this is to use the 'ALT+sysreq+s' key combination
hdparm - get/set hard disk paramters
The hdparm tool is used to control I/O options for ATA/IDE device drivers
The main options are
Get/set filesystem readahead. This is used to improve read performance by reading additonal disk blocks ahead of time.
Example:
hdparm -a /dev/hda /dev/hda: readahead = 256 (on)
Enable the "using_dma" flag for the drive. This almost always increases performance.
Example:
hdparm -d1 /dev/hda /dev/hda: setting using_dma to 1 (on) using_dma = 1 (on)
This option prints out the information about the current driver settings.
badblocks - search a device for bad blocks
It is recommended NOT to use badblocks directly
but to use the -c flag with fsck or
mkfs.
Main options:
block size
number of blocks tested at a time
file with a list of known bad blocks, these blocks will be skipped
output file, passed to mkfs
mke2fs - create an ext2/3 filesystem
Main options:
blocksize
number of bytes between consecutive inodes 'bytes-per-inode'
number of inodes
Percentage of blocks reserved for user
root
Check for bad blocks
Read bad blocks from file
Set a volume LABEL
Create journal
(ext3)
Optimise filesystem type, values are:
newsone inode per 4KB block
largefileone inode per megabyte
largefile4one inode per 4 megabytes
dumpe2fs - dump filesystem information
dumpe2fs prints the super block and blocks group information for the filesystem present on a device