问题:
平台:Oralce VM Virtualbox的虚拟机Opensuse11.4
导出该机器的OVA文件后,把该OVA文件导入虚拟机,开机启动时报如下错误:
Trying manual resume from /dev/disk/by-id/ata-TOSHIBA-MK1246GSX-28FGTI70T-part1
resume device dev/disk/by-id/ata-TOSHIBA-MK1246GSX-28FGTI70T-part1 not found (ignoring)
Trying manual resume from /dev/disk/by-id/ata-TOSHIBA-MK1246GSX-28FGTI70T-part1
resume device dev/disk/by-id/ata-TOSHIBA-MK1246GSX-28FGTI70T-part1 not found (ignoring)
Waiting for device dev/disk/by-id/ata-TOSHIBA-MK1246GSX-28FGTI70T-part2 to appear : ........................ Could not find dev/disk/by-id/ata-TOSHIBA-MK1246GSX-28FGTI70T-part2 .
Want me to fall back to dev/disk/by-id/ata-TOSHIBA-MK1246GSX-28FGTI70T-part2 ? (Y/N)
y
Waiting for device dev/disk/by-id/ata-TOSHIBA-MK1246GSX-28FGTI70T-part2 to appear : ...............not found -- exiting to /bin/sh
分析:
原因是Opensuse的一个新的默认设置,从10Sp1版本开始,存储设备(硬盘)由原来的名称相关变为ID相关。
说明:
说明:
以前的硬盘描述为sda、sdb等,硬盘的分区描述为sda1、sda2、sda3等;
而如今硬盘与分区的新描述,例如:
/dev/disk/by-id/ata-TOSHIBA-MK1246GSX-28FGTI70T
/dev/disk/by-id/ata-ST380013AS_4MR2NSD8
其分区描述,例如:
/dev/disk/by-id/ata-TOSHIBA-MK1246GSX-28FTTI70T-part1
/dev/disk/by-id/ata-TOSHIBA-MK1246GSX-28FTTI70T-part2
问题在于,在虚拟机Opensuse机器上硬盘是用ID来描述在配置文件做相关记录的,而目标机器(即存放OVA文件的物理机)硬盘是不一样的,会有不一样的ID记录名称,所以导入后的机器才无法找到硬盘而不能启动成功。
解决:
只需在原来的Opensuse机器上修改两个配置文件即可。这两个文件是
/etc/fstab
/boot/grub/menu.lst
在这两个文件中,我们需要找出每一个类似下面例子的名称,例子如下:
/dev/disk/by-id/ata-TOSHIBA-MK1246GSX-28FGTI70T-part1
/etc/fstab
/boot/grub/menu.lst
在这两个文件中,我们需要找出每一个类似下面例子的名称,例子如下:
/dev/disk/by-id/ata-TOSHIBA-MK1246GSX-28FGTI70T-part1
然后把它们改成
/dev/sda1
注意分区名称对应如下:
-part1 -> sda1
-part2 -> sda2
/dev/sda1
注意分区名称对应如下:
-part1 -> sda1
-part2 -> sda2
步骤如下:
确保有权限修改文件,打开文件,修改完毕后,按ESC退出输入模式,然后输入:wq保存修改。
sudo vi /etc/fstab
sudo vi /boot/grub/menu.lst
重启电脑确认一切照常,然后就可以导出OVA文件了。
举例:
以下是这两个文件修改前后的内容变化:
sudo vi /etc/fstab
BEFORE
/dev/disk/by-id/ata-ST380013AS_4MR2NSD8-part1 swap swap defaults
/dev/disk/by-id/ata-ST380013AS_4MR2NSD8-part2 / ext4 acl,user_xattr
/dev/disk/by-id/ata-ST380013AS_4MR2NSD8-part3 /home ext4 acl,user_xattr
proc /proc proc defaults
sysfs /sys sysfs noauto
debugfs /sys/kernel/debug debugfs noauto
usbfs /proc/bus/usb usbfs noauto
devpts /dev/pts devpts mode=,gid= AFTER
/dev/sda1 swap swap defaults
/dev/sda2 / ext4 acl,user_xattr
/dev/sda3 /home ext4 acl,user_xattr
proc /proc proc defaults
sysfs /sys sysfs noauto
debugfs /sys/kernel/debug debugfs noauto
usbfs /proc/bus/usb usbfs noauto
devpts /dev/pts devpts mode=,gid=
sudo vi /boot/grub/menu.lst BEFORE
# Modified by YaST2. Last modification on Fri Nov :: CET
# THIS FILE WILL BE PARTIALLY OVERWRITTEN by perl-Bootloader
# For the new kernel it try to figure out old parameters. In case we are not able to recognize it (e.g. change of flavor or strange install order ) it it use as fallback installation parameters from /etc/sysconfig/bootloader default
timeout
##YaST - generic_mbr
gfxmenu (hd0,)/boot/message
##YaST - activate ###Don't change this comment - YaST2 identifier: Original name: linux###
title openSUSE 12.1 - 3.1.-1.2
root (hd0,)
kernel /boot/vmlinuz-3.1.-1.2-default root=/dev/disk/by-id/ata-ST380013AS_4MR2NSD8-part2 resume=/dev/disk/by-id/ata-ST380013AS_4MR2NSD8-part1 splash=silent quiet showopts vga=0x31a
initrd /boot/initrd-3.1.-1.2-default ###Don't change this comment - YaST2 identifier: Original name: failsafe###
title Failsafe -- openSUSE 12.1 - 3.1.-1.2
root (hd0,)
kernel /boot/vmlinuz-3.1.-1.2-default root=/dev/disk/by-id/ata-ST380013AS_4MR2NSD8-part2 showopts apm=off noresume nosmp maxcpus= edd=off powersaved=off nohz=off highres=off processor.max_cstate= nomodeset x11failsafe vga=0x31a
initrd /boot/initrd-3.1.-1.2-default AFTER
# Modified by YaST2. Last modification on Fri Nov :: CET
# THIS FILE WILL BE PARTIALLY OVERWRITTEN by perl-Bootloader
# For the new kernel it try to figure out old parameters. In case we are not able to recognize it (e.g. change of flavor or strange install order ) it it use as fallback installation parameters from /etc/sysconfig/bootloader default
timeout
##YaST - generic_mbr
gfxmenu (hd0,)/boot/message
##YaST - activate ###Don't change this comment - YaST2 identifier: Original name: linux###
title openSUSE 12.1 - 3.1.-1.2
root (hd0,)
kernel /boot/vmlinuz-3.1.-1.2-default root=/dev/sda2 resume=/dev/sda1 splash=silent quiet showopts vga=0x31a
initrd /boot/initrd-3.1.-1.2-default ###Don't change this comment - YaST2 identifier: Original name: failsafe###
title Failsafe -- openSUSE 12.1 - 3.1.-1.2
root (hd0,)
kernel /boot/vmlinuz-3.1.-1.2-default root=/dev/sda2 showopts apm=off noresume nosmp maxcpus= edd=off powersaved=off nohz=off highres=off processor.max_cstate= nomodeset x11failsafe vga=0x31a
initrd /boot/initrd-3.1.-1.2-default