How do I expand the ZFS dataset?

Finally finished replacing my 8x 6 TB drives with 8x 12 TB SAS drives.

Resilvering for all 8 drives finally finished.

All of the drives were replaced using the zpool replace pool /dev/disk/by-id/old_drive /dev/disk/by-id/new_drive

After the resilvering was done, below is the procedure that I used to expand the ZFS pool:

This is what zpool list shows:

NAME         SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP    HEALTH  ALTROOT
pool       189T   163T  26.2T        -     41.9T    35%    86%  1.00x    ONLINE  -

zpool set autoexpand=on pool didn’t change the output of zpool list.

In googling the topic, someone recommend the following sequence of commands (and the respective outputs are also copied-and-pasted here as well):

root@host# partprobe
root@host# zpool list
NAME         SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP    HEALTH  ALTROOT
pool       189T   163T  26.2T        -         -    35%    86%  1.00x    ONLINE  -
root@host# zpool get autoexpand pool
NAME    PROPERTY    VALUE   SOURCE
pool  autoexpand  on      local
root@host# zpool set autoexpand=off pool
root@host# zpool online -e pool raidz2-2
cannot expand raidz2-2: operation not supported on this type of pool
root@host# zpool online -e pool /dev/disk/by-id/scsi-35000cca27826e008
root@host# zpool list
NAME         SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP    HEALTH  ALTROOT
pool       231T   163T  68.1T        -         -    29%    70%  1.00x    ONLINE  -

So it looks like that the ZFS pool expansion was successful.

Now, my question pertains, how do I expand the dataset?

I don’t have a quota nor a reservation set on the dataset, but the ALLOC field from zpool list is still showing the pre-expansion value.

root@host# zfs get quota,reservation pool
NAME    PROPERTY     VALUE   SOURCE
pool  quota        none    default
pool  reservation  none    default

I tried Googling “zfs expand dataset” to no avail, so if someone has any ideas about this – your help is greatly appreciated.

Thank you.

Looks like you found this post already. Good :slight_smile:
Can’t help much, but maybe this other thread or this may be able to help, or maybe to lead you to a solution? Not sure, sorry.

Datasets use as much space as they need from the pool. You expand them by filling them with data. :slight_smile:

This would imply that the ALLOC column, which according to this thread, states, quote:

" About the difference between ALLOC and CAP, docs.oracle.com says:

ALLOC: The amount of physical space allocated to all datasets and internal metadata. Note that this amount differs from the amount of disk space as reported at the file system level."

It was because the Oracle ZFS documentation in terms of how they explained/described what the ALLOC column represents, that led me to this question of “so…that means that I can expand the dataset allocation, after ZFS pool expansion???”

This is what isn’t super clear from the stuff that I’ve been able to find about this question/topic.

The two corollaries to this are:

  1. Given the general do not exceed more than 80% of the capacity of the ZFS pool, therefore; based on the above statement that the allocation will grow with data, which means that post-ZFS pool expansion, the allocation will never grow to it’s “full” size since we are trying to target <=80% of capacity used.

  2. The free space that will show up in Windows, for a SMB share, as a result, will never accurately represent the actual free space of the expanded ZFS pool.

(If pre-ZFS pool expansion, you had 26 TB free and then post-ZFS pool expansion, you have 126 TB free, there is a chance that in Windows Explorer (for a mapped network drive), that you might still only see a fraction of the 100 TB of added space, as free space, but never the full 100 TB, unless/until you completely fill it with data.)

Just wanted to check whether or not my understanding about this is faulty and/or has any inaccuracies with it.

Thank you.

You’re making stuff way too complicated.

You expand the pool or add vdevs and all datasets get that much more space. That’s what ZFS is made for. To not worry about a million datasets to grow and shrink and all this ancient stuff.

Allocation is data allocated to the device. As long as you don’t write stuff, there is no allocation of space. You don’t allocate ressources when creating datasets or sparse Zvols.

You add 8TB capacity = all datasets get +8TB capacity. Capacity is a pool ressource shared by all datasets and limited by the user with quotas and/or reservations and size (in case of zvols).

Which is a windows problem. But not exclusively so…Linux file managers like to add ALL THE SNAPSHOTS when it comes to how much space is used. My Nautilus tells me I’m using 24TiB out of 3.7TiB.
Browsable snapshot directories are great…but should be ignored in these calculations.
That’s just file managers not being able to meet modern standards. They need an update to show correct values for CoW filesystems.

But when you initially create a ZFS pool, which also creates your first ZFS dataset (and automatically mounts it for you), it sets/defines the allocated amount of space for said dataset.

If the allocation doesn’t really matter, then why does the ALLOC field exist?

(sidebar: I am going to test this using TrueNAS Scale 24.10 to see what it shows.)

