Wednesday, April 16, 2014

How to run root filesystem checks on virtual servers

How to run root filesystem checks on virtual servers

Note: Server has root filesystem error on reboot
Solution: This requires root filesystem check on reboot

1. Login to vmware and open a console for the server.

2. Click on the CD icon, and connect to ISO image for current version of the OS (In our case Red Hat 64-bit)

3. Use control-D to reboot server at the console session.
Note: It may take about 5-10 minutes to complete.

4. When Linux prompt is displays, click on console and type "linux rescue"  [ At the splash menu ] at the prompt

5. Select "English" for language and "US" for keyboard

6. Select "No" to start network interfaces

7. Click "Continue" for mount filesystems (this is critical to fix the errors)

8. Click "OK" when all filesystems mounted message appears

9. Shows all mounted filesystems
Note: the name of the root filesystem device, whatever is with /mnt/sysimage only

10. Display currently mounted FS.
# mount

/proc on /proc type proc (rw)
/dev on /dev type tmpfs (rw)
/dev/pts on /dev/pts type devpts (rw)
/sys on /sys type sysfs (rw)
none on /tmp type ramfs (rw)
none on /tmp/ramfs type ramfs (rw)
/tmp/loop0 on /mnt/runtime type squashfs (ro)
/selinux on /selinux type selinuxfs (rw)
/dev/sda2 on /mnt/sysimage type ext3 (rw,data=ordered)
/dev/SYSTEM/TMP on /mnt/sysimage/tmp type ext3 (rw,data=ordered)
/dev/SYSTEM/APPS on /mnt/sysimage/apps type ext3 (rw,data=ordered)
/dev/SYSTEM/WEB on /mnt/sysimage/web type ext3 (rw,data=ordered)
/dev/SYSTEM/WEB-SERVERS on /mnt/sysimage/web/servers type ext3 (rw,data=ordered)
/dev/SYSTEM/WEB-DOCROOT on /mnt/sysimage/web/docroot type ext3 (rw,data=ordered)
/dev/sda1 on /mnt/sysimage/boot type ext3 (rw,data=ordered)
/tmp/sysfs on /mnt/sysimage/sys type sysfs (rw)
/tmp/proc on /mnt/sysimage/proc type proc (rw)
/dev/DATA_DB1/ENGS on /mnt/sysimage/engs type ext3 (rw,data=ordered)
/dev/DATA_DB2/ENGS_TS on /mnt/sysimage/engs_ts type ext3 (rw,data=ordered)
/dev on /mnt/sysimage/dev type tmpfs (rw)
/dev/pts on /mnt/sysimage/dev/pts type devpts (rw)
/selinux on /mnt/sysimage/selinux type selinuxfs (rw)

11. umount all the non-rescue, real filesystem: anything under /mnt/sysimage
# mount | grep /mnt/sysimage | awk '{print $3}' | sed -n -e '2,$p' | sort -r | awk '{print "umount " $1}'  | sh

a. There may be some stragglers
# mount
/proc on /proc type proc (rw)
/dev on /dev type tmpfs (rw)
/dev/pts on /dev/pts type devpts (rw)
/sys on /sys type sysfs (rw)
none on /tmp type ramfs (rw)
none on /tmp/ramfs type ramfs (rw)
/tmp/loop0 on /mnt/runtime type squashfs (ro)
/selinux on /selinux type selinuxfs (rw)
/dev/sda2 on /mnt/sysimage type ext3 (rw,data=ordered)
/dev/system/WEB on /mnt/sysimage/web type ext3 (rw,data=ordered)

b. Unmount those by hand
# umount /mnt/sysimage/web

12. Unmount the root filesystem last
# umount /mnt/sysimage

13. Run the check on the root filesystem
# e2fsck -y /dev/sda2

14. Disconnect the CD in vmware console

15. reboot the server
# reboot

No comments:

Post a Comment