LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   problems with fsck (https://www.linuxquestions.org/questions/linux-software-2/problems-with-fsck-688770/)

phar0z 12-06-2008 12:26 PM

problems with fsck
 
I'm trying to execute a fsck (e2fsck) on my system. Though I boot into single-user mode I'm not able to umount my /dev/sda1 root filesystem. Of course I can't run a fsck on my root partition (/dev/sda1 with / as mountpoint) without my root filesystem being unmounted.

When I try (in single-user mode of course) to run umount /dev/sda1 I get "device is busy". After I ran fuser -km /dev/sda1 my system doesn't give any error when I execute umount -l /dev/sda/1. Unfortunately, I don't notice any difference when I execute mount.

When I try to fsck my /dev/sda1 I see a warning that contains:
Quote:

sda1 is mounted.

WARNING!!! Running e2fsck on a mounted filesystem may cause
SEVERE filesystem damage.
I would like to execute the fsck command on my system without using a live cd.

jailbait 12-06-2008 12:59 PM

Quote:

Originally Posted by phar0z (Post 3366508)

I'm trying to execute a fsck (e2fsck) on my system. Though I boot into single-user mode I'm not able to umount my /dev/sda1 root filesystem. Of course I can't run a fsck on my root partition (/dev/sda1 with / as mountpoint) without my root filesystem being unmounted.

You can run fsck against a file system mounted in read only mode. When you boot into single user mode the kernel should mount / as read only.

If you cannot get / mounted in read only mode then I suggest that you use a live CD to run fsck.

---------------------
Steve Stites

syg00 12-06-2008 03:22 PM

Use mount with "remount,rw" as options - no umount.

x_terminat_or_3 12-06-2008 03:38 PM

syg00, don't you mean

mount /dev/sda1 / -oremount,ro

syg00 12-06-2008 03:45 PM

Nope - the OP wants to fsck root - needs (should) be rw.
This works fine BTW - been there, done that.

Of course, fsck can trash files whilst doing it's job; that applies equally with root. Problem is (with root) you can wind up with a dead system.
That is the OPs choice - presumably s/he has read my sigline.

x_terminat_or_3 12-06-2008 03:51 PM

Thanks for the clarification syg00. Nice sigline by the way, my own is inspired by yours.

phar0z 12-07-2008 02:58 AM

Quote:

Originally Posted by jailbait (Post 3366539)
You can run fsck against a file system mounted in read only mode. When you boot into single user mode the kernel should mount / as read only.

If you cannot get / mounted in read only mode then I suggest that you use a live CD to run fsck.

Steve Stites

I mounted / in read only mode. I'll show you a part of my /boot/grub/menu.lst:

Quote:

title Ubuntu 8.04, kernel 2.6.24-19-generic
root (hd0,0)
kernel /boot/vmlinuz-2.6.24-19-generic root=UUID=b5879b46-a447-41e2-926c-6c9f6d4f30af ro quiet splash locale=nl_NL
initrd /boot/initrd.img-2.6.24-19-generic
quiet
It seems to me that / doesn't have to be mounted in read only mode in order to execute a fsck.

mount -o remount,ro /
didn't make any difference.

I'm starting to believe it should be mounted as rw, though this sounds very dangerous to me.

I executed touch /forcefsck in /root and after I rebooted I have removed it.

jailbait 12-07-2008 12:31 PM

Quote:

Originally Posted by phar0z (Post 3366926)


It seems to me that / doesn't have to be mounted in read only mode in order to execute a fsck.

It doesn't. What read only mode does is prevent other programs from updating the file system control blocks at the same time that fsck is updating the control blocks. Such simultaneous updates will scramble the file system.

--------------------
Steve Stites


All times are GMT -5. The time now is 02:31 AM.