Pantek Library
Hosting Provided By
CybrHost
High Speed Hosting

[gentoo-user] Re: "loopback mount" hard-drive image created with dd?

From: Remy Blank <remy.blank(at)pobox.com>
Date: Mon Jan 21 2008 - 03:54:31 EST


Yahya Mohammad wrote:
> # losetup /dev/loop0 /path/to/diskimage
> # fdisk -l /dev/loop0
> (example)
> Disk /dev/sdb: 160.0 GB, 160041885696 bytes
> 255 heads, 63 sectors/track, 19457 cylinders
> Units = cylinders of 16065 * 512 = 8225280 bytes
>
> Device Boot Start End Blocks Id System
> /dev/sdb1 * 1 1044 8385898+ c W95 FAT32 (LBA)
> /dev/sdb2 1045 19457 147902422+ 83 Linux

Thanks for the tip! I didn't know you could mount a whole disk image as loopback, and see the partition table with fdisk. I always printed the partition table before making the disk image.

> I second that, I'm curious to know if it works

It does, I have done it before, but there's a special case for the first partition of the disk. According to your output of fdisk, it is supposed to start at cylinder 1. However, if you run fdisk with the -u option (giving the positions and sizes in sectors), you get the following:

(example)
# fdisk -lu /dev/loop0

Disk /dev/loop0: 10.0 GB, 10056130560 bytes 240 heads, 63 sectors/track, 1299 cylinders, total 19640880 sectors Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0xc1afc1af

       Device Boot      Start         End      Blocks   Id  System
/dev/loop0p1   *          63     4097519     2048728+   b  W95 FAT32
/dev/loop0p2         4097520     8195039     2048760    5  Extended
/dev/loop0p5         4097583     8195039     2048728+   b  W95 FAT32

That is, the first partition starts at sector 63, i.e. at an offset value of 63 * 512 = 32256.

> oh, and make a backup just in case :)

Do you need help?X

And mount the filesystem read-only with the "ro" mount option.

  • Remy

-- 
gentoo-user@lists.gentoo.org mailing list
Received on Mon Jan 21 03:55:47 2008

This archive was generated by hypermail 2.1.8 : Fri Jun 13 2008 - 20:14:45 EDT


Contact Us  Legal Notices  Order Services Online 
Pantek Home  Privacy Policy  IT news  Site Map  Pantek Library