Expanding ZFS to take up free space

lb flag

I have an Ubuntu 21.10 VirtualBox VM set up with a 100GB zfs drive.

I have extended that to 500GB, because the system is a victim of its own popularity.

However, I am at a loss to growing that to fill all the free space.

Part of it is that I am not sure what I should see when I'm done. Should I still see "free space" but zfs will just magically grow into the free space, or should I see that pool (rpool) resized taking up the free space?

The basic steps I followed are in the following code segment.

Am I doing anything wrong? Commentary, correction etc please


### zfs list
NAME                                               USED  AVAIL     REFER  MOUNTPOINT
bpool                                              867M   924M       96K  /boot
bpool/BOOT                                         864M   924M       96K  none
bpool/BOOT/ubuntu_j4opxa                           864M   924M      159M  /boot
rpool                                             47.5G  44.5G       96K  /
rpool/ROOT                                        33.5G  44.5G       96K  none
rpool/ROOT/ubuntu_j4opxa                          33.5G  44.5G     7.17G  /
rpool/ROOT/ubuntu_j4opxa/srv                       376K  44.5G       96K  /srv
rpool/ROOT/ubuntu_j4opxa/usr                      5.74G  44.5G       96K  /usr
rpool/ROOT/ubuntu_j4opxa/usr/local                5.74G  44.5G     5.74G  /usr/local
rpool/ROOT/ubuntu_j4opxa/var                      11.2G  44.5G       96K  /var
rpool/ROOT/ubuntu_j4opxa/var/games                  96K  44.5G       96K  /var/games
rpool/ROOT/ubuntu_j4opxa/var/lib                  10.1G  44.5G     8.02G  /var/lib
rpool/ROOT/ubuntu_j4opxa/var/lib/AccountsService   828K  44.5G      340K  /var/lib/AccountsService
rpool/ROOT/ubuntu_j4opxa/var/lib/NetworkManager   1.71M  44.5G      132K  /var/lib/NetworkManager
rpool/ROOT/ubuntu_j4opxa/var/lib/apt               186M  44.5G     80.4M  /var/lib/apt
rpool/ROOT/ubuntu_j4opxa/var/lib/dpkg              250M  44.5G     55.0M  /var/lib/dpkg
rpool/ROOT/ubuntu_j4opxa/var/log                  1.09G  44.5G      928M  /var/log
rpool/ROOT/ubuntu_j4opxa/var/mail                   96K  44.5G       96K  /var/mail
rpool/ROOT/ubuntu_j4opxa/var/snap                 11.4M  44.5G     3.96M  /var/snap
rpool/ROOT/ubuntu_j4opxa/var/spool                1.67M  44.5G      136K  /var/spool
rpool/ROOT/ubuntu_j4opxa/var/www                  1.20M  44.5G      320K  /var/www
rpool/USERDATA                                    13.9G  44.5G       96K  /
rpool/USERDATA/root_pp526g                        3.14M  44.5G      948K  /root
rpool/USERDATA/tomcat_bkjegm                       434M  44.5G      433M  /home/tomcat
rpool/USERDATA/universal_pp526g                   13.5G  44.5G     9.50G  /home/universal

