# ZFS and power outage: how to mountroot?



## zeiz (Dec 18, 2009)

Too bad...power cord was unplugged during vacuum cleaning...:\
First opportunity to see what happens with zfs after power cut.
So far familiar prompt : *mountroot>*
`mountroot> zfs:tank` doesn't help since there is no such a thing as "tank" in the list of valid boot devices but instead:
gptid/xxxx... gpt/disk0 gtpid/yyyyy... gpt/swap0 gptid/zzzzzz... ad12p3 ad12p2 ad12p1 ad12 acd0
None matches and nothing works.
Too bad... just yesterday night installed 9-current on zfs (first try) rebuilt from fresh sources, fresh ports, xorg, kde4...everything ran perfectly...too bad...
Does somebody know how to manage *mountroot>* under zfs?


----------



## zeiz (Dec 19, 2009)

bump...


----------



## tingo (Dec 19, 2009)

What happens if you load zfs (/boot/kernel/zfs.ko) first?
Do you then get the possibility to boot from zfs?
In my /boot/loader.conf, I have these two lines:

```
zfs_load="YES"
vfs.root.mountfrom="zfs:zroot"
```


----------



## zeiz (Dec 19, 2009)

Bingo! 
Well...almost...
Having no help I tried to escape to loader prompt and type:

```
OK set root=/tank/root
OK load opensolaris.ko
OK load zlib.ko ## it complained that cannot load z-libraries
OK load zfs.ko
OK boot
```
It booted again to mountroot> prompt but this time by typing `zfs:tank` I could boot to...single user prompt! So far so good. What's wrong with /etc/fstab? I just installed linux_base-f10 with routine creation and mounting of /usr/compat/linux/proc so I inserted the relevant line in /etc/fstab however the installation went to /compat/linux/proc instead (no idea).
/usr wasn't mounted and I couldn't mount it ("special file or filesystem"). I found vi in /rescue but it failed: "no terminal database..."
Finally I `# mv /etc/fstab /etc/fstab.old` and restored original /etc/fstab

```
# cat << EOF > /zroot/etc/fstab
 # Device                       Mountpoint              FStype  Options         Dump    Pass#
 /dev/gpt/swap0                 none                    swap    sw              0       0
 EOF
```
After reboot, I was taken to *mountroot>* again but this time kde4 fired up! Installation was alive but no sound and kde suggested to remove my sound devices...what a heck...I checked /boot/loader.conf and found it...empty!
Of course I restored it to:

```
zfs_load="YES"
vfs.root.mountfrom="zfs:zroot"
snd_hda_load="YES"
```
 and rebooted with sweet feeling that problem solved. 
Not quite. Something else is wrong because it cannot boot normally now: only to *mountroot>* prompt. Then it boots fine after `zfs:tank` but something else was changed, I cannot find so far what exactly.
I'm really happy that somebody is interested, thanks, *tingo*!
In general it means that nothing really terrible happened after the accident with power cord and zfs is do reliable. 
But anyway why it goes to *mountroot>* all the time now? I had the same while trying to install FreeBSD on usb-stick (just ufs), it always went to mountroot... What may be the reason?


----------



## tingo (Dec 20, 2009)

You are sure that you didn't write the wrong name for your pool then?
You write "zfs:zroot" in your /boot/loader.conf, but "zfs:tank" elsewhere?
What is really the name of the zfs pool you boot from?


----------



## zeiz (Dec 20, 2009)

Let me check. But I did many reboots before all that happened, but let me check...

Oh, gosh...indeed! Thanks a lot! Of course: the file was empty as I wrote and I typed again right what I saw in HOWTO instead of real name of my pool :e   So.. Long live ZFS!

You know, once I got my washer broken and I called my neighbor who was exactly specialist on this. He said he was busy and would come later afternoon. Well to make it cheaper I disassembled the washer on parts and was waiting for him. In meantime my wife got really crazy seeing a path to kitchen blocked with the parts and she forced me to assemble the washer back. When the washer guy came he asked me to turn the washer on and show how it fails to work. I turned it on and it started working perfectly! After I told the story with reassembling the guy smiled and said: "That's where we are making money!" :e


----------



## sixtydoses (Dec 23, 2009)

@zeiz - Lol. Bet the next time if your washer breaks again you'd fix it on your own


----------



## zeiz (Dec 23, 2009)

Yeah...that was long ago, I'm a troubleshooter now ...washer wise mostly :e


----------

