標籤:使用 io art for re c
>
1。
[[email protected] kvm]# qemu-img info new.qcow2 image: new.qcow2file format: qcow2virtual size: 60G (64424509440 bytes)disk size: 7.0Gcluster_size: 65536qemu-img resize filename +20GImage resized.[[email protected] kvm]# qemu-img info new.qcow2 image: new.qcow2file format: qcow2virtual size: 80G (85899345920 bytes)disk size: 7.0Gcluster_size: 65536
磁碟擴充的第一步搞定。這裡建議只搞一個/分區, 添加完磁碟後,可以識別掛載出來。我們是一個/ 和一個/export 分區, 擴充完磁碟後,進入到系統,fdisk -l 接著就是刪除磁碟建立磁碟的過程。這個大家應該比我更熟練。就不多說了。
2. 磁碟擴充
擴充qcow2 磁碟格式
使用命令
virt-filesystems --long -h --all -a olddisktruncate -r olddisk newdisktruncate -s +5G newdisk# Note "/dev/sda2" is a partition inside the "olddisk" file.virt-resize --expand /dev/sda2 olddisk newdisk
cp net.qcow2 nett.qcow2[[email protected] kvm]# virt-df -h net.qcow2 Filesystem Size Used Available Use%net.qcow2:/dev/sda1 194M 28M 155M 15%net.qcow2:/dev/sda2 19G 6.3G 12G 33%net.qcow2:/dev/sda5 36G 176M 34G 1%[[email protected] kvm]# virt-filesystems --long -h --all -a net.qcow2Name Type VFS Label MBR Size Parent/dev/sda1 filesystem ext4 - - 200M -/dev/sda2 filesystem ext4 - - 20G -/dev/sda3 filesystem swap - - 4.0G -/dev/sda4 filesystem unknown - - 1.0K -/dev/sda5 filesystem ext4 - - 36G -/dev/sda1 partition - - 83 200M /dev/sda/dev/sda2 partition - - 83 20G /dev/sda/dev/sda3 partition - - 82 4.0G /dev/sda/dev/sda4 partition - - 05 1.0K /dev/sda/dev/sda5 partition - - 83 36G /dev/sda/dev/sda device - - - 80G -選擇要擴充的磁碟 我選擇的是/dev/sda2 需要執行如下命令 truncate -r net.qcow2 nett.qcow2truncate -s +5G nett.qcow2 [[email protected] kvm]# virt-resize --expand /dev/sda2 net.qcow2 nett.qcow2 枓鈻掆枓鈼74% 鉄︹枓鈻掆枓鈻掆枓鈻掆枓鈻掆枓鈻掆枓鈻掆枓鈻掆枓鈻掆枓鈻掆枓鈻掆枓鈻掆枓鈻掆枓鈻掆枓鈻掆枓鈻掆枓Resize operation completed with no errors. Before deleting the old disk, carefully check that the resized disk boots and works correctly這就轉換成功[[email protected] kvm]# virt-filesystems --long -h --all -a nett.qcow2 Name Type VFS Label MBR Size Parent/dev/sda1 filesystem ext4 - - 200M -/dev/sda2 filesystem ext4 - - 40G -/dev/sda3 filesystem swap - - 4.0G -/dev/sda4 filesystem unknown - - 1.0K -/dev/sda5 filesystem ext4 - - 36G -/dev/sda1 partition - - 83 200M /dev/sda/dev/sda2 partition - - 83 40G /dev/sda # 增長了不少。/dev/sda3 partition - - 82 4.0G /dev/sda/dev/sda4 partition - - 05 1.0K /dev/sda/dev/sda5 partition - - 83 36G /dev/sda/dev/sda device - - - 80G -[[email protected] kvm]# qemu-img info nett.qcow2 image: nett.qcow2file format: qcow2virtual size: 80G (85899345920 bytes)disk size: 60Gcluster_size: 65536virt-resize 只能擴充主要磁碟分割。/dev/sda5 已經變為擴充分區,無法直接對其擴充,可以對/dev/sda4進行擴充,再重新格式化磁碟,重新分區。
如過哪位仁兄有更好或其他方式,請不吝賜教。