How to calculate -bs argument for zfs_revert.py script for TrueNAS/FreeBSD

mdedetrich

Dabbler
Joined
Jul 9, 2021
Messages
16
Hello everyone!

I currently have an issue where a ZFS RAIDZ2 pool got corrupted with quite a lot of data/disks on the pool. After doing a lot of research and finding other people with similar issues, it appears that using the zfs_revert.py that is floating around on the internet is the best solution for this issue (since I don't really care much about the latest data that was written to the pool when the corruption happened). For more context/history, see https://github.com/openzfs/zfs/issues/6497#issuecomment-868322796 (and the thread in general).

I have already found a tgx which is not corrupted that I want to revert to, the only remaining issue is how to provide the -bs argument for the zfs_revert.py script. At https://github.com/openzfs/zfs/issues/6497#issuecomment-629821144, mdunlap mentions that you can use blockdev --getsize64 /dev/sda to get the blocksize for each disk however it appears that this command doesn't exist in TrueNAS/FreeBSD according to https://forums.freebsd.org/threads/blockdev-in-freebsd.63881/ .

So this leaves me to my problem, I can't seem to find a way to calculate the -bs argument on TrueNAS/FreeBSD which (I think) the script requires because the way the script works is it zeroes the uberblocks until a specific tgx (hence why it needs the blocksize since it needs to know many bytes to zero). Or maybe the -bs is just not needed for TrueNAS/FreeBSD, if so I would like to get confirmation for this since understandably I don't want to make a mistake.

Can anyone help out here?
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,700
You might think about running some kind of live linux distro that has (or where you installed) Open ZFS 2.0 (or higher).

Booting from an alternate install media on your existing box allows you to potentially run whatever command you need on the pool disks before then booting back into TrueNAS.

The obvious warnings about make sure not to perform any write operations on those pool disks with the other OS go without saying... even if I still said them.
 

mdedetrich

Dabbler
Joined
Jul 9, 2021
Messages
16
You might think about running some kind of live linux distro that has (or where you installed) Open ZFS 2.0 (or higher).

Booting from an alternate install media on your existing box allows you to potentially run whatever command you need on the pool disks before then booting back into TrueNAS.

The obvious warnings about make sure not to perform any write operations on those pool disks with the other OS go without saying... even if I still said them.

I actually already tried booting into Linux but unfortunately for some reason my HBA (Adaptec RAID 72405) even when its set to HBA mode (i.e. JBOD) is not being detected in Linux which is very odd.

Is there some kind of FreeBSD port that has the same functionality as the blockdev command?
 
Top