Extending the Guest VM hard disk

The default disk size of the created instance is 175.8G. Follow these instructions to extend the guest VM.
  1. Shut down a running guest machine's virtual disk by entering its name or ID.
    [localadmin@localhost network-scripts]$ sudo virsh list
    [sudo] password for localadmin:
     Id    Name                           State
    ----------------------------------------------------
     1     EngPerf3-CL1-TN                running
     2     EngPerf3-NCN-TN                running
     9     vt800_128                      running
    
    [localadmin@localhost network-scripts]$
    
    [localadmin@localhost network-scripts]$ sudo virsh shutdown <instance-name>
    Domain vt800_128 is being shutdown
    
    [localadmin@localhost network-scripts]$
    
    [localadmin@localhost network-scripts]$ sudo virsh list
     Id    Name                           State
    ----------------------------------------------------
     2     EngPerf3-CL1-TN                running
     3     EngPerf3-NCN-TN                running
    
    [localadmin@localhost network-scripts]$
    
  2. Locate the guest image disk path.
    [localadmin@localhost ~]$ sudo virsh domblklist vt800_128
    Target     Source
    ------------------------------------------------
    hda        /home/localadmin/Downloads/vt800_128v1_OS_7_0_0_0_0_GA_09132019_kvm_R8_2_0_1_0_GA_10172019.qcow2
    
    [localadmin@localhost ~]$
    
  3. Extend the disk size to the desired capacity by entering the following command.
    [localadmin@localhost ~]$ sudo qemu-img resize /home/localadmin/Downloads/vt800_128v1_OS_7_0_0_0_0_GA_09132019_kvm_R8_2_0_1_0_GA_10172019.qcow2 +10G
    
    

    Note:

    quemu-img cannot resize an image that contains snapshots. You must first remove all VM snapshots:
    [localadmin@localhost ~]$ sudo virsh snapshot-list vt800_128
    Name        Creation Time               State
    --------------------------------------------------
     snapshot1   2019-04-16 08:54:24 +0300   shutoff
    
    [localadmin@localhost ~]$ sudo virsh snapshot-delete --domain vt800_128 --snapshotname snapshot1
    Domain snapshot snapshot1 deleted
    
  4. Extend the disk by using + before disk capacity
    [localadmin@localhost ~]$ sudo qemu-img resize /home/localadmin/Downloads/vt800_128v1_OS_7_0_0_0_0_GA_09132019_kvm_R8_2_0_1_0_GA_10172019.qcow2 +10G
    Image resized.
    [localadmin@localhost ~]$
    
  5. Power up the guest machine
    [localadmin@localhost ~]$ sudo virsh start vt800_128
    Domain vt800_128 started
    
    [localadmin@localhost ~]$
    
  6. Verify the disk layout
    talariuser@DUT-KVM-VT800:~# sudo lsblk
    NAME   MAJ:MIN	   RM	   SIZE	   RO 	  TYPE 	 MOUNTPOINT
    sda      8:0   		 0 	185.8G    0 	    disk
    ├─sda4   8:4   		 0     	1K  	 0 	    part
    ├─sda2   8:2    		0    	10G  	 0 	    part    /
    ├─sda5   8:5    		0     	1G  	 0 	    part 	  [SWAP]
    ├─sda3   8:3   		 0    	10G  	 0 	    part
    ├─sda1   8:1    		0   	200M  	 0 	    part 	  /grub
    └─sda6   8:6    		0 	154.6G    0 	    part 	  /home
    talariuser@DUT-KVM-VT800:~#