
image_file_name.img
複数のパーティションを持つものをディレクトリにマウントしようとしていますが、成功しません。
パーティションの詳細:
sfdisk -l -uS image_file_name.img
Disk image_file_name.img: cannot get geometry
Disk image_file_name.img: 11 cylinders, 255 heads, 63 sectors/track
Warning: The partition table looks like it was made
for C/H/S=*/4/63 (instead of 11/255/63).
For this listing I'll assume that geometry.
Units = sectors of 512 bytes, counting from 0
Device Boot Start End #sectors Id System
image_file_name.img1 252 503 252 83 Linux
image_file_name.img2 504 177407 176904 83 Linux
image_file_name.img3 0 - 0 0 Empty
image_file_name.img4 0 - 0 0 Empty
次のmount
コマンドを実行しています:
mount -o offset=$((252*512)) image_file_name.img /tmp/abc/
エラーメッセージ:
mount: mounting /dev/loop0 on /tmp/abc/ failed: Invalid argument
対応するエラーdmesg
は
[106359.764567] NTFS-fs error (device loop0): parse_options(): Unrecognized mount option offset.
これは、などのツールのない制限されたオペレーティング システム上にありますkpartx
。
どのような助けでも大歓迎です。
答え1
で表示されているエラーを考慮するとdmesg
、オプションoffset
として をスキップしmount
、代わりに を使用することをお勧めしますlosetup
。
util-linux
を使用するとlosetup
、パーティション処理を使用できます。
losetup -P -f --show image_file_name.img
使用されているループデバイスの名前が表示されます。これを使用してマウントします。
mount /dev/loop0p1 /tmp/abc
しかしloop0
、(ない p1
) を適宜使用します。他のパーティションにはp2
etc を使用してアクセスできます。
busybox
を使用する場合はlosetup
、オフセットを直接指定する必要があります。
losetup -o $((252*512)) -f image_file_name.img
ループデバイスを直接マウントし、例えば
mount /dev/loop0 /tmp/abc
ファイルシステムをアンマウントする場合は、 でループデバイスも解放する必要がありますlosetup -d
。