ZFS Trying to recover a damaged (virtual) ZROOT partition

Dear all,
this time my VM has broken badly, looks like the boot loader got corrupted.
I do not why, I think is a bug maybe, but every time I do a big third parties upgrade or a system upgrade, I always get an I/O failure with the zpool detached. I have been always able to reboot without issues, but this time looks to corrupted is the boot partition.
I think that GELI + ZFS + Virtualbox + USB Drive as Storage + Win10 as host is too much unreliable.

I am not trying to repair anything I'd like just to mount the data partition (freebsd-zfs) and to recover some config files, then I think I'll create a new VM based on UFS.

The point is that I am not able to mount the zfs partition, a simple:

# mount /dev/ada1p3 /mnt

gets: "no such file or directory".

I also tried # zpool import but I got: "no pools available to import".

For sure I am doing something wrong, but do not know what... ?

Thanks,
freezr
 
mount /dev/adap1p3 /mnt
Take a closer look at that drive. There's supposed to be a number after ada, as in ada0, ada1, etc. Then a partition number, p1, p2, etc. You have no drive number and two partitions here.

That's beside the fact that you cannot mount ZFS this way. You will need to import the pool first.

I also tried # zpool import but I got: "no pools available to import".
Two possibilities here, first, no drive is attached that has a pool on it. Second, partition is so corrupted it's not even recognized as a pool anymore. The latter is rather doubtful, as the information is written to disk twice for good measure, at the start and again at the end of the partition.
 
Sorry, mine was a typo, on the "Recovery VM" the name of the partition was written correctly using tab+autocomp...

Also fsck is complaining for instance:

# fsck /dev/ada1p1

gets:
Code:
** /dev/ada1p1
Cannot find file system superblock

I noticed the name of the partition end with %, is this bad?
 
I found one thing wrong, you can't mount a ZFS dataset however the OS doesn't recognize any pool in the "broken" disk...
 
fsck(8) is for UFS. It doesn't understand ZFS. ZFS has its own fault recovery.

What does gpart show output? And file -s /dev/ada1p1?
 
noticed the name of the partition end with %, is this bad?
Nope. It's supposed to be there. (It's not part of the filename, its an indicator ls(1) adds).

Code:
     -F      Display a slash (‘/’) immediately after each pathname that is a
             directory, an asterisk (‘*’) after each that is executable, an at
             sign (‘@’) after each symbolic link, an equals sign (‘=’) after
             each socket, a percent sign (‘%’) after each whiteout, and a
             vertical bar (‘|’) after each that is a FIFO.
 
Some screenshots...

GPART:

01-gpart.png


LABELS are corrupted (?)

02-labels.png
 
Maybe it easier trying to fix the boot partition... Not sure though...

I found this code on the handbook:

Code:
# gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada1

Even though I am pretty sure that running random commands won't solve any issue... ?
 
I assume you are trying to get to the encrypted FreeBSD ZFS on ada1 from the non-encrypted UFS2 ada0.

was ada1p3 using geli encryption ?
Correct, however is decrypted at boot time.
That is not the case. The passphrase is asked at the very beginning, before the FreeBSD boot menu (the geli(8) provider was initialized with the -g option) and temporary stored as a loader(8) environment, to be hand over to geli(8), but the provider isn't attached (decrypted) during boot, because the geom_eli.ko module isn't loaded from within the UFS2 FreeBSD system ( /boot/loader.conf).

When in UFS2 FreeBSD, load the geom_eli.ko module, execute
geli load
attach (decrypt) the provider:
geli attach ada1p3
enter the passphrase.

Check if ada1p3.eli is created, execute geli status, afterwards execute zpool import. The "zroot" pool should be ready to import, if intact.
 
T-Daemon

Thank you very much, your guys are truly amazing!

Unfortunately the partition seems to be unrecoverable:

05-zpool.png


With the option -FX I was able to import the pool, I am scrubbing it now... However I suspect that ZFS+Virtualbox+Win10 is an dangerous combination, I will use UFS for the next VM...
 
Well know I have another issue to solve, the pool is imported but where are the files and folders?

The zroot folder is empty and the current system hasn't been overwritten although the command zfs list -r zroot shows up the original mountpoints...

Should/can I mount the pool on a different mountpoint? But how?

Thanks in advance! ?
 
However I suspect that ZFS+Virtualbox+Win10 is an dangerous combination,
No, it's more likely the combination with geli(8) actually. ZFS on Virtualbox works just fine. But geli(8) adds a layer between ZFS and the disk itself. If the disk has an issue, geli(8) freaks out and ZFS is completely lost on that.

The zroot folder is empty and the current system hasn't been overwritten although the command zfs list -r zroot shows up the original mountpoint...

Should/can I mount on a different mountpoint? But how?
Add -R to the zpool import command.

Code:
             -R root
                     Sets the cachefile property to none and the altroot
                     property to root.
Use /mnt for the 'altroot'. Then all the ZFS filesystems will be mounted under there (so it doesn't 'overlap' with the filesystems from the boot disk you used).
 
Back
Top