ddで取ったパーティションあるディスクイメージのパーティションをマウントする

losetupとkpartxを使う方法が計算なしで済むのだけど、ここは計算ありの単純な方法で。
まずはレイアウトの確認。

$ sudo fdisk -ul eMMCwriterSD.img
You must set cylinders.
You can do this from the extra functions menu.

Disk eMMCwriterSD.img.sec: 0 MB, 0 bytes
62 heads, 62 sectors/track, 0 cylinders, total 0 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xf411c27c

               Device Boot      Start         End      Blocks   Id  System
eMMCwriterSD.img1   *          62      207575      103757    b  W95 FAT32
eMMCwriterSD.img2          207576      211419        1922   83  Linux
eMMCwriterSD.img3          211420     1237767      513174   83  Linux
eMMCwriterSD.img4         1237768    15756555     7259394    b  W95 FAT32
Partition 4 has different physical/logical endings:
     phys=(1023, 61, 62) logical=(4098, 61, 62)

パーティションは4つ。今は先頭のeMMCwriterSD.img1を変更したい。
Units x Startか開始オフセット位置になる。

62x512=31744

offsetを指定してloop mountする。

$ sudo mount -o loop,offset=31744 eMMCwriterSD.img /media
$ df /media
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/loop0              103534      4642     98892   5% /media

あとは普通に書くなり消すなり。

$ sudo umount /media/