本文共 1886 字,大约阅读时间需要 6 分钟。
系统磁盘损坏
前提:disk文件为文件存储类型的云主机。
步骤:
1、查看损坏OS云主机所在宿主机 nova show
2、找到或创建一台与损坏云主机OS版本一致的云主机
3、将损坏云主机A的磁盘文件disk拷贝一份至用于修复云主机B disk_bak
ls /var/lib/nova/instances/8a902cdf-2967-48c0-b928-df46544c78d5/disk_bak
-rw-r--r-- 1 root root 36662149120 6月 25 15:29 disk_bak
4、在修云主机B目录下创建xml文件
相关target 信息根据在宿主机查看的实例xml信息变更:virsh dumpxml instance-00021f44
1 2 3 4 5 6 | cat attach.xml <disk type = 'file' device= 'disk' > <driver name= 'qemu' type = 'qcow2' cache= 'none' /> < source file = '/var/lib/nova/instances/8a902cdf-2967-48c0-b928-df46544c78d5/disk_bak' /> <target dev= 'vdc' bus= 'virtio' /> < /disk > |
5、加载磁盘
查看实例名称
Virsh list|grep 8a902cdf-2967-48c0-b928-df46544c78d5
通过名称挂载disk
virsh attach-device instance-00008ba9 attach.xml
成功附加设备
6、查看是否挂载成功
在宿主机上查看
virsh dumpxml instance-00008ba9
云主机内查看
fdisk -l
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | Disk /dev/vda : 21.4 GB, 21474836480 bytes 16 heads, 63 sectors /track , 41610 cylinders Units = cylinders of 1008 * 512 = 516096 bytes Device Boot Start End Blocks Id System /dev/vda1 * 1 407 205127+ 83 Linux /dev/vda2 408 41610 20766312 83 Linux Disk /dev/vdb : 1073 MB, 1073741824 bytes 16 heads, 63 sectors /track , 2080 cylinders Units = cylinders of 1008 * 512 = 516096 bytes Disk /dev/vdb doesn't contain a valid partition table Disk /dev/vdc : 42.9 GB, 42949672960 bytes 16 heads, 63 sectors /track , 83220 cylinders Units = cylinders of 1008 * 512 = 516096 bytes Device Boot Start End Blocks Id System /dev/vdc1 * 1 407 205127+ 83 Linux /dev/vdc2 408 83220 41737752 83 Linux |
7、操作完成后卸载
virsh detach-device instance-00008ba9 attach.xml
成功分离设备
忘记密码(rhel)、修复系统fsck
1、获取uuid nova list --all-tenants --ip ip_addr
2、获取url访问界面 nova get-vnc-console uuid novnc
3、通过界面操作进入单用户模式,修改密码
I版nova stop uuid硬关机
在 icehouse 的版本中,执行 nova stop 时,会直接调用 virsh.destroy 硬关机
修改源代码让其软关机超时后才执行硬关机解决
转载地址:http://usial.baihongyu.com/