Cannot find zfs cache file on proxmox

I cannot find a cache file for one of my pools in proxmox. I have tried to check the /etc/zfs folder and there is a cache file which shows me other pools but the one I’m interested in is missing. I’m trying to find out what ashift value did the automatic procedure roll for that pool and afaik I would need to have a cache file to get zdb to tell me that information. Please do correct me if I’m wrong.

What if you did zpool get cachefile <poolname> ?

To tack on to @great900jeans’s answer, zpool get ashift <poolname> will give you exactly the info you’re really after without having to mess with zdb.

Says

NAME       PROPERTY   VALUE      SOURCE
data-pool  cachefile  none       local

Nope it does not. The value has been automatically determined by zfs on pool creation and as such it reports just the following:

zpool get ashift data-pool
NAME       PROPERTY  VALUE   SOURCE
data-pool  ashift    0       default

As far as I know, you could do zpool set cachefile="" data-pool and then it should put it in the default spot.

https://openzfs.github.io/openzfs-docs/man/v0.7/8/zpool.8.html#cachefile

This is assuming you’re using newer zfs (unsure when this came in though I would assume it’s been around for a while.)

You might have to export and import the pool though to trigger it.

I would appreciate someone confirming what I said before you try it personally.

A value of zero means the default value for ashift was used. The default value for ashift is set at vdev (not pool!) creation time, and is immutable to that vdev (not to the pool! you can have multiple ashift settings inside the same pool).

So, what’s the default ashift value? Unfortunately, it’s whatever the drive reports as its physical sector size. Why “unfortunately?” Because some gear, ESPECIALLY consumer SSDs, is really bad about lying about its physical sector size. The most notorious example of this would be the Samsung 8xx series of consumer SSDs, which lies and claims it has a 512B physical sector size, despite its actual page size being… well, a lot larger than that. We’re not entirely sure. But they definitely perform VASTLY better with ashift=12 (4K sector size), and a little better than that with ashift=13 (8K sector size).

So, anyway, if you want to know the actual ashift value of a vdev that shows “0” when querying with zpool get or zdb, you need to check the reported physical sector size of the drives in the vdev… assuming, of course, that the vdev still has its original drives, because if the drive you pick isn’t the original drive, it may not match up!

You find the reported physical sector size using blockdev, on Linux systems. Here is one of the aforementioned (and accursed) Samsung 860 Pro SSDs, in a pool on one of my systems:

root@banshee:/# blockdev --getpbsz /dev/sda
512

There you have it: that lying little bastard is pretending to have a 512 byte Physical Block SiZe. Note that we had to use blockdev -getpbsz here; if we’d simply asked for blockdev --report we’d get what looked like a sector size of 4K, despite that being neither what the drive reports nor how we’re actually using it (I’ve set ashift=13 on this vdev).

2 Likes

Thanks. It seems I did have 512 blocksize devices in this mirror with some 4k disks so I’m not sure what value would the zfs set the ashift value as. I would assume 4k would be optimal as it does not degrade the 512bs device performance either and that would not make the 4k disks suffer.

I got the cache file created using this and now I could check the ashift value with zdb -U /etc/zfs/zpool.cache of the mirror vdev and it looks to be 12 just as I hoped for :slight_smile:
image

2 Likes

Glad it worked out. :slight_smile:

I went through a similar panic attack at one point trying to figure out how to extract this information from Proxmox. Just like with your install, the cache file wasn’t where standard ZFS tutorials say it is. So, this seems like one of those Proxmox ZFS Things.

Proxmox is supposed to select ashift=12 by default on SSDs on fresh installs, and it’s done this fine the last couple times I’ve installed it over the last couple of years, but you should definitely be paranoid about this sort of thing. It was still using ashift=9 as default the first time I installed Proxmox 7, a long time ago now.

If you ever need to install Proxmox again, when you set up your ZFS install (select disks, etc.), go into the advanced config and you can see the ashift value and change it if you need to.