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:

[root@xenserver071 ~]# 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.

[root@xenserver071 ~]# 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:

[root@xenserver071 ~]# 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 A

Senior System Developer at Zeta. Linux lover. Traveller. Let's connect! Whether you're a seasoned DevOps pro or just starting your journey, I'm always eager to engage with like-minded individuals. Follow my blog for regular updates, connect on social media, and let's embark on this DevOps adventure together! Happy coding and deploying!

2 thoughts on “How to run FSCK on XEN virtual machine?

  1. tanks very nice post very good, Since when did you become a blogger?

Leave a Reply

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