![]() The virtual disk file occupies all the space allocated to it on a physical server.But it has a lot of drawbacks, the main of them are: Raw advantages are maximum performance and generality. In the beginning of the article I mentioned these two disk formats: raw and qcow. KVM Disk Formats and QCOW2 Disk Compression There were also some methods that used disk conversion from raw to qcow2 format, but I am initially create machines in this format and here is the explanation why I do so. Virt-resize /old_disk_image /new_disk_image I checked this method, and the file system became inoperable like in the previous variant. Then you replace the new disk image with the old one, and it works based on the descriptions in different sources. It means that you create a new virtual machine with the disk size you need. Less popular variant in these guides is to decrease the disk space using disk replacement. Decreasing a Virtual Disk Size Using Image Replacement The partition we are trying to decrease is a system one, and the OS won’t boot since the information on it is obviously wiped out when trying to decrease its size. I tried to decrease the disk size in the system using fdisk first, but the system will not boot either even if you skip shrinking your disk on the physical server. Sorry, could not find valid secondary superblock. What happens after running this command? After starting the server, the system won’t boot: Unable to verify superblock, continuing. Qemu-img resize /path_to_disk 25G - to set the disk size to 25G Or the following option where you set the specific virtual disk size: Qemu-img resize /path_to_disk -5G - to shrink the disk space by 5G They offer to decrease a virtual machine disk space using this command: Some resources describe actions you can do with qemu tool. I will give some examples I came across and tested. There are a lot of guides it the web telling how to reduce the disk space in a KVM virtual machine, but this does not work. The only acceptable way to decrease virtual disk size on a physical storage is to convert the disk. In my work I often come across this issue, but unfortunately, you cannot safely reduce the disk size of a virtual machine in KVM. ![]() How to Reduce Disk Size of KVM Virtual Machine? If something goes wrong during the extension process, you will always be able to restore the virtual disk image from the backup. Stop the virtual machine and copy the disk image to the backup directory having some free space. I would like to note that prior to your virtual machine disk extension I recommend to back up the virtual disk. After that, the size of your partition will be increased. By default all available space will be offered to increase the disk size.Select the partition you want to increase and click Extend Volume.All of your disk partitions and unallocated space added will appear Select Storage -> Disk Management in the left pane.Open Server Manager -> Tools -> Computer Management.How to Increase the Disk Size in Guest Windows Server?Ĭonnect to the Windows Server virtual machine using RDP or VNC and expand the disk. Thus, you have extended the disk size on the virtual machine running CentOS 7. Some sources recommend using the following command :īut it won’twork for the XFS file system! Last sector, +sectors or +size Īfter the VM restart, check the disk using this command: # fdisk /dev/vda Welcome to fdisk (util-linux 2.23.2).Ĭhanges will remain in memory only, until you decide to write them.īe careful before using the write command. Let’s extend /dev/vda2 to the maximum available size: The screenshot shows that /dev/vda2 has the size of 20GB, and the available disk space is 25GB. Connect to the VM Guest OS over SSH and make sure that additional 5 Gb of disk space appears.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |