[sclug] Mount whole-disk image?
Andy Smith
andy at lug.org.uk
Sun Jan 27 05:28:33 UTC 2008
Hi John,
On Sat, Jan 26, 2008 at 10:18:20PM +0000, John Stumbles wrote:
> I know if I make an image of a filesystem with
> dd if=/dev/sda1
> (say) I can then mount it loopback and access it as a filesystem. Can I
> do something similar with an image of an entire disk, e.g. made with
> dd if=/dev/sda
> ?
Use kpartx to do the heavy lifting for you. It's in the
multipath-tools package on Debian.
# kpartx -a /dev/sda
# ls -la /dev/mapper
should show you some devices in there corresponding to the
partitions inside /dev/sda.
For example when I did this last week with a disk image that was on
an LVM LV:
$ sudo kpartx -a /dev/mapper/mainvg-domu_centos5_xvda
$ sudo ls -la /dev/mapper/*centos5*
brw-rw---- 1 root disk 254, 96 2008-01-19 23:51 /dev/mapper/domu_centos5_xvda1
brw-rw---- 1 root disk 254, 97 2008-01-19 23:51 /dev/mapper/domu_centos5_xvda2
brw-rw---- 1 root disk 254, 95 2008-01-19 20:20 /dev/mapper/mainvg-domu_centos5_xvda
Cheers,
Andy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://sclug.org.uk/pipermail/sclug/attachments/20080127/dfa68ab8/attachment.bin
More information about the Sclug
mailing list