LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Emergency mode can mount the HDD with FS error but not in rescue or single user-mode (https://www.linuxquestions.org/questions/linux-newbie-8/emergency-mode-can-mount-the-hdd-with-fs-error-but-not-in-rescue-or-single-user-mode-847646/)

kayod_jj 12-01-2010 04:10 AM

Emergency mode can mount the HDD with FS error but not in rescue or single user-mode
 
Hello everyone,

My linux workstation recently crashed. After rebooting, Linux (Red Hat 5.3) will not boot properly and automatically went into emergency mode or recovery mode i think. I can still see my /home/user/ and all the files inside.

I boot from CD to rescue mode and tried mounting read-only the /dev/sd5 which contains the files in the crashed hard disk to try to copy out my files but mounting was unsuccessful (invalid argument). I checked the filesystem type using fsck -N /dev/sda5 and shows it to ext2. i tried to mount another known working hdd and was successful.

My question is why in emergency mode, the crashed hdd is able to be mounted automatically as read-only but cannot be done in rescue mode thru a bootable CD?
Is there any special mount options used in emergency mode?

I also cannot copy out in emergency mode booting from the crashed hard disk as everything is read only.

Thanks,
JJ

stress_junkie 12-01-2010 06:36 AM

Use fsck to perform a repair on the partition.
Code:

fsck /dev/sda5

malekmustaq 12-01-2010 09:40 AM

Quote:

My question is why in emergency mode, the crashed hdd is able to be mounted automatically as read-only but cannot be done in rescue mode thru a bootable CD?
Because this time it is not mounted as read only.

Quote:

I also cannot copy out in emergency mode booting from the crashed hard disk as everything is read only.
The hdd needs to be checked. Run fsck /dev/sda5 as 'stress_junkie' suggested above. That is, without the -a and -p switch running as root. fsck will prompt you to remove some nodes, you may press 'y' to correct the errors.

Hope this helps. Goodluck.

kayod_jj 12-01-2010 07:03 PM

Thanks malekmustaq and stress_junkie.
Now I got clear path to proceed with try to rescue my data.

Found similar suggestion on the net. Hope it can help others as well.

Repairing Linux ext2 or ext3 file system
by LinuxTitli · 16 comments

1) File system must be unmounted, you cannot repair it while it is running. Take system down to runlevel one (make sure you run all command as root user):
# init 1

2)Unmount file system, for example if it is /home (/dev/sda3) file system then type command:
# umount /home
OR
# umount /dev/sda3

3) Now run fsck on the partition:
# fsck /dev/sda3

However be sure to specify the file system type using -t option. Recenly one of our sys admin run the command on ext3 file system w/o specifying file system. Result was more corruption as fsck by default assumes ext2 file system.
# fsck -t ext3 /dev/sda3
OR
# fsck.ext3 /dev/sda3

Tip if you don't know your file system type then typing mount command will display file system type.

fsck will check the file system and ask which problems should be fixed or corrected. If you don't wanna type y every time then you can use pass -y option to fsck.
# fsck -y /dev/sda3

Please not if any files are recovered then they are placed in /home/lost+found directory by fsck command.

4) Once fsck finished, remount the file system:
# mount /home

5) Go to multiuser mode
# init 3


All times are GMT -5. The time now is 10:20 PM.