新建存储池
- 创建存储池定义文件ssd500-pool
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| <pool type='dir'> <name>ssd500-pool</name> <source> </source> <target> <path>/ssd500g/kvm/</path> <permissions> <mode>0755</mode> <owner>0</owner> <group>0</group> </permissions> </target> </pool>
|
- 创建存储池
1 2 3
| virsh pool-define --file ssd500-pool virsh pool-start ssd500-pool virsh pool-autostart ssd500-pool
|
迁移VM
- 查找对应VM的image文件路径
1 2 3 4 5 6
|
virsh shutdown hadoop331_ka16 export imageFile=$(virsh dumpxml hadoop331_ka16 |grep "source file" |awk -F\' '{print $2}') # !!!!!!!一定要备份文件 mv $imageFile $(imageFile).bak
|
- 迁移image文件到指定目录
1 2 3 4 5
| cp $imageFile /ssd500g/kvm/
chown -R qemu:qemu /ssd500g/kvm/
|
- 修改vm的启动镜像
1 2
| virsh edit hadoop331_ka16
|
修改<source file=''/>
字段为新的存储池的字段.
- 开机验证
1
| virsh start hadoop331_ka16
|