Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to expand disk space in KVM virtual machine

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces the knowledge of "how to expand disk space in KVM virtual machine". In the operation of practical cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

KVM supports online expansion of disk space and supports versions of RHEL series 6 and above

List online virtual machine disks

[root@e3 images] # virsh list-- all Id name status-29 centos6.6 running 41 centos6.5 running-kvm001 Shutdown-kvm002 shutdown-kvm003 shutdown-template shutdown [root@e3 images] # virsh domblklist centos6.5 # list online virtual machine disk condition target source- -vda / data/kvm/images/centos6.5.qcow2 [root@e3 images] #

Create a qcow2 disk and add it online

[root@e3 images] # qemu-img create-f qcow2 centos6.5-add.qcow2 5G # create a 5G hard disk Formatting 'centos6.5-add.qcow2', fmt=qcow2 size=5368709120 encryption=off cluster_size=65536 lazy_refcounts=off [root@e3 images] # ll centos6.5-add.qcow2-rw-r--r--. 1 root root 197120 January 21 18:31 centos6.5-add.qcow2# online add disk [root@e3 images] # virsh attach-disk centos6.5 / data/kvm/images/centos6.5-add.qcow2 vdb-- cache=none-- subdriver=qcow2 # # disk attached successfully

View

[root@e3 images] # virsh domblklist centos6.5 destination source-vda / data/kvm/images/centos6.5.qcow2vdb / data/kvm/images/centos6.5-add.qcow2 # added successfully # switch virtual machine to view [root@ Kvm003 ~] # fdisk-lDisk / dev/vda: 32.2 GB 32212254720 bytes16 heads, 63 sectors/track 62415 cylindersUnits = cylinders of 1008 * 512 = 516096 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x000903e2 Device Boot Start End Blocks Id System/dev/vda1 * 3 1018 512000 83 LinuxPartition 1 does not end on cylinder boundary./dev/vda2 1018 41611 20458496 8e Linux LVMPartition 2 does not end on cylinder boundary.Disk / dev/mapper/VolGroup-lv_root: 19.9 GB 1990 06166784 bytes255 heads, 63 sectors/track, 2420 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x00000000Disk / dev/mapper/VolGroup-lv_swap: 1040 MB, 1040187392 bytes255 heads, 63 sectors/track, 126 cylindersUnits = cylinders of 16065 * 512 = 8225 280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x00000000Disk / dev/vdb: 5368 MB, 5368709120 bytes # added 63 sectors/track, 10402 cylindersUnits = cylinders of 1008 * 512 = 516096 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x00000000 "how the KVM virtual machine expands disk space" ends here Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report