Loopback Device: Difference between revisions
no edit summary
[unchecked revision] | [unchecked revision] |
No edit summary |
|||
Line 101:
|}
That leaves us with a nice sized file full of zeros that we'll use for our disk image.
==== Mounting ====▼
==== Partitioning ====
Line 129 ⟶ 106:
Now to create the MBR and partition table on the disk image (Usually you need to be root).
fdisk -u -C#cylinders -S63 -H16 /
Explanation:
Line 149 ⟶ 126:
| Set the heads/track to 16.
|-
| /
| fdisk is capable of partitioning image files directly.
|}
Line 162 ⟶ 139:
You should end up with a screen that looks something like this:
Disk /
16 heads, 63 sectors/track, 1000 cylinders, total 1008000 sectors
Units = sectors of 1 * 512 = 512 bytes
Device Boot Start End Blocks Id System
/
Obviously the cylinder count, partition end and blocks will be different depending on the size of your image.
Line 183 ⟶ 160:
Unfortunately this also means that from here on out we have to account for the fact that our partition does not start at byte 0 of the image.
▲==== Mounting ====
Ok, now we attach the file to the loopback device
losetup -o32256 /dev/loop0 /path/to/c.img
Line 210 ⟶ 173:
|}
The reason we move 32256 bytes into the file is this is where the partition starts. Remember I said to note the start sector of the partition (63 is usual)? Well, since each sector is 512 bytes long we therefore know the starting byte of the partition is 32256 (63*512) bytes into the file. The reason behind this gap is that most (
''Note: If you aren't using the suggested geometry then you'll have to calculate this for yourself.''
|