to tell you how much data has been allocated by the pool. In layman’s terms “it’s how much stuff is stored there or how much you wrote to it” or “used by data”.

But when you first create the pool, you haven’t added any data to said pool yet.

No. And your ALLOC will show 0 or some kilobytes for bookkeeping in that case. It reflects the data stored on the pool. Which is “no data” on a new pool.

Just replace ALLOC with “used”. Allocation is a more technical term…“used” is a very vague term, especially if you deal with lower level stuff and allocation being more precise in that context.

allocated/maximum = CAP if that helps you understanding the relation.

With all due respect, that is not the case here.

I just created four 1 GiB disks in Proxmox so that I can add it to the TrueNAS Scale 24.10 VM. (The intent is that I was going to then create four 2 GiB disks, and then swap them out, one by one.)

Created the pool via the GUI, set up my group, set up a home dataset (for my non-admin user home directory), set up a user (so that I can ssh back into the system) and here is the output of sudo zpool list

NAME        SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP    HEALTH  ALTROOT
boot-pool    31G  4.67G  26.3G        -         -     0%    15%  1.00x    ONLINE  -
tank       3.75G  1.55G  2.20G        -         -     0%    41%  1.00x    ONLINE  /mnt

This is on a freshly created pool with no data in the dataset (other than the home directory).

user@truenas$ sudo zfs list tank
NAME   USED  AVAIL  REFER  MOUNTPOINT
tank  1.12G  1.48G   140K  /mnt/tank
user@truenas$ cd /mnt/tank/home
user@truenas$ du -hd 1 .
20K     ./user
21K     .
user@truenas$ sudo zpool list tank
NAME   SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP    HEALTH  ALTROOT
tank  3.75G  1.55G  2.20G        -         -     0%    41%  1.00x    ONLINE  /mnt

It’s already using up space even though there’s only about 21 kiB of data in the home directory (/mnt/tank/home/user).

I guess Proxmox or the GUI does some things. I used zpool create dozens of times and there was never any else but an empty pool.

Same with TrueNAS. If you create your first pool, you immediately have like 8 (carefully hidden) datasets for Kubernetes and Apps and shit

If some OS or application writing stuff to the pool, it obviously isn’t 0 anymore. But it only ever starts at 0.

Might be some snapshots using up the space or whatever. But you got some 1.55G of data stored on the pool and that’s what ALLOC tells you.

Don’t name datasets “tank”. It’s just confusing having the same names for different things.

That’s the dataset that, as I mentioned, when you create the ZFS pool, it automatically creates and mounts a dataset for you that’s the same name as the ZFS pool, by default.

It is my understanding that there might be some advanced zpool create option where you can suppress the auto-creation of this first dataset that would otherwise be automatically created for you when you invoke the zpool create command, but I’m not that advanced with ZFS administration to warrant nor necessitate overriding this default behaviour of ZFS.

I just finished swapping out all of the 1 GiB disk files with 2 GiB disk files.

user@truenas$ sudo zpool list tank
NAME   SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP    HEALTH  ALTROOT
tank  7.75G  1.55G  6.20G        -         -     0%    19%  1.00x    ONLINE  /mnt

As you can see, the SIZE grew proportionally, ALLOC remains the same “overblown” number (vs. the 21-ish kiB that the home directory should’ve taken up), and the CAP percentage drops, likewise, proportionally.

That’s expected. You expanded the pool but the data stored (1.55G) didn’t change. There is absolutely no correlation between those values. Because your data doesn’t magically multiply.

So go find what is using those 1.55G on the pool. My bet is a hidden dataset or snapshots. Or your /mnt/tank isn’t the mounted dataset but part of your root.

But the data is there and someone stored it there. Either you or Proxmox or ZFS for one reason or another.

The TrueNAS VM is (generally) completely oblivious to the fact that it, itself, is a VM, running on Proxmox.

I just re-installed TrueNAS again, and it is going through the update process again going from 24.04 → 24.10, but this time, I am going to create the ZFS pool via the TrueNAS CLI rather than via its GUI.

TrueNAS Scale automatically creates the boot-pool for ZFS-on-root. I truncated the output from zpool list because otherwise, it would dump all the other stuff from the boot-pool as well, which isn’t necessary nor critical for this discussion.

(The boot drive is just a 32 GiB VM disk that I created in Proxmox just so that I can spin up a system quickly to run these tests with.)

We were talking about Proxmox. What has TN to do with that? Don’t make things complicated, stay focussed on a single issue.

If you tell me that you just created a new pool and now you’re talking about VM disks on TrueNAS writing stuff to disks…is that supposed to be another forum thread or is this related?

But if you let a VM write to the pool, it obviously stores data and is listed as used/allocated space

Per my statement ^above, I’m not testing this in Proxmox.

I am using a test environment to test how this behaves before I apply it to PROD.

