Mailinglist Archive: opensuse (1468 mails)

< Previous Next >
Re: [opensuse] Accessing a disk-image
On Wed, 03 Jun 2009 08:42:43 +0200, Koenraad Lelong
<k.lelong@xxxxxxxxxxxxxxxxxx> wrote:
David Bolt schreef:

Number Start End Size Type File system
Flags
1 32256B 172730879B 172698624B primary ext2 , ,
,
, , , , , , type=83, ,
2 172730880B 2146798079B 1974067200B primary ext3 , ,
,
, , , , , , type=83, ,

In this case, I could mount the individual file systems by using:

playing:/local2 # mkdir -p temp/mnt{1,2}
playing:/local2 # mount disc.img temp/mnt1 -o loop,offset=32256
playing:/local2 # mount disc.img temp/mnt2 -o loop,offset=172730880
playing:/local2 # df /local2/temp/mnt*
Filesystem 1K-blocks Used Available Use% Mounted on
/local2/disc.img 163322 1550 153340 2%
/local2/temp/mnt1
/local2/disc.img 1897452 35636 1765428 2%
/local2/temp/mnt2


Regards,
David Bolt


Guys, you rock, thanks.
That's what I like about linux. The downside about it is you have to
keep on learning, but I don't complain :-)

As a side note, you can use kpartx to detect the partition offsets, and
automatically create the corresponding device nodes in /dev/mapper/.

Example:
GizMo:/home/zly # kpartx -av test.img
add map loop0p1 (253:0): 0 96327 linear /dev/loop0 63
add map loop0p2 (253:1): 0 96390 linear /dev/loop0 96390
add map loop0p3 (253:2): 0 96390 linear /dev/loop0 192780
add map loop0p4 (253:3): 0 96390 linear /dev/loop0 289170

GizMo:/home/zly # ls /dev/mapper/
control loop0p1 loop0p2 loop0p3 loop0p4

You can then work on /dev/loopX as the disk, and /dev/mapper/loopXpX as the
individual partitions.

Kind regards
Sylvester Lykkehus
--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx

< Previous Next >