Tips Linux Explorers   All Things Linux Forum   Great Linux Links   LinuxClues.com   Hometown   Email 



FILESYSTEMCHECK ( fsck ) 2


Here is one command of the previous Tip I would like to elaborate: fsck
If you have a corrupt file system ( Ext2/3 ) and you have to do a manual check and repair on it in “single user mode”, here are 4 ways how to do it:

1). If you are booting from Mandrake's Lilo the story is simple: choose option “failsafe” from the menu, this will boot you automatically, without any hassle, in “single user mode” ( you get an odd looking prompt like “sh-2.05b#” ) and you can do:

CODE
# fsck /dev/hdb1

( replace hdb1 with the partition you want to run the check on )

2). Other graphical Lilos allow you to do Ctrl+X to get a prompt where you type:
 
CODE
linux single

it will than also boot in “single user mode”

3). Another option is to flip in any Linux CD ( Live or install ) and at the prompt type
 
CODE
linux single

( For knoppix it is “knoppix single” )

4). Now, in case you did already boot, but the boot failed half way before getting to X, and you are thrown back at the text screen with a prompt. Here is how to do it if you are in runlevel 3:
Put it in “single user mode”, ( back to runlevel 1 ):
 
CODE
# init 1


Then remount / in read only mode:
 
CODE
# mount -o remount,ro /
# fsck /dev/hdb1

( replace hdb1 with the partition you want to run the check on )
Most of the times the -a, -A and -P options are not recommended, see “man fsck”

Then remount / in readwrite mode:
 
CODE
# mount -o remount,rw /


Last step, back to where you came from:
 
CODE
# init 3



The chances are that your file system will be fixed, but there is no guarantee.
The chance that you will have to do this are much slimmer on an Ext3 file system then on Ext2. So there is one more reason you always choose an Ext3 format


Bruno


PS: Here is how to do it with Grub


-- Mar 11 2004 ( Revised Dec 12 2005 ) --


Tips Linux Explorers   All Things Linux Forum   Great Linux Links   LinuxClues.com   Hometown   Email