8、kvm虚拟机添加硬盘

kvm虚拟机添加硬盘
qemu-img创建一块新的硬盘

qemu-img create -f qcow2 /kvm-data/kvm/jumperhost_disk1.qcow2 50G

关闭虚拟机

virsh shutdown jumphost_hadoop

配置文件中,找到有关硬盘配置:

virsh edit jumphost_hadoop

<disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
<source file='/kvm-data/kvm/jumperhost_os_disk.qcow2'/>
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
</disk> 

在</disk>这之后,添加如下配置

<disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
<source file='/kvm-data/kvm/jumperhost_disk1.qcow2'/>
<target dev='hdc' bus='ide'/>
<address type='drive' controller='0' bus='1' target='0' unit='0'/>
</disk>

配置完成后重启启动kvm

virsh start jumphost_hadoop

登录jumphost_hadoop,进行磁盘格式化挂载

执行fdisk /dev/sdb 后,安装相关提示格式化磁盘或分区
mke2fs -t ext4 /dev/sdb1
mount /dev/sdb1 /data

永久挂载,在/etc/fstab下添加

/dev/sdb1 /data ext4 defaults 0 2
posted @ 2018-01-05 14:10  wclwcw  阅读(544)  评论(0编辑  收藏  举报