[opensuse] Accessing a disk-image
Hi, Last year I made a diskimage of a CF-hard-disk using dd. Now I have some problems booting that disk so I want to investigate the differences. However, I can't mount that diskimage with "mount -o loop diskimage /mnt". I think it's because the image contains two partitions. Is it possible to mount such an image ? -- Met vriendelijke groeten, Koenraad Lelong
On Tue, Jun 02, 2009 at 03:29:40PM +0200, Koenraad Lelong wrote:
Hi, Last year I made a diskimage of a CF-hard-disk using dd. Now I have some problems booting that disk so I want to investigate the differences. However, I can't mount that diskimage with "mount -o loop diskimage /mnt". I think it's because the image contains two partitions. Is it possible to mount such an image ?
Try running 'parted -s diskimage unit B print' to see where each partition starts/ends. Then you could a) extract the partition with dd to another file, which should be mountable with mount -o loop ... or b) use device-mapper linear mapping to access the partition (man dmraid). IMHO it should work, but I'm not sure. Please note, that 1) I've never tried that before 2) there might be much easier solution -- Best regards / s pozdravem Petr Uzel, Packages maintainer --------------------------------------------------------------------- SUSE LINUX, s.r.o. e-mail: puzel@suse.cz Lihovarská 1060/12 tel: +420 284 028 964 190 00 Prague 9 fax: +420 284 028 951 Czech Republic http://www.suse.cz -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Tue, 2 Jun 2009, Petr Uzel wrote:-
On Tue, Jun 02, 2009 at 03:29:40PM +0200, Koenraad Lelong wrote:
Hi, Last year I made a diskimage of a CF-hard-disk using dd. Now I have some problems booting that disk so I want to investigate the differences. However, I can't mount that diskimage with "mount -o loop diskimage /mnt". I think it's because the image contains two partitions. Is it possible to mount such an image ?
Try running 'parted -s diskimage unit B print' to see where each partition starts/ends.
Then you could
a) extract the partition with dd to another file, which should be mountable with mount -o loop ...
or
b) use device-mapper linear mapping to access the partition (man dmraid).
Another alternative is to tell mount the offset to the partitions boot sector. E.g. for a 2GiB virtual drive containing a couple of file systems: playing:/local2 # parted -s disc.img unit B print Model: (file) Disk /local2/disc.img: 2147483648B Sector size (logical/physical): 512B/512B Partition Table: msdos 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 -- Team Acorn: http://www.distributed.net/ OGR-NG @ ~100Mnodes RC5-72 @ ~1Mkeys/s openSUSE 10.3 32b | openSUSE 11.0 32b | | openSUSE 10.3 64b | openSUSE 11.0 64b | openSUSE 11.1 64b | RISC OS 3.6 | RISC OS 3.11 | openSUSE 11.1 PPC | TOS 4.02 -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
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 :-) -- Met vriendelijke groeten, Koenraad Lelong
On Wed, 03 Jun 2009 08:42:43 +0200, Koenraad Lelong
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@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
participants (4)
-
David Bolt
-
Koenraad Lelong
-
Petr Uzel
-
Sylvester Lykkehus