Re: having trouble mounting disk image on loopback device
- From: Douglas Mayne <doug@xxxxxxxxxxxxxxxxxx>
- Date: Sun, 09 Jul 2006 22:52:07 -0600
On Sun, 09 Jul 2006 18:13:42 -0700, jasonmbowen wrote:
Here is the output I'm getting when trying to mount a disk imageCaveat: I have never tried this with a real disk, that is, starting with
created by dd that has been assosciate with /dev/loop0
root@ubuntu:~# losetup -d /dev/loop0
root@ubuntu:~# losetup /dev/loop0 ./hdd.dd
root@ubuntu:~# fdisk -l /dev/loop0
Disk /dev/loop0: 4303 MB, 4303290368 bytes
255 heads, 63 sectors/track, 523 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/loop0p1 1 280 2249068+ 83 Linux
/dev/loop0p2 281 523 1951897+ b W95 FAT32
root@ubuntu:~# mount -r -t ext3 /dev/loop1 /mnt/ext3
mount: wrong fs type, bad option, bad superblock on /dev/loop1,
missing codepage or other error
(could this be the IDE device where you in fact use
ide-scsi so that sr0 or sda or so is needed?)
In some cases useful info is found in syslog - try
dmesg | tail or so
I have another image created with dd that I got off a DVD that came
with the book I'm going through and I get the same problem with it.
I'm at a loss as to why this is happening.
a dd image taken from a physical disk.
I agree with the other response that images of partitions are easily
mountable using loopbacks. I thinks that an entire disk image is also
possible, but it is more tricky. To do it, you need to use losetup using
the offset option to indicate the start of each partition. This is a
useful command for getting the correct values for the offset:
# fdisk -lu /dev/loop0
Normally, fdisk specifies cylinders, but the start sector is more useful
in this case. To get the correct value multiply by 512 to get the byte
offset.
To verify this is could work, I setup a test file of 100M with two
partitions, approximately 50M each. Here is the resulting partition
table on the "loopback disk" that I tested:
# losetup /dev/loop0 test.file
# fdisk -lu /dev/loop0
Disk /dev/loop0: 102 MB, 102400000 bytes
255 heads, 63 sectors/track, 12 cylinders, total 200000 sectors
Units = sectors of 1 * 512 = 512 bytes
Device Boot Start End Blocks Id System
/dev/loop0p1 63 96389 48163+ 83 Linux
/dev/loop0p2 96390 192779 48195 83 Linux
Therefore, to mount each partition, I used these commands:
losetup -o 32256 /dev/loop1 test.file
losetup -o 49351690 /dev/loop2 test.file
Final Notes:
Sectors on hard disks were originally addressed by CHS (cylinder,
head, sector), but now LBA is used. LBA should be compatible with
this method, but I am not positive. I'll watch this thread to see
if this is refuted.
I assume these images could be used with VMWare as a "flat" disk.
--
Douglas Mayne
.
- Follow-Ups:
- References:
- having trouble mounting disk image on loopback device
- From: jasonmbowen
- having trouble mounting disk image on loopback device
- Prev by Date: Re: Can't mount WinXP partition or boot to it. Will "fixboot" work?
- Next by Date: Launching an ssh-agent when starting a Gnome session
- Previous by thread: Re: having trouble mounting disk image on loopback device
- Next by thread: Re: having trouble mounting disk image on loopback device
- Index(es):
Relevant Pages
|