All disk and filesystem maintenance has to be by the user named root. You can become root temporarily with the su command, but it is probably always better to logout as idl and login again as root, so that you will not inadvertantly have things going on that may interfere with disk maintenance.
Generally, we only do disk maintence as described below on the data disks, not on the system disk (/). Our recent experience with the large (~500 Gbyte) data disks suggests that we should do disk maintenance every couple of weeks.
The HARDWARE disk devices on linux are called something like /dev/hda1 or /dev/sda1 or /dev/sdb1, etc. These disk DEVICES must be mounted onto directory names (folder names) in the filesystem in order for you to look at the files. (The system administrator has previously created partitions on these disks and installed a filesystem on each partition that he wants to use. The native linux filesystem is called ext2 or ext3.) Typically the data disk devices are mounted on a folder in the root (/) directory that iscalled by a one-letter name, such as /p /q/ /r /a /b, etc.
In order to mount
a hardware disk device on a directory, so that you will be able to access the
files, you must execute the 'mount' command. If the disk is listed in the filesystem
table (/etc/fstab), you can mount the disk merely by typing
mount /disk-name where disk-name is /a or /b or something similar.
You can view the filesystem
table by typing
Don't edit this table unless you REALLY know what you are doing; that is the job of the system manager.
Normally, the machine automatically mounts all the disks listed in fstab when it boots up.
To see what disks are mounted, type
df -h (the -h means 'human', so it gives sizes in some human-readable unit like Gigabytes)
This lists only the mounted devices, not the ones that are in the fstab but are not yet mounted.
The unmount command is called 'umount' and you can unmount a disk by typing
umount /disk-name where disk-name is /a or /b or something similar.
The following paragraphs assume that /dev/sda1 is mounted on /a
the linux hard drives using the filesystem check command e2fsck. It is NECESSARY
to unmount a disk before checking its filesystem. To check the filesystem of disk
/a quickly (assuming that /dev/sda1 has been mounted on /a), first unmount it
and then check it by typing
/sbin/e2fsck -f /dev/sda1
This will let you fix up errors in the existing filesystem that is mounted on that device. It takes only a few minutes. After you are finished, if you want to use the disk (which should be fine if the e2fsck command finds no errors), just mount the disk again and it can be used.
The normal disk
maintenance that should be done erery few weeks is to check the disk device thoroughly
and to scan it for bad blocks and add any bad blocks that are found to the bad-block
list on the disk. First (assuming that data disk /dev/sda1 has been mounted on
/a) unmount it with umount /a and then use
/sbin/e2fsck -f -cc -k /dev/sda1
The -f option forces it to check even if no errors had previously been reported. The -cc option does a read-write test for bad blocks. And the -k option adds any bad blocks that were found to the earlier lists of bad blocks, so that they won't be used or cause further errors. This command takes about 8 hours for a 400 Gbyte disk. It takes no longer to do it at the same time on multiple disks. After this has run (usually overnight), the disk can be mounted again for use.
More information on any of the commands can
be found by typing
man command-name (eg man e2fsck for the filesystem consistency check command)