Checking the filesystem
Since ext3 is a journaled filesystem it will never be labeled as dirty even if there are real problems. We can force the filesystem checks to be run at every boot and/or at periodic intervals. During the boot process the init script scans the list of devices in /etc/fstab, and then runs fsck (unless options on the filesystem instruct it otherwise).
Examine and change the properties of a filesystem using tune2fs [options] /dev/name
- here name is either
- sdXY for disk X, partition Y
- mdX for software raid partitions
- the name of logical volumes under LVM.
View parameters with “-l” option, there are four parameters of interest
- Mount Count: how many times the filesystem has been mounted since it was last checked
- Maximum Mount Count: run checks at every X mounts (CentOS defaults this value to -1, never gets checked)
- Last Checked: Date/time the last filesystem check was run
- Check Interval: How often should checks be run (CentOS default = 0, never gets checked)
Change the defaults to run checks on every boot or at 7 day intervals (you may want to stagger these so that not all filesystems are being checked simultaneously).
- Run fsck on every boot
tune2fs -c 1 /dev/VolGroup00/LogVol00 - Run fsck every 7 days
tune2fs -i 7d /dev/VolGroup00/LogVol00
Reclaiming some disk space
By default the filesystem reserves some space for root so normal users can never truly fill up a filesystem. This gives root some space to work in during times of crisis (ext3 by default reserves 5% for root). Details are provided by tune2fs
[root ~]# tune2fs -l /dev/VolGroup00/LV_Home |grep [Bb]lock\ count
Block count: 108797952
Reserved block count: 5439897
Preserving this extra 5% is necessary on / and /var but it seems to be overkill on really big filesystems. On my ~400GB /home filesystem (with a block size = 4096 bytes), the 5439897 reserved blocks are ~ 20 GB. To reserve only 1% space for root do
[root ~]# tune2fs -m1 /dev/VolGroup00/LV_Home
which will reclaim 4% (about 16GB) for normal users and leave root with 4GB of breathing room. To reserve less than 1% for root you need to calculate the number of blocks yourself and use the “-r” option.
No comments:
Post a Comment