1 |
Yahya Mohammad wrote: |
2 |
> # losetup /dev/loop0 /path/to/diskimage |
3 |
> # fdisk -l /dev/loop0 |
4 |
> (example) |
5 |
> Disk /dev/sdb: 160.0 GB, 160041885696 bytes |
6 |
> 255 heads, 63 sectors/track, 19457 cylinders |
7 |
> Units = cylinders of 16065 * 512 = 8225280 bytes |
8 |
> |
9 |
> Device Boot Start End Blocks Id System |
10 |
> /dev/sdb1 * 1 1044 8385898+ c W95 FAT32 (LBA) |
11 |
> /dev/sdb2 1045 19457 147902422+ 83 Linux |
12 |
|
13 |
Thanks for the tip! I didn't know you could mount a whole disk image as |
14 |
loopback, and see the partition table with fdisk. I always printed the |
15 |
partition table before making the disk image. |
16 |
|
17 |
> I second that, I'm curious to know if it works |
18 |
|
19 |
It does, I have done it before, but there's a special case for the first |
20 |
partition of the disk. According to your output of fdisk, it is supposed |
21 |
to start at cylinder 1. However, if you run fdisk with the -u option |
22 |
(giving the positions and sizes in sectors), you get the following: |
23 |
|
24 |
(example) |
25 |
# fdisk -lu /dev/loop0 |
26 |
|
27 |
Disk /dev/loop0: 10.0 GB, 10056130560 bytes |
28 |
240 heads, 63 sectors/track, 1299 cylinders, total 19640880 sectors |
29 |
Units = sectors of 1 * 512 = 512 bytes |
30 |
Disk identifier: 0xc1afc1af |
31 |
|
32 |
Device Boot Start End Blocks Id System |
33 |
/dev/loop0p1 * 63 4097519 2048728+ b W95 FAT32 |
34 |
/dev/loop0p2 4097520 8195039 2048760 5 Extended |
35 |
/dev/loop0p5 4097583 8195039 2048728+ b W95 FAT32 |
36 |
|
37 |
That is, the first partition starts at sector 63, i.e. at an offset |
38 |
value of 63 * 512 = 32256. |
39 |
|
40 |
> oh, and make a backup just in case :) |
41 |
|
42 |
And mount the filesystem read-only with the "ro" mount option. |
43 |
|
44 |
-- Remy |