Sometimes we need recover data stored into a xen image because the image is damaged.

How can do it?

1) Find the loop used by the xen  image (for example /dev/loop15)

2) Find the disk geometry using fdisk -lu

fdisk -lu /dev/loop15
Disk /dev/loop15: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders, total 6291456 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0x000222d3
Device Boot      Start         End      Blocks   Id  System
/dev/loop15p1              63      257039      128488+  83  Linux
/dev/loop15p2          257040      755054      249007+  82  Linux swap / Solaris
/dev/loop15p3          755055     6281414     2763180   83  Linux

3) Now, we need identify the root file system, for example /dev/loop153

4) Now, we need find the root FS start, 755055, for example

5) And, we need to make the following operation 512 x 755055 = 386588160

6) And, now, tha black vodoo…

mount -o loop,offset=386588160 /disco/xen/maquinas/maquina16  /tmp/foo

7) Ready, patition mount in /tmp/foo directory

Rescue your data and enjoy it.

Leave a Reply

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>