# FreeBSD 10.3 --> 11.0 zpool upgrade



## Vossy (May 9, 2017)

Hey everyone, 

I apologize in advance for my lack of knowledge.. I'm still new to FreeBSD. I need some help with my server.. It's a disaster. 

`zpool upgrade`

I then proceeded to follow up with the 

`# gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada4`

Rebooted and it's dead. 

I got 

```
gptzfsboot: error .......
```
and it goes on and on with errors

I don't know where to start or even how to start. Any guidance would be appreciated. 

Thanks


----------



## SirDice (May 9, 2017)

Try booting the installer CD/DVD/Memorystick image. There's an option to start a shell (instead of the install), see what `gpart show` outputs. You may have an EFI booting system in which case the GPT bootcode would be wrong.


----------



## Vossy (May 9, 2017)

hmm oks done that... not sure how i can get the output to here.. 

I have 2 hdd's for the system. Which supposedly are mirrored.. but i have doubts about that (another topic). 

I'm seeing 4 outputs on #gpart show. 

one set is ada0 / ada1 and another is diskid/DISK-WD- .... etc 

but i physically only have 2 hdds


sorry.. i'm still lost : / i not sure what i should be look for / at...


----------



## Vossy (May 9, 2017)

helpful?


----------



## ShelLuser (May 9, 2017)

Vossy said:


> I apologize in advance for my lack of knowledge..


Only do that when you give someone bad advice, then you have a reason to apologize; this forum was meant to help out, so yah 



Vossy said:


> `zpool upgrade`
> 
> I then proceeded to follow up with the
> 
> `# gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada4`


From where did you run this?  And _when_ did you run this?

Before of after the upgrade (for example)?

Boot CD will definitely help.



Vossy said:


> I have 2 hdd's for the system. Which supposedly are mirrored.. but i have doubts about that (another topic).


`# zpool list -v`



Vossy said:


> I'm seeing 4 outputs on #gpart show.


Known issue, hate that part myself too. GPart shows you both the physical entries (like /dev/ada0) and the virtual ones (through the labels). Even if they're all the same.

When in doubt `sysctl kern.disks` (as well as dmesg) can help.

We'd need the error though, why doesn't it boot...  Custom kernel?

Tried the bootcode command from a live cd yet?


----------



## SirDice (May 9, 2017)

Yeah, disks are going to show up more than once. That's not important. Look at the partitions it's showing, do you have a freebsd-boot or an efi partition?

Edit: Just looked at the picture. You have a freebsd-boot. This means it's using the "traditional" BIOS boot. The _index_ is important too, in your case that's 1 (one). 

This all means the command `gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada4` _should_ be the correct command, assuming ad4 is the correct disk. But you mentioned you have a mirrored setup. This means there's two disks that need this code and you have updated only one. It's possible the system actually boots from the other disk, this is the disk that hasn't been updated yet. 

Boot the system and figure out which of the two disks is actually ad4 and pull the other one. It's a mirrored setup so the system should be able to boot and work (although your mirror will be in a DEGRADED state). After booting connect the second disk again and write the bootcode to that too. The mirror will heal itself when both disks are available again.


----------



## Vossy (May 9, 2017)

Thanks for the support ShelLuser and SirDice...

Means alot to try and recover this...

I ran #gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada4
after i had upgraded to 11.0 and after i had done the #zpool upgrade zroot.

I've uploaded another pic of what the error is i'm getting when i try boot the server.. Maybe one of you could make sense of it more so..


ps- i'm pretty sure i don't have a custom kernel. The system is fairly stock out of the box you could say.


----------



## abishai (May 9, 2017)

What is ada4 ? From your setup it looks like you have ada0 and ada1. I think, your bootloader was not updated at all and can't pick up new zpool version.
If you have mirror, you should update bootcode for both drives (or at least drive BIOS picks first)


----------



## Vossy (May 9, 2017)

Thank Abishai.... 

I have given that a go. So i did #gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada0 and ada1

and i still end up with those errors. 

The #gpart show from above is coming from the boot cd shell. It appears to have changed the drive labels.

Hoping any one is able to help... or give ideas on what to do next?


----------



## ShelLuser (May 9, 2017)

Let's start with the beginning here: making sure your data is actually still intact. We could be sending dozens of suggestions, but it would be useless without being sure about this first.

SO...  Boot using your CD / memory stick / whatever boot media you have and select the live cd / live system option so that it'll boot with a FreeBSD environment.

Then check that it recognizes your disks (using `gpart show ada0`) after which you should try: `# zpool import -R /mnt zroot`. Note: I'm assuming your ZFS pool is actually called zroot, your system should tell you as if this is not the case so that you can use something else.

After that command run: `zfs list` to see if it recognizes your filesystems, you should also look into trying to mount your root filesystem if it hasn't done so already so that you can take a look at /mnt/boot to check for files such as loader.conf and the existence of the kernel.


----------



## Vossy (May 10, 2017)

ShelLuser said:


> Let's start with the beginning here:



Great idea.. 

> booted into live cd 
> #gpart show ada0
> #zpool import -R /mnt zroot 

and then I've come up against some more errors.. see in picture.. I do only have 4GB of RAM and its saying zroot maybe in use.. 

how should i proceed? 
sorry again for my ignorance.. i feel i'm way out of my depth here at the moment.


----------



## ShelLuser (May 10, 2017)

Vossy said:


> and then I've come up against some more errors.. see in picture.. I do only have 4GB of RAM and its saying zroot maybe in use..


