How to run FSCK on XEN virtual machine?

I believe you guys are familiar in Xen technology! In this scenario, I’m going to explain how execute file system check (FSCK) on Xen VM (Virtual Machine) which are failed in automatic FSCK check. I had to do this on one our servers. The VM was showing offline and inaccessible via node.

When I checked it via node, it was showing the following error message:

[[email protected] ~]# xm console 
Use the --debug option to see the details of our search for an access method.
Setting clock : Thu Dec 29 18:29:14 EST 2016 [  OK  ]
Starting udev: [  OK  ]
Setting hostname  [  OK  ]
No devices found
Setting up Logical Volume Management:   No volume groups found
[  OK  ]
Checking filesystems
Checking all file systems.
[/sbin/fsck.ext3 (1) -- /] fsck.ext3 -a /dev/xvda1
/dev/xvda1 has gone 359 days without being checked, check forced.

[[email protected] ~]# xm console vm574
/dev/xvda1: e2fsck canceled.

Rebooting the server may not fix this problem. You have to run file system check manually on that VM to fix the error. Please do follow the steps pasted below:

Step 1: SSH to the node as root user.

Step 2: Shutdown or destroy VM.

xm shutdown vmid

Step 3: Find out the LVM (logical volume) details by using “lvdisplay” command.

lvdisplay | grep vmid

The above command lists logical volume details for a virtual machine. Please see the example pasted below:

[[email protected] ~]# lvdisplay | grep 115


Step 4: Run file system check on that VM’s img file.

e2fsck -f -y /dev/VolGroup01/vmid_img

Step 5: Start the VM.

Yup, you are ready to use the server now 🙂

Post navigation

Arunlal Ashok

Operations Engineer at Endurance International Group. Linux lover. Like to play on Linux console. I started this blog to share and discuss Linux thoughts.

Always happy for an open discussion! Write to arun (@) crybit (dot) com. Check about me for more details. About this blog and our strong members, check The team
Please follow the LinkedIn page

Leave a Reply

Your email address will not be published. Required fields are marked *