Resize Disk of qcow2

vikozo

Renowned Member
May 4, 2014
827
34
93
suisse
www.wombat.ch
hello
i have a qcow2 of 250G which i could incrase to size=350G with the Proxmox GUI!
but i found out the this would only be the first part i think i have to incrasse the size also in the VM itself.
It is possible to do it on a running web Server or do i have to do something spezial befor? Is there a tutorial how to manage this?

have a nice day
vinc
 
thanks for your feedback
GUI information guest
OS Type Linux 4x
Hotplug Disk, network usb
in the guest is a Debian (Debian GNU/Linux 8 \n \l)
also a reboot did not make the disk size biger
/dev/sda1 * 2048 507512831 507510784 242G 83 Linux

but in the GUI it changed from 250 to 350 and it show also 350 in the GUI

have a nice day
vinc
-----------------------
Proxmox Virtual Environment 4.2-17/e1400248
Node 'srv03'
Logs
()
proxmox-ve: 4.2-58 (running kernel: 4.4.10-1-pve) pve-manager: 4.2-17 (running version: 4.2-17/e1400248) pve-kernel-2.6.32-37-pve: 2.6.32-149 pve-kernel-2.6.32-42-pve: 2.6.32-165 pve-kernel-4.4.13-1-pve: 4.4.13-56 pve-kernel-4.2.6-1-pve: 4.2.6-36 pve-kernel-2.6.32-32-pve: 2.6.32-136 pve-kernel-4.4.8-1-pve: 4.4.8-52 pve-kernel-4.4.13-2-pve: 4.4.13-58 pve-kernel-4.2.8-1-pve: 4.2.8-41 pve-kernel-2.6.32-39-pve: 2.6.32-157 pve-kernel-2.6.32-34-pve: 2.6.32-140 pve-kernel-2.6.32-35-pve: 2.6.32-143 pve-kernel-4.2.2-1-pve: 4.2.2-16 pve-kernel-2.6.32-40-pve: 2.6.32-160 pve-kernel-4.4.10-1-pve: 4.4.10-54 pve-kernel-4.2.3-1-pve: 4.2.3-18 pve-kernel-4.2.3-2-pve: 4.2.3-22 lvm2: 2.02.116-pve2 corosync-pve: 2.3.5-2 libqb0: 1.0-1 pve-cluster: 4.0-43 qemu-server: 4.0-85 pve-firmware: 1.1-8 libpve-common-perl: 4.0-71 libpve-access-control: 4.0-17 libpve-storage-perl: 4.0-56 pve-libspice-server1: 0.12.8-1 vncterm: 1.2-1 pve-qemu-kvm: 2.6-1 pve-container: 1.0-71 pve-firewall: 2.0-29 pve-ha-manager: 1.0-32 ksm-control-daemon: 1.2-1 glusterfs-client: 3.5.2-2+deb8u2 lxc-pve: 1.1.5-7 lxcfs: 2.0.0-pve2 cgmanager: 0.39-pve1 criu: 1.6.0-1 openvswitch-switch: 2.5.0-1
 
Last edited:
i missed to have LVM Active when installing Debian

so i would have to use
resize2fs /dev/vda1 ??

-------
fdisk -l /dev/sda

Disk /dev/sda: 350 GiB, 375809638400 bytes, 734003200 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xa8cf253f

Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 507512831 507510784 242G 83 Linux
/dev/sda2 507514878 524285951 16771074 8G 5 Extended
/dev/sda5 507514880 524285951 16771072 8G 82 Linux swap / Solaris
 
First you have to grow up the partiton (parted) see the link. This works fine on Gentoo on Ubuntu 12.04 Ubuntu 16.04, Centos6. This i have tested. Unfortunately the commands for parted were changed in some distris. After you growed up the partition, then you can resize the filesystem with "resize2fs".

And yes, it is easier when you use LVM inside your linuxvm. For example. Add an VM with 200GB, but only give the LV 50GB. Then you can resize always easy inside with lvm :) to the 200 GB are consumed.
 
in the Proxmox GUI i have resized from 250 to 350 is it enough?
resize2fs is to be used in the virtuel server i belive.
sorry to ask like that make me a bit nervous because the server ist holding my homepage.... ;-)
 
in the Proxmox GUI i have resized from 250 to 350 is it enough?
resize2fs is to be used in the virtuel server i belive.
Yes.
sorry to ask like that make me a bit nervous because the server ist holding my homepage.... ;-)
Where is the problem, make an Snapshot! If things go wrong, roll it back.

1. Resize in Proxmox (you have done)
2. Grow up partiton in the VM
3. Grow up filesystem in the VM
 
@fireon sorry to bother you again

how to grow the partion without LVM?

# dmesg | grep sda
[ 0.601376] sd 0:0:0:0: [sda] 734003200 512-byte logical blocks: (375 GB/350 GiB)
[ 0.601396] sd 0:0:0:0: [sda] Write Protect is off
[ 0.601398] sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00
[ 0.601404] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[ 0.628593] sda: sda1 sda2 < sda5 >
[ 0.628790] sd 0:0:0:0: [sda] Attached SCSI disk
[ 3.760107] EXT4-fs (sda1): mounted filesystem with ordered data mode. Opts: (null)
[ 9.074399] Adding 8385532k swap on /dev/sda5. Priority:-1 extents:1 across:8385532k FS
[ 9.588526] EXT4-fs (sda1): re-mounted. Opts: errors=remount-ro,usrjquota=quota.user,grpjquota=quota.group,jqfmt=vfsv0
----
#parted
(parted) print
Model: ATA QEMU HARDDISK (scsi)
Disk /dev/sda: 376GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number Start End Size Type File system Flags
1 1049kB 260GB 260GB primary ext4 boot
2 260GB 268GB 8587MB extended
5 260GB 268GB 8587MB logical linux-swap(v1)

(parted) resizepart 1
Warning: Partition /dev/sda1 is being used. Are you sure you want to continue?
Yes/No? yes
End? [260GB]? 350GB
Error: Can't have overlapping partitions.
 
check some youtube tutorial, e.g. this one.

 
@tom thanks i just have a terminal to access it and no grafical Gui
but will check other videos too.

---
i did not find a video, maybe i am searching the wrong way
 
Last edited:
@fireon thanks for your Feedback, parted gave a error because of overlapping as shown in post 10
Ok, i think the problem is the extended partition. I believe that you have an extended an after that this swap you can not grow up before.... i never used this extended thing. I think the only way is to use a live disk move partitions and grow up. But first make a snapshot or an backup.