Yups, that was my mistake. I wrote that command at a rather late time. Use -f, and don't worry: this won't have any negative effects. So: `# zpool import -fR /mnt zroot`. After that it should work. If you set up ZFS using the FreeBSD installer then you'll need to mount the root partition manually. Most likely you'll need something as: `# zfs mount zroot/ROOT/default`.

After that you should be able to access your disk through /mnt.


----------



## Vossy (May 10, 2017)

Ok so i have done: 

> #gpart show ada0
> #zpool import -fR /mnt zroot 
> zfs list 
> ls /mnt /

It appears that i can see the stuff on the drive and that it has worked. 
Do i need to run the #zfs mount zroot/ROOT/default command ? 

I guessing maybe not because i can see the drive in /mnt 

so.. What is the next step?


----------



## ShelLuser (May 11, 2017)

Vossy said:


> so.. What is the next step?


If possible list the output of `zfs list`, but if not: identify your root filesystem. If you let the installer handle all this then it's probably something like zroot/ROOT/default.

So after you performed all those steps (so boot with a rescue CD and import your ZFS pool again using `# zpool import -fR /mnt zroot`)) then run `zfs list`. The filesystem which is listed as being mounted directly on /mnt will be your root filesystem. Remember the name.

Now try using: `zpool get bootfs zroot`. We need to know the value it gives you, but we also need to know the actual root filesystem. If your ZFS root filesystem is any other than zroot then the value should be listed there, if it isn't then the value is probably default.

This is a guess on my part right now, but this could be the key to your problem here.

The issue: ZFS boots from your main pool (zroot) but the BSD installer, by default, doesn't use that as the root filesystem (for reasons _waaay_ beyond me) but instead sets up a descendant filesystem (such as zroot/ROOT/default). During the bootphase FreeBSD needs to know what the root filesystem is. If it's anything other than the main pool itself then the bootfs property should identify it. I'm guessing that this isn't properly set up on your end.

So...  On my main server I use zroot as the root filesystem (mounted on /) and therefor bootfs isn't set (default value). On my VirtualBox test environment the BSD installer set up zroot/ROOT/default. As a result bootfs is set on zroot and points to zroot/ROOT/default. This points FreeBSD to that filesystem as its main source to boot from.

If I'm right and those values don't match up then try using: `# zpool set bootfs=<your ZFS root fs here> zroot`.

Hope this helps.


----------



## Vossy (May 11, 2017)

woOoooO ok, so i think i understand where you are coming from with all of this.. (learning more every day 

Thankyou for explaining it. 

I have gone ahead and run  
> #zfs list 
> #zpool get bootfs zroot 

and i have attached the picture below to show the out put... 

If I've interrupted things correctly ... then all i need to do is run 

> #zpool set bootfs=/ zroot

would this be correct?

so that the system looks at / for the mount? and maybe it will be fixed? 

i shall wait to hear from you before i pull the trigger.. knowing my luck, if i do it before, i will break things more.  

thanks again.


----------



## abishai (May 11, 2017)

Current bootfs value is correct.
Anyway, we shouldn't see gptzfsboot errors with any bootfs value, it's too low level problem.

I suspect, the problem is particular hardware and particular FreeBSD version (i.e. regression in OS if you used 10.3 normally).
1. Is BIOS update available?
2. Is UEFI mode operational ?
3. Can you switch SATA controller options in different modes and check the issue? (IDE, AHCI...)
4. Do you have spare HDD you use in server ? You can try to install FreeBSD there and check. If not, try to find HDD with the same sector size (512 or 4k)


----------



## Vossy (May 11, 2017)

abishai said:


> 1. Is BIOS update available?


No updates available. 

i not entirely sure about #2 and #3


----------



## Vossy (May 14, 2017)

I feeling like this could be the end of my server as i know it 

I'm currently looking at cleaning up a HDD so that i can try a fresh install of Freebsd 11 and see if that works. 

I'm struggling to understand how 


Vossy said:


> zpool upgrade
> 
> # gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada4



turned into *see attached*


----------



## ShelLuser (May 14, 2017)

Vossy said:


> I'm struggling to understand how
> 
> turned into *see attached*


Well, when looking at the screenshots posted so far then none of them showed ada4. You mentioned having used ada4 in the opening post, but later screenshots only hinted at ada0 and ada1 to be present. You could try running `sysctl kern.disks` to discover once and for all how many and what kind of disks you're working on. After you've done that you could then apply the bootcode to thoses proper drives and places and see what happens next.


----------



## Vossy (May 15, 2017)

Sorry this is my fault for not being more detailed. 

Prior to the failure the drive was ada4.. 

Since the failure i have pulled out my 4 drive "tank" and then run the live CD, in doing so it appears to have allocated 'zroot' drives ada0 and ada1 now. 

Which i then went ahead and did: - 


Vossy said:


> #gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada0 and ada1


----------



## Vossy (May 16, 2017)

update.... 

So i have gone ahead and done a CLEAN install of Freebsd 11 onto my two drives mirrored. 

The system surprisingly boots however i'm still receiving this error at the very start after the DMI message. (show in attached) 

I'm still worried as to whats going on here.. 

Is this something to do with a corrupt GPT/MBR? Do the drives need to be wiped clean before the install? 

Looking at the problem further... it looks like the Partitioning scheme is the whole problem i think.

Any help would be greatly appreciated. Thanks to everyone out there.


----------

