Centos

物理機重新啟動後無法 virsh 啟動我的 VM。錯誤僅支持單個 IDE 控制器?

  • November 25, 2020

我有一個在 kvm 下執行的虛擬機(它是一個 .img 文件),它執行的伺服器嚴重崩潰並重新啟動,最後終於搞定了……我想我跑了

yum install -y qemu-kvm

我確信在一個非常古老的未更新作業系統上更新了很多東西。這台機器死後我遇到了問題,因為它看到 vm 像 KVM 本身一樣在那裡(圖像文件在那裡,但它們沒有在任何地方“註冊”)。不知道我是怎麼把它找回來的,但是所有的 VMS 都啟動了 virsh 但是一個……它給出了一個錯誤:

[root@sdss4-server1 ~]# virsh start sdss-host2
setlocale: No such file or directory
error: Failed to start domain sdss-host2
error: unsupported configuration: Only a single IDE controller is supported for this machine type

我的文件損壞了嗎?我可以修理它嗎?我很樂意讓這個虛擬機再次執行,因為沒有備份,並且一些數據需要從它中取出。(我以為我可以以某種方式在 linux 中掛載 .img 文件?但我嘗試了以下方法)

kpartx -av sdsshost2.img
add map loop0p1 (253:2): 0 208782 linear /dev/loop0 63
add map loop0p2 (253:3): 0 10490445 linear /dev/loop0 208845
device-mapper: resume ioctl on loop0p3  failed: Invalid argument
create/reload failed on loop0p3
add map loop0p3 (0:0): 0 62916711 linear /dev/loop0 10699290


[root@sdss4-server1 vm-cache]# sudo mount /dev/mapper/loop0p2 /mnt/host2
mount: unknown filesystem type 'swap'

[root@sdss4-server1 vm-cache]# sudo mount /dev/mapper/loop0p1 /mnt/host2

(I think this is a boot and the files in it are:)


System.map                      initrd-2.4.21-27.0.2.EL.img             vmlinux-2.4.21-27.0.2.ELsmp
System.map-2.4.21-27.0.2.EL     initrd-2.4.21-27.0.2.ELsmp.img          vmlinux-2.4.21-32.0.1.EL
System.map-2.4.21-27.0.2.ELsmp  initrd-2.4.21-32.0.1.EL.img             vmlinux-2.4.21-32.0.1.ELsmp
System.map-2.4.21-32.0.1.EL     initrd-2.4.21-32.0.1.ELsmp.3w-9xxx.img  vmlinuz-2.4.21-27.0.2.EL
System.map-2.4.21-32.0.1.ELsmp  initrd-2.4.21-32.0.1.ELsmp.img          vmlinuz-2.4.21-27.0.2.ELsmp
config-2.4.21-27.0.2.EL         initrd-2.4.21-52.ELBOOT.img             vmlinuz-2.4.21-32.0.1.EL
config-2.4.21-27.0.2.ELsmp      kernel.h                                vmlinuz-2.4.21-32.0.1.ELsmp
config-2.4.21-32.0.1.EL         message                                 vmlinuz-2.4.21-52.ELBOOT
config-2.4.21-32.0.1.ELsmp      message.ja
grub                            vmlinux-2.4.21-27.0.2.EL

當然不是我想要的,看起來 loop0p3 是我想要安裝的,但是 kpartx 給出了一個我不完全理解的錯誤。

那麼我的虛擬驅動器/磁碟壞了嗎?我能做些什麼來恢復這個如何?

主機定義文件:

<domain type='kvm'>
 <name>sdss-host2</name>
 <uuid>36637cc5-63a1-4485-9a41-31afafb352dd</uuid>
 <memory unit='KiB'>4194304</memory>
 <currentMemory unit='KiB'>4194304</currentMemory>
 <memoryBacking>
   <hugepages/>
 </memoryBacking>
 <vcpu placement='static' cpuset='21'>1</vcpu>
 <cputune>
   <emulatorpin cpuset='21'/>
 </cputune>
 <os>
   <type arch='x86_64' machine='pc-i440fx-rhel7.0.0'>hvm</type>
   <boot dev='hd'/>
 </os>
 <features>
   <acpi/>
   <apic/>
   <pae/>
 </features>
 <cpu mode='custom' match='exact' check='partial'>
   <model fallback='allow'>coreduo</model>
   <vendor>Intel</vendor>
 </cpu>
 <clock offset='utc'/>
 <on_poweroff>destroy</on_poweroff>
 <on_reboot>restart</on_reboot>
 <on_crash>restart</on_crash>
 <devices>
   <emulator>/usr/libexec/qemu-kvm</emulator>
   <disk type='file' device='disk'>
     <driver name='qemu' type='raw' cache='none'/>
     <source file='/vm-cache/sdsshost2.img'/>
     <target dev='hda' bus='ide'/>
     <address type='drive' controller='0' bus='0' target='0' unit='0'/>
   </disk>
   <disk type='block' device='disk'>
     <driver name='qemu' type='raw' cache='none' io='native'/>
     <source dev='/dev/sdi'/>
     <target dev='hdb' bus='ide'/>
     <address type='drive' controller='0' bus='0' target='0' unit='1'/>
   </disk>
   <controller type='usb' index='0' model='piix3-uhci'>
     <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
   </controller>
   <controller type='pci' index='0' model='pci-root'/>
   <controller type='ide' index='0'>
     <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
   </controller>
   <controller type='ide' index='1'>
     <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
   </controller>
   <interface type='direct'>
     <mac address='52:54:00:2d:d1:ee'/>
     <source dev='enp4s0f0' mode='vepa'/>
     <model type='rtl8139'/>
     <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
   </interface>
   <serial type='pty'>
     <target type='isa-serial' port='0'>
       <model name='isa-serial'/>
     </target>
   </serial>
   <console type='pty'>
     <target type='serial' port='0'/>
   </console>
   <input type='mouse' bus='ps2'/>
   <input type='keyboard' bus='ps2'/>
   <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' keymap='en-us'>
     <listen type='address' address='127.0.0.1'/>
   </graphics>
   <video>
     <model type='vga' vram='16384' heads='1' primary='yes'/>
     <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
   </video>
   <memballoon model='virtio'>
     <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
   </memballoon>
 </devices>
</domain>

有趣的。您確實定義了兩個 IDE 控制器,但兩個虛擬驅動器都使用第一個。您應該能夠安全地移除第二個 IDE 控制器。

具體來說,這個節點應該被刪除:

   <controller type='ide' index='1'>
     <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
   </controller>

引用自:https://serverfault.com/questions/1043798