This blog is NOFOLLOW Free!

The magic space of the IT find what you seek or get lost

14Sep/10Off

Direct mount xvda devices (or multi-partition isos)

Sometimes you will get in the need to directly mount an xvda device which is often used, if you (for example) install a debian virtual system in xen. Then this block device consists out of several partitions, which can not directly be used. But of course you can access the data of it, without the need of booting the guest os (domU).
This is the same if you get an iso or any other type block devices which uses multiple partion slices.

First we have to find out, at which position the slice (which we want to mount) start. For this we use the fdisk command which will give us all information we need. You do all this directly on the dom0, you dont have to boot the domU in any way!

xen ~ # fdisk -ul /dev/vg/server02

Disk /dev/vg/server02: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders, total 6291456 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00090c14

 Device          Boot      Start         End      Blocks   Id  System
/dev/vg/server02   *        2048     5894143     2946048   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/vg/server02         5896190     6289407      196609    5  Extended
Partition 2 does not end on cylinder boundary.
/dev/vg/server02         5896192     6289407      196608   82  Linux swap / Solaris

The important things are:
- Sector size   ->  512
- Start of the partition slice   ->  2048

Now fire up an calculator and multiply these number to get the correct offset:
512 * 2048 = 1048576

With this value you can already mount the partition.

mount -o offset=1048576 /dev/vg/server02 /mnt/

That was easy or what do you think?

Fatal error: Call to undefined function the_flattr_permalink() in /srv/www/webs/aschneider/magicspace_eu/htdocs/wp-content/themes/lightword-custom/single.php on line 23 Call Stack: 0.0001 235688 1. {main}() /srv/www/webs/aschneider/magicspace_eu/htdocs/index.php:0 0.0002 238648 2. require('/srv/www/webs/aschneider/magicspace_eu/htdocs/wp-blog-header.php') /srv/www/webs/aschneider/magicspace_eu/htdocs/index.php:17 0.3615 54278952 3. require_once('/srv/www/webs/aschneider/magicspace_eu/htdocs/wp-includes/template-loader.php') /srv/www/webs/aschneider/magicspace_eu/htdocs/wp-blog-header.php:19 0.3683 54706976 4. include('/srv/www/webs/aschneider/magicspace_eu/htdocs/wp-content/themes/lightword-custom/single.php') /srv/www/webs/aschneider/magicspace_eu/htdocs/wp-includes/template-loader.php:74