ZFS Singledisk Autogrowth

jsterr

Well-Known Member
Jul 24, 2020
647
150
53
32
Im having a demo lab atm and try to autogrow a zfs single disk, does someone know how to do this? (zfs is NOT used for boot atm, its a separate disk)

Code:
apt update && apt install cloud-guest-utils
zpool set autoexpand=on zroot
growpart /dev/sda 4

# physical disk shown in lsblk with new size

Code:
root@custom-hw-image:~# lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda      8:0    0 223.6G  0 disk
|-sda1   8:1    0   260M  0 part
|-sda2   8:2    0   512K  0 part
|-sda3   8:3    0     8G  0 part
`-sda4   8:4    0 215.3G  0 part

How can I expand the zfs file system? zpool list still shows old size and EXPANDSIZE is strangely only 8G.
 
Last edited:
Bump :) Anyone? @Dunuin zfs god, can you help? ;-)
 
Haven't needed it in a while. Did a quick test, and it did not recognize the larger partition right away :-/. With zpool online tank -e /dev/sdd it did realize that the partition size changed. It was a disk only for the pool, so only partition 1 and 9 present. No idea if/how it will work in your case.
 
  • Like
Reactions: jsterr and Dunuin
Yes I tried that, but it doesnt work:


Code:
root@pve01:~# zpool status
  pool: rpool
 state: ONLINE
config:

        NAME                                          STATE     READ WRITE CKSUM
        rpool                                         ONLINE       0     0     0
          scsi-0QEMU_QEMU_HARDDISK_drive-scsi0-part3  ONLINE       0     0     0

errors: No known data errors
root@pve01:~# lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
sda      8:0    0  100G  0 disk
├─sda1   8:1    0 1007K  0 part
├─sda2   8:2    0  512M  0 part
└─sda3   8:3    0 74.5G  0 part
sr0     11:0    1  1.1G  0 rom
root@pve01:~#

root@pve01:~# growpart /dev/sda 3
CHANGED: partition=3 start=1050624 old: size=156235743 end=157286366 new: size=208664543 end=209715166

root@pve01:~# lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
sda      8:0    0  100G  0 disk
├─sda1   8:1    0 1007K  0 part
├─sda2   8:2    0  512M  0 part
└─sda3   8:3    0 99.5G  0 part
sr0     11:0    1  1.1G  0 rom

root@pve01:~# zpool get size
NAME   PROPERTY  VALUE  SOURCE
rpool  size      74G    -

root@pve01:~# zpool set autoexpand=on rpool
root@pve01:~# zpool online -e rpool /dev/sda3

root@pve01:~# lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
sda      8:0    0  100G  0 disk
├─sda1   8:1    0 1007K  0 part
├─sda2   8:2    0  512M  0 part
└─sda3   8:3    0 99.5G  0 part
sr0     11:0    1  1.1G  0 rom

root@pve01:~# zpool get size
NAME   PROPERTY  VALUE  SOURCE
rpool  size      74G    -

Edit: Thanks for the help, after reboot it shows as "EXPANDSZ" at least..

Code:
root@pve01:~# zpool list -vvv
NAME                                           SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP    HEALTH  ALTROOT
rpool                                           74G  1.35G  72.7G        -       25G     0%     1%  1.00x    ONLINE  -
  scsi-0QEMU_QEMU_HARDDISK_drive-scsi0-part3  99.5G  1.35G  72.7G        -       25G     0%  1.82%      -    ONLINE

But zpool online -e rpool /dev/sda3 does not change anything. Maybe this does not work on boot device...

Edit: ZFS needed the disk-by-id argument, now it worked!

Code:
root@pve01:~# zpool online -e rpool scsi-0QEMU_QEMU_HARDDISK_drive-scsi0-part3

root@pve01:~# zpool list -vvv
NAME                                           SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP    HEALTH  ALTROOT
rpool                                           99G  1.35G  97.7G        -         -     0%     1%  1.00x    ONLINE  -
  scsi-0QEMU_QEMU_HARDDISK_drive-scsi0-part3  99.5G  1.35G  97.7G        -         -     0%  1.36%      -    ONLINE

I will give this to my colleagues, they tried it with a OPNsense (single-disk zfs) and they struggled.
 
Last edited:
  • Like
Reactions: Dunuin

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!