После непредвиденного завершения работы виртуальной машины с centos на Hyper-V может не загрузиться система с ошибкой “switchroot: mount failed: No such file or directory”. В этом случае не корректно загружаются драйвера виртуальных жестких дисков CetnOS в Hyper-V:
Scanning logical volumes
Reading all physical volumes. This may take a while...
No volume groups found
Activating logical volumes
Volume group "VolGroup00" not found
Trying to resume from /dev/VolGroup00/LogVol01
Unable to access resume device (/dev/VolGroup00/LogVol01)
Creating root device.
Mounting root filessystem.
mount: could not find filesystem '/dev/root'
Setting up other filessystems.
Setting up new root fs
setuproot: moving /dev failed: No such file or directory
no fstab.sys, mounting internal defaults
setuproot: error mounting /proc: No such file or directory
setuproot: error mounting /sys: No such file or directory
Switching to new root and running init.
unmounting old /dev
unmounting old /proc
unmounting old /sys
switchroot: mount failed: No such file or directory Kernel panic - not syncing: Attempted to kill init!
Reading all physical volumes. This may take a while...
No volume groups found
Activating logical volumes
Volume group "VolGroup00" not found
Trying to resume from /dev/VolGroup00/LogVol01
Unable to access resume device (/dev/VolGroup00/LogVol01)
Creating root device.
Mounting root filessystem.
mount: could not find filesystem '/dev/root'
Setting up other filessystems.
Setting up new root fs
setuproot: moving /dev failed: No such file or directory
no fstab.sys, mounting internal defaults
setuproot: error mounting /proc: No such file or directory
setuproot: error mounting /sys: No such file or directory
Switching to new root and running init.
unmounting old /dev
unmounting old /proc
unmounting old /sys
switchroot: mount failed: No such file or directory Kernel panic - not syncing: Attempted to kill init!
Первое, что нужно сделать - скачать и вставить в cd/dvd-rom образ CentOS, с которого устанавливалась система.
Загружаем систему и после приветственного окна пишем в командную строку:
linux rescue
Далее, после всех манипуляций, пишем:
chroot /mnt/sysimage
Смотрим точную версию ядра:
cat /etc/grub.conf
Заменяем “VERSION” на вашу версию загружаемого ядра, которую мы выяснили на предыдущем шаге:
mkinitrd /boot/initrd-VERSION.el5.img VERSION.el5 --preload hv_storvsc --preload hv_vmbus --preload hv_utils -f
Пример:
mkinitrd /boot/initrd-2.6.18-348.1.1.el5.img 2.6.18-348.1.1.el5 --preload hv_storvsc --preload hv_vmbus --preload hv_utils -f
Выходим и перезагружаемся:
exit
reboot
reboot