Saturday, January 30, 2010

Unmounting & file system checking

Click Here For Free Windows Downloads
mywindowsdownloads.blogspot.com

Click here for all Free Linux Downloads



Blog address for Linux in Hindi

umount

Sometimes it is required to unmount a directory. For example, Linux doesn’t open the tray of CD drive unless you unmount it. For this, you can use one of the following commands:


# umount /mnt/cdrom
# umount /media/cdrecorder

# umount /dev/sda1

# umount /home/mydisk


Mount and Remount

One of many options in Linux rescue mode is to mount file system, as root ( / ), is read only mode. Or, you may like to mount a file system with programs as /usr in read only mode. For this, you will have to change /etc/fstab file and reboot the system. However, you can check for changes firstly by remounting the directory with required options. For example, if you like to remount /usr directory in read-write mode, you can use the following command:

# mount -o remount,rw /usr


Or if you like to remount / (root) directory in read only mode, you can use the following command:


# mount -o remount,ro /



The above changes remain applied until you reboot the Linux system. For making the changes permanent you will have to edit /etc/fstab file, using any of the text editor command, like vi.



Troubleshooting with fsck


The fsck command is one important tool, used by Linux to automatically check for the partitions on the system. If your Linux system has trouble in mounting any particular partition, file system integrity check fails in some way. In either case you will have to check for failed operation using fsck.

This command can check and repair the Linux file system. fsck command runs the desired dedicated commands for specific file system, like fsck.ext2, fsck.ext3 or fsck.reiserfs, in background.


Note:
We should not run fsck command on the mounted partition, as it may lead to file system damage.

Switches with fsck command

Switch Details

-A Checks for all the file systems listed in /etc/fstab
-a Automatically repairs the file system without prompting
-R With –A option it will skip checking the root ( / ) file system.
-y It sets the default answer of “yes”, for any suggested solution.

No comments:

Post a Comment