run fsck on root file system

If i run fsck on one filesystem and fsck need to repair some things then this partition must be unmounted

correct ?

So running fsck on root file system isn't possible within same OS ? correct ?


What is the best way to do that, live cd ?


BR,

Jurif
 
boot into single user mode, root will be mounted read only, then run fsck , and you will be able to fix everything
 
If you don't want reboot your system (for any reasons) you can also remount file system as read-only. For example:
Code:
mount -fr /
and run fsck. After finish you can remount file system as read-write:
Code:
mount -fw /
This method may be unsafe if you have only one partition for system (without separate /var /usr /tmp etc.). Some processes may crash if they can't write on the file system.

If you have physical access to your machine, the safe method will be boot to single mode, then run fsck.
 
sniper007 said:
Is it possible to fix filesystem which is mounted anyway ?

If I'm not mistaken only the errors that are fixable in "preen" mode.
 
In single user mode fsck does nothing if root is mounted rw, but fixes errors if mounted ro, what's the logic behind that? (11.0-STABLE)
 
In single user mode fsck does nothing if root is mounted rw, but fixes errors if mounted ro, what's the logic behind that? (11.0-STABLE)
First, keep in mind that you're replying to a thread which is almost 7 years old. Sometimes it might be easier to start a new one.

Anyway, the answer is simple: although you may be in single user mode, you're not in a single instance mode. In other words: it's perfectly possible that there are other processes running which could perform disk operations while fsck is also running, which is obviously not an optimal situation. So to rule out any risk for unwanted updates your file system needs to be readonly.
 
Back
Top