Solved FreeBSD 11.4 - Error when booting after electricity cut

Hello everyone,
Hope you are fine.

I've FreeBSD 11.4 on a virtual machine ( VirtualBox ) and I've been working on some projects on that virtual.
But unfortunately after a electricity cut, it gives me an error while booting, as you can see on the screenshot:
vm_error.png


I've searching for a solution for some time now but I didn't find anything that could help me fix this... I've trying the solution of other related cases but without any success.
When I try "ufs:/dev/ada0p3" or "ufs:ada0p3", per instance, it gives me an error:
error_when_disk.png


I've tried with every single disk that shows up:
disk_devices_vm.png


I don't have enough knowledge in FreeBSD. I'm using a VHD from a friend to develop some projects and let them run on the virtual machine.
If not possible to recover the normal state of the machine, it's possible to recover the data?
My first priority it's the data itself. I have many weeks of work there and I can't imagine losing them...
I completely forgot to backup de data to my machine and It's my fault for that.

vm_settings.png


I would appreciate some help on this topic. I've tried everything on my side but with the little knowledge that I have I couldn't do much..

Thanks in advance.

Regards,
Eder
 
When I try "ufs:/dev/ada0p3" or "ufs:ada0p3", per instance, it gives me an error:

That can't work, the file system of the VM is ZFS, not UFS2.

If not possible to recover the normal state of the machine, it's possible to recover the data?

First make a clone of the VM, further operations make on the clone.

After booting a installation CD you could try to import the pool. Add the installation .iso in Settings --> Storage, Storage Devices, Controller: SATA | IDE, optical disk, save, make sure in Settings --> System, Boot order, Optical is on top, boot VM. If you have difficulties to figure it out or don't know how to import the pool, please ask.

xz compressed image ~77 MB:
or uncompressed image ~335 MB:
 
First make a clone of the VM, further operations make on the clone.

That is pretty much the best suggestion ever when it comes to trying to resolve media problems. Always work on a copy. Never touch the broken original before you know 150% what's up and what to do. Even then it's best to have another copy around for the unexpected.
 
That can't work, the file system of the VM is ZFS, not UFS2.



First make a clone of the VM, further operations make on the clone.

After booting a installation CD you could try to import the pool. Add the installation .iso in Settings --> Storage, Storage Devices, Controller: SATA | IDE, optical disk, save, make sure in Settings --> System, Boot order, Optical is on top, boot VM. If you have difficulties to figure it out or don't know how to import the pool, please ask.

xz compressed image ~77 MB:
or uncompressed image ~335 MB:


Hello T-Daemon,

First of all, thank you so much for answering!
I've done it like you said (or I tried):
vm_boot.png


I've created a clone from the one I was using and I've added the .iso on "Storage Devices".
On other topics, about importing the pool, I can see that I need to choose "Shell" first. I even tried some commands from those topics but without success.
I'm sorry before hand. I don't know much about FreeBSD and this error never happened to me.

If you have difficulties to figure it out or don't know how to import the pool, please ask.

If isn't much to ask for that, I would appreciate it, please.
I'm sorry for being so dumb on this topic, probably this is basic.


That is pretty much the best suggestion ever when it comes to trying to resolve media problems. Always work on a copy. Never touch the broken original before you know 150% what's up and what to do. Even then it's best to have another copy around for the unexpected.

Hello ekvz,
You are right. I should have done some copies time to time, just in case, a kind of backup. But this never happened to me! but there's a first time for everything and I've learned my lesson for the next one.



Thanks in advance guys!

Regards,
Eder
 
I'm sorry for being so dumb on this topic, probably this is basic.

No need to apologies, and I wouldn't use the designation dumb, a more appropriate expression would be inexperienced, as we all where inexperienced at some point.

To the case, please enter Shell, execute only zpool import and post the output.
 
No need to apologies, and I wouldn't use the designation dumb, a more appropriate expression would be inexperienced, as we all where inexperienced at some point.

To the case, please enter Shell, execute only zpool import and post the output.

Hello T-Daemon,

Like you asked:
pool_vm.png


