[SOLVED] Expanding a KVM disk on ZFS

MimCom

Active Member
Apr 22, 2011
204
3
38
Southwest NM
This seemed like it should be a fairly straightforward process, but I've hit a snag getting the OS to fill out its available space. I started on the PVE host with:
qm resize 104 scsi0 +20G
which immediately became visible in
Code:
root@pve1:~# cat /etc/pve/qemu-server/104.conf
...

scsi0: zfs-local:vm-104-disk-1,size=100G
After rebooting, inside the Ubuntu guest I see:
Code:
root@nms:~# fdisk -l /dev/sda1
Disk /dev/sda1: 80 GiB, 85897248768 bytes, 167768064 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

root@nms:~# df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            2.9G     0  2.9G   0% /dev
tmpfs           597M  1.3M  595M   1% /run
/dev/sda1        79G   58G   18G  78% /
tmpfs           3.0G     0  3.0G   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
...

root@nms:~# parted /dev/sda
GNU Parted 3.2
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
Model: QEMU QEMU HARDDISK (scsi)
Disk /dev/sda: 107GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start   End     Size    Type     File system  Flags
1      1049kB  85.9GB  85.9GB  primary  ext4         boot


root@unms:~# resize2fs /dev/sda1
resize2fs 1.44.1 (24-Mar-2018)
The filesystem is already 20971008 (4k) blocks long.  Nothing to do!

Is there something I can do from inside the KVM (or prior to booting it) that will grow the partition? Is parted resizepart safe to extend a running partition?
 
Last edited: