Friday, March 15, 2013

Run fsck on a XenServer VM



Run fsck on a XenServer VM


You hope that you won't ever need to, but you may one day need to run fsck on a Linux VM that won't boot.. no worries, attach the storage from that VM on another VM and run it from there!

Let's set it up with VM1 and VM2. VM1 is the one that you need to run a manual fsck on.
1. Shut down VM1 (if it's not down already..)
2. Enter the console on the xenserver and list the VMs - grab the vm-uuid of VM2.
xe vm-list

 


3. Now get the vdi-uuid of the vdi you want to access:

xe vbd-list vm-name-label=VM1

 


4. Create the vbd - it will echo the vbd-uuid after this command:

xe vbd-create vm-uuid=VM-UUID vdi-uuid=VDI-UUID device=autodetect

 


5. Now, 'plug' it in to VM1

xe vbd-plug uuid=VBD-UUID

 


You should now see a new partition in /proc/partitions


When you're done with it, unplug the vbd:
xe vbd-unplug uuid=VBD-UUID

Then you can destroy the temporary vbd:
xe vbd-destroy uuid=VBD-UUID

No comments:

Post a Comment