技术解析

Debian 7 in VirtualBox,无法进入系统, grub rescue 模式下提示 out of partition
0
2021-07-01 18:58:52
idczone

Windows 8.1 64 位企业版宿主机上运行 VirtualBox 5.0.10 ,虚拟机是 Debian 7 amd64

虚拟机去年安装的,天天在用,一直好好的,今天下午 putty 连上去也一直正常,要下班时想退出 putty ,运行 exit 提示找不到命令,然后发现所有命令都找不到了,打开 VirtualBox 上看, mount 发现挂载成只读

强制重启,进入 grub rescue 模式 显示

GRUB loading.
Welcome to GRUB!

error: out of partition.
Entering rescue mode...
# 根据 google 到的信息输入
grub rescue> ls
(hd0) (hd0,msdos5) (hd0,msdos1)
grub rescue> ls (hd0,msdos1)/
./ ../ lost+found/ var/ etc/ media/ vmlinuz sbin/ usr/ lib/ lib64/ selinux/ bin/ boot/
proc/ mnt/ tmp/ dev/ home/ root/ sys/ run/ srv/ opt/ initrd.img keybase/ lib32/ core
grub rescue> ls (hd0,msdos1)/boot/

error: out of partition.
grub rescue> ls (hd0)/
error: unknown filesystem
grub rescue> ls (hd0,msdos5)/
error: unknown filesystem
grub rescue> set root=(hd0,msdos1)
grub rescue> set prefix=(hd0,msdos1)/boot/grub
grub rescue> insmod normal
error: out of partition.
grub rescue> normal
Unknow command 'normal'
grub rescue> 

使用从官网下载的 debian-7.11.0-amd64-netinst.iso 启动到 rescue mode ,但在最后选择挂载系统的时候就出错了,不管选择哪个都提示

An error occurred while mounting the device you entered for your root file system (/dev/sda1) on /target
Please check the syslog for more information.

选择不挂载分区进入 rescue mode 后,/var/log/syslog 信息如下

rescue-mode: partitions found: /dev/sda1, /dev/sda2, /dev/sda5
rescue-mode: selected root device '/dev/sda1'
rescue: umount: can't umount /target: Invalid argument
kernel: EXT2-fs (sda1): error: couldn't mount because of unsupported optional features (244)
kernel: EXT3-fs (sda1): error: couldn't mount because of unsupported optional features (240)
kernel: EXT4-fs (sda1): ext4_check_descriptors: Block bitmap for group 128 not in group (block 811458560)!
kernel: EXT4-fs (sda1): group descriptors corrupted!
kernel: FAT-fs (sda1): utf8 is not a recommented IO charset for FAT filesystems, filesystem will be case sensitive!
rescue: mount: mounting /dev/sda1 on /target failed: Invalid argument
rescue-mode: mount '/dev/sda1' /target failed
kernel: atkbd serio0: Spurious NAK on isa0060/serio0. Some program migh be trying access hardware directly.
rescue-mode: partitions found: /dev/sda1, /dev/sda2, /dev/sda5
rescue-mode: selected root device '/dev/sda2'
rescue: umount: can't umount /target: Invalid argument
kernel: isofs_fill_super: bread failed, dev=sda2, iso_blknum=16, block=32
kernel: EXT2-fs (sda2): error: unable to read superblock
kernel: EXT3-fs (sda2): error: unable to read superblock
kernel: EXT4-fs (sda2): unable to read superblock
kernel: REISERFS warning (device sda2): sh-2006 read_super_block: bread failed (dev sda2, block 8, size 1024)
kernel: REISERFS warning (device sda2): sh-2006 read_super_block: bread failed (dev sda2, block 64, size 1024)
kernel: FAT-fs (sda2): utf8 is not a recommented IO charset for FAT filesystems, filesystem will be case sensitive!
rescue: mount: mounting /dev/sda2 on /target failed: Invalid argument
rescue-mode: mount '/dev/sda2' /target failed
rescue-mode: partitions found: /dev/sda1, /dev/sda2, /dev/sda5
rescue-mode: selected root device '/dev/sda5'
rescue: umount: can't umount /target: Invalid argument
kernel: FAT-fs (sda5): utf8 is not a recommented IO charset for FAT filesystems, filesystem will be case sensitive!
rescue: mount: mounting /dev/sda5 on /target failed: Invalid argument
rescue-mode: mount '/dev/sda5' /target failed

系统可以不要,代码可都在这机器里啊...虽然大部分都有 push 到 git 上,但也还有很多配置都没导出来啊 TAT

现在尝试在 rescue 模式下重装 grub 试试...


重装 grub 可以搞定的
开机 grub rescue> 一般修复 grub 引导可以 是在不行话也可以在添加一个硬盘然后装系统,然后把之前的硬盘挂在上就可以,最好先把虚拟硬盘文件备份下
希望你能弄好

先别管 grub 了,上网下个 livecd 或者 rescuecd
挂进去把数据拷出来再说
数据备份好的话随便折腾



今早备份了 vhd 文件,现在用 slacko64-6.3.0.iso 进 livecd 里,但里面的 pmount 挂载不上硬盘
/var/log/message 里显示的错误信息是
EXT4-fs (sda1): ext4_check_descriptors: Block bitmap for group 128 not in group (block 811458560)!
EXT4-fs (sda1): group descriptors corrupted!
现在尝试用 fsck.ext4 进行修复,一大堆的 Fixed? ....
想不通咋突然说坏就坏...我宿主机系统的硬盘检测是正常的,重启了宿主机也都很正常...

多半是非正常关机
你 fstab 里没加什么奇怪的 writeback 吧?
运气不好的话就算 fsck 过了也是废了

用 fsck.ext4 -ycf 修复好了,但 /boot 里是空的, vmlinuz 自然也不存在了,好在资料是正常的(至少看了几个都是正常的)
fstab 一直没去动过,非正常关机有可能...因为是运行在后台的,经常关 windows 的时候忘记先关虚拟机了...不过好几次都没事就对了...

vbox 好像不可靠

数据地带为您的网站提供全球顶级IDC资源
在线咨询
专属客服