### lsblk
loop0    7:0    0 138.1M  1 loop /snap/krita/63
loop1    7:1    0  65.1M  1 loop /snap/gtk-common-themes/1515
loop2    7:2    0 111.6M  1 loop /snap/mysql-workbench-community/7
loop3    7:3    0 162.9M  1 loop /snap/gnome-3-28-1804/145
loop4    7:4    0 260.7M  1 loop /snap/kde-frameworks-5-core18/32
loop5    7:5    0   219M  1 loop /snap/gnome-3-34-1804/66
loop6    7:6    0     4K  1 loop /snap/bare/5
loop7    7:7    0 386.6M  1 loop /snap/bluej/161
loop8    7:8    0 386.6M  1 loop /snap/bluej/168
loop9    7:9    0  61.8M  1 loop /snap/core20/1081
loop10   7:10   0  55.5M  1 loop /snap/core18/2246
loop11   7:11   0  55.4M  1 loop /snap/core18/2128
loop12   7:12   0 152.3M  1 loop /snap/firefox/689
loop13   7:13   0   219M  1 loop /snap/gnome-3-34-1804/72
loop14   7:14   0  42.2M  1 loop /snap/snapd/13831
loop15   7:15   0  99.4M  1 loop /snap/core/11798
loop16   7:16   0 124.7M  1 loop /snap/mysql-workbench-community/9
loop17   7:17   0  61.8M  1 loop /snap/core20/1169
loop18   7:18   0 164.8M  1 loop /snap/gnome-3-28-1804/161
loop19   7:19   0 176.9M  1 loop /snap/krita/64
loop20   7:20   0 152.3M  1 loop /snap/firefox/701
loop21   7:21   0  54.2M  1 loop /snap/snap-store/557
loop22   7:22   0 251.5M  1 loop /snap/dbeaver-ce/148
loop23   7:23   0  99.4M  1 loop /snap/core/11993
loop24   7:24   0   277M  1 loop /snap/gimp/380
loop25   7:25   0 276.7M  1 loop /snap/gimp/372
loop26   7:26   0 242.3M  1 loop /snap/gnome-3-38-2004/76
loop27   7:27   0    51M  1 loop /snap/snap-store/547
loop28   7:28   0  32.4M  1 loop /snap/snapd/13640
loop29   7:29   0 248.9M  1 loop /snap/dbeaver-ce/147
loop30   7:30   0 241.4M  1 loop /snap/gnome-3-38-2004/70
loop31   7:31   0  65.2M  1 loop /snap/gtk-common-themes/1519
sda      8:0    0   500G  0 disk 
├─sda1   8:1    0     1M  0 part 
├─sda2   8:2    0   513M  0 part /boot/efi
├─sda3   8:3    0     2G  0 part [SWAP]
├─sda4   8:4    0     2G  0 part 
└─sda5   8:5    0  95.5G  0 part 
sr0     11:0    1  1024M  0 rom  

### zpool status
  pool: bpool
 state: ONLINE
  scan: scrub repaired 0B in 00:00:11 with 0 errors on Sun Nov 14 00:24:12 2021

    NAME                                    STATE     READ WRITE CKSUM
    bpool                                   ONLINE       0     0     0
      256b9001-18b9-474f-85e9-42f2a4886fa1  ONLINE       0     0     0

errors: No known data errors

  pool: rpool
 state: ONLINE
status: Some supported features are not enabled on the pool. The pool can
    still be used, but some features are unavailable.
action: Enable all features using 'zpool upgrade'. Once this is done,
    the pool may no longer be accessible by software that does not support
    the features. See zpool-features(5) for details.
  scan: scrub repaired 0B in 00:12:30 with 0 errors on Sun Nov 14 00:36:32 2021

    NAME                                    STATE     READ WRITE CKSUM
    rpool                                   ONLINE       0     0     0
      723a9d83-56e9-d94f-b80a-fc040fda002a  ONLINE       0     0     0

errors: No known data errors

### zpool set autoexpand=on rpool

### sudo zpool online -e rpool 723a9d83-56e9-d94f-b80a-fc040fda002a

### Then reboot...

Then it seemed that "all I needed to do was this"

Step 1 - Run parted
print       [gives the partitions, in my case 1..5]
print free  [shows up the free space, and in particular the end -> 537GB]

Step 2 - Use parted to resize
Partition number? 5
End? 537GB

Step 3 - Reboot

Except it didn't work, despite showing that rpool was all 500G as intended, data transfer blew out at 100GB, the original size.

I'm at a loss...
rfm avatar
mk flag
Maybe you need "zpool set autoexpand=on rpool" before the online -e? It helped me (tho on a real machine with a real disk.)
zkiwi34 avatar
lb flag
Oops. I forgot to include that I had done that.
zkiwi34 avatar
lb flag
Strangest thing, after getting a wee bit flustered with this. I shut it all down. Now, a few days later, I start it up, and it has done everything I was wanting. I guess I missed rebooting at "the appropriate moment" or "the right number of times" or something.

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.