Tuesday, November 18, 2014

fsck root filesystem on redhat 6x

Take server to single user mode.


To fsck, you have to unmount it.
# chroot /mnt/sysimage
# vi /etc/fstab
put comment on the filesystems
###
# mount | grep /mnt/sysimage | awk '{print $3}' | sed -n -e '2,$p' | sort -r | awk '{print "umount " $1}'  | sh
# cat /etc/fstab | egrep "^###" | awk '{print "e2fsck -y " $1}' | tr -d '#' | bash
-------------------------------------
1. fsck your root device,
# e2fsck -f /dev/sda3


2. If you are using LVM for root filesystem, perform the following to activate the lvm
# lvm pvscan
# lvm vgscan
Reading all physical volumes. This may take a while...
Found volume group "RootVG" using metadata type lvm2
# lvm lvscan
INACTIVE '/dev/RootVG/Lv_Root' [x.xx GB] inherit


# lvm vgchange -ay
1 logical volume(s) in volume group "RootVG" now active


3. Run fsck on your root filesystem (lvm to check file integrity)
# e2fsck -f /dev/mapper/RootVG/Lv_Root


4. reboot the system.

=================================================



No comments:

Post a Comment