Last Updated: 27 Jun 2023

   |   

Author: dordal

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
server-tech:centos:running-fsck [Jul 20, 2009 10:21 PM]
dordal
server-tech:centos:running-fsck [Jun 27, 2023 04:49 AM]
dordal old revision restored (Jun 24, 2023 04:35 AM)
Line 1: Line 1:
 += Running fsck in CentOS 5=
  
 +It is apparently a very bad idea to run fsck on a mounted filesystem, even via single user mode. There are two good options for running it:
 +=== Boot from a CD ===
 +Boot from a CD with CentOS on it, and run it from the CD. Then none of your filesystems are mounted.
 +
 +To do this, boot into Linux Rescue Mode:
 +<code>
 +boot: linux rescue
 +</code>
 +
 +**DO NOT mount your filesystems when it asks you if you want to.** As noted above, you can't run ''fsck'' on a mounted filesystem.
 +
 +Once you're in rescue mode, run ''fsck'' on the correct partition:
 +<code>
 +fsck -f /dev/sda1
 +</code>
 +
 +If you've used the Linux LVM to create your partitions, you'll need to make those accessible before you run ''fsck'':
 +<code>
 +lvm pvscan
 +lvm vgscan
 +lvm lvchange -ay VolGroup00
 +lvm lvscan
 +</code>
 +
 +Then you can run ''fsck'':
 +<code>
 +fsck -f /dev/VolGroup00/LogVol00 
 +</code>
 +
 +=== Run on restart ===
 +If you type<code bash>bash# shutdown -Fr now</code>then CentOS will reboot and do a forced fsck, which will be done before the filesystems are mounted.