mount
次のコマンドで私が間違っていることを理解しようとしています。
ここから次のファイルをインポートします。
img
からファイルをダウンロードするだけです。ここ。
md5sum
その後、アップストリームページの精度を確認しました。
$ md5sum nand_2016_06_02.img
3ad5e53c7ee89322ff8132f800dc5ad3 nand_2016_06_02.img
これはfile
次のように言うべきです。
$ file nand_2016_06_02.img
nand_2016_06_02.img: x86 boot sector; partition 1: ID=0x83, starthead 68, startsector 4096, 3321856 sectors, extended partition table (last)\011, code offset 0x0
それでは、このイメージの最初のパーティションが始まる場所を見てみましょう。
$ /sbin/fdisk -l nand_2016_06_02.img
Disk nand_2016_06_02.img: 1.6 GiB, 1702887424 bytes, 3325952 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: 0x0212268d
Device Boot Start End Sectors Size Id Type
nand_2016_06_02.img1 4096 3325951 3321856 1.6G 83 Linux
私として単位寸法は第512話とスタートはい4096、これはオフセットがバイト単位であることを意味します。2097152。この場合、以下は機能するはずですが、機能しません。
$ mkdir /tmp/img
$ sudo mount -o loop,offset=2097152 nand_2016_06_02.img /tmp/img/
mount: wrong fs type, bad option, bad superblock on /dev/loop0,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so.
そしてdmesgは次のことを言います:
$ dmesg | tail
[ 1632.732163] loop: module loaded
[ 1854.815436] EXT4-fs (loop0): mounting ext2 file system using the ext4 subsystem
[ 1854.815452] EXT4-fs (loop0): bad geometry: block count 967424 exceeds size of device (415232 blocks)
記載されている解決策はありません。ここ私のために働く:
- 2fsサイズを変更するか、
- フロッピーディスク
私が逃したものは何ですか?
私が試した他の実験は次のとおりです。
$ dd bs=2097152 skip=1 if=nand_2016_06_02.img of=trunc.img
その結果は次のとおりです。
$ file trunc.img
trunc.img: Linux rev 1.0 ext2 filesystem data (mounted or unclean), UUID=960b67cf-ee8f-4f0d-b6b0-2ffac7b91c1a (large files)
同じ物語:
$ sudo mount -o loop trunc.img /tmp/img/
mount: wrong fs type, bad option, bad superblock on /dev/loop2,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so.
resize2fs
以下を実行する必要があるため、これは使用できませんe2fsck
。
$ /sbin/e2fsck -f trunc.img
e2fsck 1.42.9 (28-Dec-2013)
The filesystem size (according to the superblock) is 967424 blocks
The physical size of the device is 415232 blocks
Either the superblock or the partition table is likely to be corrupt!
Abort<y>? yes
ベストアンサー1
目的のファイルシステムを抽出した後(を使用してdd
)ファイルのサイズを変更します(967424 * 4096 = 3962568704)。
$ truncate -s 3962568704 trunc.img
次に、次のように簡単に話します。
$ sudo mount -o loop trunc.img /tmp/img/
$ sudo find /tmp/img/
/tmp/img/
/tmp/img/u-boot-spl.bin
/tmp/img/u-boot.img
/tmp/img/root.ubifs.9
/tmp/img/root.ubifs.4
/tmp/img/root.ubifs.5
/tmp/img/root.ubifs.7
/tmp/img/root.ubifs.2
/tmp/img/root.ubifs.6
/tmp/img/lost+found
/tmp/img/root.ubifs.3
/tmp/img/boot.ubifs
/tmp/img/root.ubifs.0
/tmp/img/root.ubifs.1
/tmp/img/root.ubifs.8
もう一つの簡単な解決策は、元のimgファイルを直接切り取ることです。
$ truncate -s 3964665856 nand_2016_06_02.img
$ sudo mount -o loop,offset=2097152 nand_2016_06_02.img /tmp/img/
そのうち 3962568704 + 2097152 = 3964665856