我通常在安装磁盘(文件系统)映像时遇到麻烦,因此我创建了一个通用磁盘映像,但发现它也无法安装!
dd if=/dev/zero of=image.dd bs=1k count=2048
mkfs -i 4096 -F -v -m0 image.dd
到目前为止一切顺利。我可以fsck
在图像上运行,一切正常:
$ fsck.ext2 -f image.dd
e2fsck 1.42.13 (17-May-2015)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
image.dd: 11/512 files (0.0% non-contiguous), 90/2048 blocks
但是当我尝试安装它时,它失败了:
$ mkdir mnt;sudo mount -orw,loop image.dd mnt
mount: /dev/loop0: can't read superblock
奇怪的是,当我看时,dmesg
我看到了 I/O 错误!
[19994.133342] blk_update_request: 4 callbacks suppressed
[19994.133357] blk_update_request: I/O error, dev loop0, sector 3968
[19994.134218] blk_update_request: I/O error, dev loop0, sector 3968
[19994.134221] Buffer I/O error on dev loop0, logical block 496, async page read
[19994.134278] blk_update_request: I/O error, dev loop0, sector 3968
[19994.134279] Buffer I/O error on dev loop0, logical block 496, async page read
[19994.134414] blk_update_request: I/O error, dev loop0, sector 2
[19994.134418] EXT4-fs (loop0): unable to read superblock
[19994.134433] blk_update_request: I/O error, dev loop0, sector 2
[19994.134435] EXT4-fs (loop0): unable to read superblock
[19994.134446] blk_update_request: I/O error, dev loop0, sector 2
[19994.134447] EXT4-fs (loop0): unable to read superblock
[19994.134458] blk_update_request: I/O error, dev loop0, sector 0
[19994.134460] SQUASHFS error: squashfs_read_data failed to read block 0x0
[19994.134461] squashfs: SQUASHFS error: unable to read squashfs_super_block
我也尝试使用该losetup
命令,结果相同:
sudo losetup /dev/loop0 image.dd
sudo mount -orw /dev/loop0 mnt
答案1
您的系统已崩溃。前两个命令成功,因为所有操作都发生在页面缓存中。当您实际尝试挂载它时,页面缓存被绕过,这时事情就会出错,因为文件所在的设备出了问题。