Pegasi Wiki

This wiki acts as a memo for our own work so why not share them? Feel free to browse and use out notes and leave a note while at it.

Mount and repair a KVM / Xen virtual guest image file

Once upon a time there was a very old and grumpy server with ancient virtual guests. So it came to be that a major power failure occurred rendering one of the guests useless. Logs told me that it might due to problems with file systems so here is how to mount and fsck them.

Firstly check the first available loopback device

losetup -f

Use the device shown by this command to set up the device

losetup /dev/loop0 <image>
kpartx -av /dev/loop0

Observe with fdisk

fdisk -l /dev/loop0

Identify the file system on each partition

file -Ls /dev/mapper/loop0p1

Repair with the tool appropriate to the file system type

fsck.ext4 /dev/mapper/loop0p1
 stars  from 0 votes

Leave a comment

Enter your comment:
I V U E Y
 

  //check if we are running within the DokuWiki environment if (!defined("DOKU_INC")){ die(); } //place the needed HTML source codes BELOW this line