为什么环回设备创建会出现故障?
在代码的底部,您可以看到它失败了。事实上,我也会在一开始就把它放在这里,因为这是我需要解决的问题:
[350591.924819] EXT4-fs (loop0): bad geometry: block count 9750806 exceeds size of device (9750168 blocks)
我不明白为什么该设备据说太小。我两天前用普通的 fdisk 创建了这个分区,它是用 ext4 创建和格式化的,除了要格式化的分区 (/dev/sdb2) 之外不提供任何选项。
我能想到的唯一解释是 ext4 的分区大小不知何故错误,但这似乎不太可能。我的数学出了什么问题?偏移量是正确的,您可以使用 file 命令看到,并且大小也应该正确,因为 End - Start 的扇区数相同减 1,就像它应该的那样(磁盘从扇区 1 开始并以扇区结束2 将是 2 - 1 = 1 并且有两个扇区)。
# sfdisk -luS /dev/sdb
Disk /dev/sdb: 9729 cylinders, 255 heads, 63 sectors/track
Units = sectors of 512 bytes, counting from 0
Device Boot Start End #sectors Id System
/dev/sdb2 78295040 156296384 78001345 83 Linux
# losetup -r -f --show -o $((78295040 * 512)) --sizelimit $((78001345 * 512)) /dev/sdb
/dev/loop0
# file -s /dev/loop0
/dev/loop0: Linux rev 1.0 ext4 filesystem data (needs journal recovery) (extents) (large files) (huge files)
# mount -o ro -t ext4 /dev/loop0 /mnt
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 | tail -n 1
[350591.924819] EXT4-fs (loop0): bad geometry: block count 9750806 exceeds size of device (9750168 blocks)
At the bottom of the code you can see it failing. In fact, I'll put it here at the start too because it is the problem I need to solve:
[350591.924819] EXT4-fs (loop0): bad geometry: block count 9750806 exceeds size of device (9750168 blocks)
I don't understand why the device is supposedly too small. I made this partition two days ago with normal fdisk, it was created and formatted with ext4 supplying no options other than the partition (/dev/sdb2) to format.
The only explaination I can think of is that ext4 has the size of the partition wrong somehow but that seems very unlikely. What is wrong with my math? The offset is correct, you can see that with the file command, and the size should be correct too because End - Start comes to the same number of sectors minus 1, just like it should (A disk starting on sector 1 and ending on sector 2 would be 2 - 1 = 1 and have two sectors).
# sfdisk -luS /dev/sdb
Disk /dev/sdb: 9729 cylinders, 255 heads, 63 sectors/track
Units = sectors of 512 bytes, counting from 0
Device Boot Start End #sectors Id System
/dev/sdb2 78295040 156296384 78001345 83 Linux
# losetup -r -f --show -o $((78295040 * 512)) --sizelimit $((78001345 * 512)) /dev/sdb
/dev/loop0
# file -s /dev/loop0
/dev/loop0: Linux rev 1.0 ext4 filesystem data (needs journal recovery) (extents) (large files) (huge files)
# mount -o ro -t ext4 /dev/loop0 /mnt
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 | tail -n 1
[350591.924819] EXT4-fs (loop0): bad geometry: block count 9750806 exceeds size of device (9750168 blocks)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论