Thus, I created the TrueNAS VM to facilitate testing this.

Again, this is solely to test how ZFS accounts for the space.

(For the record, on my PROD Proxmox server, my ZFS pools were created using the zpool create command, and NOT via the GUI. But as it pertains to this test with my test environment, I’ve now done it create the ZFS pool using the GUI (the first time around) and now I just finished re-installing the TrueNAS 24.10 VM, and created the ZFS pool using the ZFS CLI zpool create tank -m /mnt/tank raidz /dev/sd{b..e} and that results in an ALLOC of 224K before the home directory dataset is created, and before my non-admin user is created.

Creating the home dataset using sudo zfs create tank/home results in an ALLOC of 361K.

(it would appear that TrueNAS Scale doesn’t like it when I create the ZFs pool using the zpool create command above (and then creating the home dataset via the zfs create command, also above, because now I am trying to create the non-admin user, and it is complaining about some stupid NFSv4 ACL mode issue.)

Might have to remove/destroy the TrueNAS 24.10 VM and then re-install with a Proxmox VM, and do this all again.

sigh…

Which is what is normal. ZFS uses some space for bookkeeping. Scale always creates hidden datasets for everything. Kubernetes and shit has to live somewhere and you don’t want that on your boot disk, obviously.

Do you now know that ALLOC = used space? did you find what was using the 1.55G?

TrueNAS doesn’t like you using CLI in general. It’s for “support reasons” and they made things immutable too. Stick to the GUI and don’t go off-road because that will cause problems. I once created a dRAID in CLI and it bricked the entire system. Scale is nice if you stick to the GUI and do point&click, but is very unreliable and restricting for a Linux OS with ZFS. I only use Proxmox for ZFS because it just works. And I want my ZFS to just work.

No. As I mentioned, I ended up destroying the TrueNAS Scale VM where the ZFS pool was created via their GUI and then tried to create it using just the CLI, and then destroyed the TrueNAS Scale VM again, because I couldn’t add a user via the TrueNAS Scale GUI and ditched it in favour of running a Proxmox 8.2.5 VM, to re-run the tests.

Having said that, with said Proxmox 8.2.5 VM, and four 2 GiB “disks”, I re-created the ZFS pool tank using zpool create tank raidz /dev/sd{b..e} and then ran zpool list tank and it shows that the ALLOC size is 308K.

There are some nice features for the less advanced sysadmins (again, as my friends have correctly stated, I am a grossly underqualified sysadmin (I do it only because I have to, and not necessarily because I want to)), so there are some nice quality-of-life bits to the TrueNAS GUI.

But having originally used ZFS in Solaris 10 6/06 when it was first introduced in the “mainline” Solaris, where all of the ZFS administration had to be done with CLI, there was a LOT that I learned back then, when it was first rolled out, and ZFS on Linux/OpenZFS wasn’t the same kind of a thing like it is now.

Yes and I appreciate you explaining this to me.

That makes the whole ZFS space accounting thing make more sense to me now.

Thank you.

I have yet to stress-test dRAID using any system/OS/platform.

But that’s an entirely different story/thread.

Accessibility can’t be overstated. Be it the invention of the mouse or touch screen smartphones. It is what gets more people to the cool stuff we like to use. And this is a good thing.

Imagine those 200k as being the MBR reservation you see on disks. With enough reservation to add vdevs and alter pool config later on, or just writing zeros to add feature flags later because every new ZFS version brings nice and fancy feature flags.
There are talks to increase that to ~1G soon…because with increasing sector sizes on SSDs, 10-20 year old assumptions have to be adjusted.

dRaid is great for what it was designed for, large amounts of data with mostly >1M recordsize. It’s certainly not a good choice for your average and mixed data pool with 8k stuff on it.

I suppose that in theory, if you stuff the > 1M record size with enough 8k stuff, you’d still be able to fill said > 1M recordsize.

What would be interesting though, because I never got a chance to benchmark this, would be to see if traditional HW RAID arrays also use all of the drives in the logical volume group for the rebuild process or whether it’s just a few or the entire array itself, for said rebuild.

It is somewhat, rather unfortunate that because I was migrating from four servers down to one, which is why the bulk storage pool ended up being multiple vdevs, that now, if I want to migrate the bulk storage pool from using raidz2 to using draid2, that I would basically have to offload all of the data that’s currently on the pool (probably to tape), and then I would be able to completely destroy the pool, and rebuild it with draid2.

That would be quite the undertaking.

Mentally, I am still trying to think of the FMEA for dRaid (e.g. what happens if the configuration for the dRaid gets corrupted? How much of a PITA will it be for me to try and rescue the data from said dRaid pool?)

(cf. LTT trying to rescue/recover their data when their drives in their ZFS pool(s) started dying, somewhat unbeknowst to them.)