Purpose of creating partitions on ZFS Disks

gogoFC

New Member
Jul 28, 2023
9
0
1
Hello


I want to ask what is the reasoning behind creating partitions on Disks when creating a ZFS pool?

There are no valid reasons as far as I know.

All other implementations of ZFS in OSs like FreeBSD, Oracle, Linux, SmartOS, Illumos do not force partitions on Disks.

To me it's much cleaner to work with ZFS without partitions.
Well Proxmox does make it easier working with ZFS with partitions by automatically creating partitions. Everything works fine in ZFS but with partitions.

The docs state that the reason is that some devices are different in size while claiming to be of one size.

If you try to add those this is what happens anyway:
Code:
invalid vdev specification
use '-f' to override the following errors:
mirror contains devices of different sizes

You can't add those anyway and Proxmox doesn't really calculate the size of the smaller disk so that it can create two same size partitions.

There's no restrictions in creating a stripe with different sized disks.

ZFS uses a ZFS label to tell which disks belong to which ZFS pool, it does't need partitions.

On root pools partitions are necesarry because of boot partitions.

But on storage pools, why is there a 8 megabytes partition? Does it really help?

Code:
Device          Start        End    Sectors  Size Type
/dev/vdd1        2048 1048557567 1048555520  500G Solaris /usr & Apple ZFS
/dev/vdd9  1048557568 1048573951      16384    8M Solaris reserved 1

If the Disks are different in size ZFS won't let them be in a mirror vdev anyway. And if you cut off 8MB from each disk they'll still be different in size only the difference will be 8MB smaller.

So we have:

A Disk of 7782 GB (7782000 MB)
A Disk of 7987 GB (7987000 MB)

Then those become 7781992 and 7986992 when we cut off 8MB. That's about 205GB difference in those disks and that will not be added to a mirror vdev.

Excuse the rant. I don't like partitions.
 
Last edited:
But on storage pools, why is there a 8 megabytes partition? Does it really help?
I don't have the source right now, but if I remember correctly this is because some HDDs/SSDs have a few Bytes less space than others.
If you want to replace a disk (using ZFS), the new disk needs to have equal or more space on it. The 8 MB partition is a buffer for that. If the new disk is a little smaller than the old one, the 8 MB partition will be shrunken.

Edit: Disks in a mirror must always have the same size. This is the same for RAID controllers. If they have different sizes, they will use the smaller disk size.
Normally you will use a mirror write the data on each disk so the smallest disk size in the array needs to be used.
 
Last edited:
I don't have the source right now, but if I remember correctly this is because some HDDs/SSDs have a few Bytes less space than others.
If you want to replace a disk (using ZFS), the new disk needs to have equal or more space on it. The 8 MB partition is a buffer for that. If the new disk is a little smaller than the old one, the 8 MB partition will be shrunken.

Edit: Disks in a mirror must always have the same size. This is the same for RAID controllers. If they have different sizes, they will use the smaller disk size.
Normally you will use a mirror write the data on each disk so the smallest disk size in the array needs to be used.
Hey thanks for the reply. Yeah I get that, the logic behind it. But it doesn't really work. You can try to add a different size disks in Proxmox and it will not let you. So the purpose of the 8MB isn't to let you have different size disks because it doesn't do that.
I think this was just inherited from back in the day when someone thought this was a good idea and it's still in Proxmox version of ZFS.

If you have a Disk of 1TB minus 8MB and a 2TB minus 8MB that doesn't do anything, they're still different. You would have to partition the disk yourself manually. Proxmox doesn't do that.

So this really should be taken out from the source code in my opinion because if for example you have a 1TB single disk pool and you want to attach a 2TB disk to the pool and make it a mirror you woudn't create a 8MB partition on the 2TB disk right? You would create a 1TB, but in Proxmox way you would have to create a 1TB minus 8MB so it's the same. Actually ZFS doesn't care about 10MB it will still add the disk with that small of a change.

This is literally one grain of sand in a desert.
8MB out of 12TB

Yeah it's weird, someone's gonna have to try really hard to convince me that this is a good thing.
 
So the purpose of the 8MB isn't to let you have different size disks because it doesn't do that.

Correct, this is legacy for Solaris / Illumos, you can safely delete it.

I think this was just inherited from back in the day when someone thought this was a good idea and it's still in Proxmox version of ZFS.

Proxmox do not have own ZFS, they cherrypick from upstream. You don't have to create pools with these partitions, in fact people who e.g. install on LUKS do not, obviously.

If you have a Disk of 1TB minus 8MB and a 2TB minus 8MB that doesn't do anything, they're still different. You would have to partition the disk yourself manually. Proxmox doesn't do that.

There's some some space tolerance for different sized disks built into ZFS, nothing to do with the reserved partition. It's up to metaslab size. On modern disks, you have tolerance of several GBs. You can get details with zdb.
 
Last edited:

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!