I've tried with the zroot, to import it like I saw in other related topics but it says that this pool is in use from other system.

Thank you so much!

Regards,
Eder
 
I've tried with the zroot, to import it like I saw in other related topics but it says that this pool is in use from other system.

Did you try as the message would have said, to use -f option? You cannot do an import from a crashed pool because the system still thinks it's active. The -f option tells it to ignore its worries and continue. You can also use the -F option to try to make it importable. Also the -n option to see if that's even possible.

Don't use -F -n with -f, though, just in case my statement confused you.
 
That looks very good.
Please execute following commands:

mkdir /tmp/zroot

zpool import -o readonly=on -fR /tmp/zroot zroot

I suppose you have your work in a users directory, you'll find them in /mnt/zroot/usr/home.
The easiest way to transfer the data would be on a external thumb drive on the host system, or another virtual disk ( needs first created).
 
That looks very good.
Please execute following commands:

mkdir /tmp/zroot

zpool import -o readonly=on -fR /tmp/zroot zroot

I suppose you have your work in a users directory, you'll find them in /mnt/zroot/usr/home.
The easiest way to transfer the data would be on a external thumb drive on the host system, or another virtual disk ( needs first created).

Hello T-Daemon,

I did what you said. I've created a folder in tmp with the name of zroot and I tried the zpool import command like yours. But it gives me an error:
zpool_import.png


I suppose you have your work in a users directory, you'll find them in /mnt/zroot/usr/home.

Exactly. to be more precise. I've some folders inside of /usr/ that have some of my work too.



Did you try as the message would have said, to use -f option? You cannot do an import from a crashed pool because the system still thinks it's active. The -f option tells it to ignore its worries and continue. You can also use the -F option to try to make it importable. Also the -n option to see if that's even possible.

Don't use -F -n with -f, though, just in case my statement confused you.

Hello mark_j,
I already tried with only "-f" flag but it gives me same error like the screenshot



Definitely no need to apologise. And posts like yours leave a good trail for what to do for the next person who hits this issue. And reminds us all about backups.

Good luck!

Hello richardtoohey2,

Thank you for your kind words.
Definitely that backups are always important. And I can say that it is true in my case! ?


Thank you so much guys and thank you T-Daemon for taking the time to help me so far!

Regards,
Eder
 
This sounds familiar to your problem:
EDIT: Note: In the blog they mention FreeBSD10 and using the "Live CD"-Feature, not Shell


Hello Zvoni,

I've tried with the link that you sent and it worked! At least I tried even with some different changes and the copy that I made is now working! Oh gosh, I'm super excited.
In any case, I'll try to save the data that I had there, since that was the most important thing on my side.

I can't thank you enough guys, for real. You helped me a lot. Without your help I probably would lose everything that I have been working for weeks...
And I also want to thank T-Daemon specifically, being the first person to respond to the topic and who has been helping me ever since. My most sincere thanks!

Just to resume for anyone like me, with the same problem or even with the same knowledge:

First make a clone of the VM, further operations make on the clone.

After booting a installation CD you could try to import the pool. Add the installation .iso in Settings --> Storage, Storage Devices, Controller: SATA | IDE, optical disk, save, make sure in Settings --> System, Boot order, Optical is on top, boot VM. If you have difficulties to figure it out or don't know how to import the pool, please ask.

xz compressed image ~77 MB:
https://download.freebsd.org/ftp/releases/amd64/amd64/ISO-IMAGES/11.4/FreeBSD-11.4-RELEASE-amd64-bootonly.iso.xz or uncompressed image ~335 MB:
https://download.freebsd.org/ftp/re.../11.4/FreeBSD-11.4-RELEASE-amd64-bootonly.iso
To the case, please enter Shell, execute only zpool import and post the output.
mkdir /tmp/zroot

zpool import -o readonly=on -fR /tmp/zroot zroot
This sounds familiar to your problem:
EDIT: Note: In the blog they mention FreeBSD10 and using the "Live CD"-Feature, not Shell

And again, thank you guys, for real!
I wish you all the best !


Regards,
Eder
 
Back
Top