LoginSignup
5
6

More than 5 years have passed since last update.

SDカードイメージのパーティションをマウントする

Posted at

yocto等で作成されたSDカードイメージの中身を確認する方法を記載。

fdiskでパーティションを確認

$ sudo fdisk -u -l XXX.rootfs.sdcard

Disk XXX.rootfs.sdcard: 864 MiB, 905969664 bytes, 1769472 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
Disklabel type: dos
Disk identifier: 0x000XXXXX

Device             Boot Start     End Sectors  Size Id Type
XXX.rootfs.sdcard1       8192   24575   16384    8M  c W95 FAT32 (LBA)
XXX.rootfs.sdcard2      24576 1761279 1736704  848M 83 Linux

オフセットを指定してマウント

パーティションをマウントするにはパーティションの先頭のオフセット(byte)を指定してやれば良い。
1番目のパーティションをマウントする場合、fdiskの結果から先頭のセクターが8192でセクターのバイト数は512byteであることがわかるので以下のとおり指定する。

$ sudo mount -oloop,offset=$(expr 8192 \* 512) XXX.rootfs.sdcard /path/to/mountpoint
5
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
6