# Upgrade to 12.0 is extremely slow



## Toolforger (Jan 31, 2019)

Not sure whether this is a problem or just to be expected, there's the situation:

I have a NAS with FreeBSD booting off an USB stick.
It was installed last year with 11.2-RELEASE, and I'm running the upgrade to 12.0, following the instructions in https://www.adminbyaccident.com/fre...upgrade-freebsd-from-version-11-2-up-to-12-0/ .
I got the system upgraded to -p8 with no problem, the kernel upgrade too with no problem, but the "freebsd-update install" after the reboot into the new kernel is taking AGES - it's been chewing on that for over an our.

ps tells me it's having two processes running "/bin/sh /usr/sbin/freebsd-update install", one in state S+, the other in state I+. The letter has a constant time 0:03:44 (I assume that's CPU time spent), the former has 0:01.02, which is incrementing very slowly.

Machine has ZFS and I'm using beadm, which was surprisingly slow to create boot environments, somewhere between 5 and 15 seconds.

I _suspect_ it's just slow USB writes that are slowing the process down, but is there any way to verify that?
Is there a way to estimate how long it is going to take until it's done, or how many percent of the total update it has already done?

(Personal background: Longtime Linux desktop user and small-scale root server admin, started to learn FreeBSD last year, haven't been finding much time to learn much so still at pretty basic level of understanding.)


----------



## Datapanic (Jan 31, 2019)

If the USB stick is not write cache enabled, it is going to take a long time to do the update.
I think you can use something like...

```
camcontrol start /dev/da1
camcontrol modepage /dev/da1 -m 0x08 /dev/da1|grep WCE
echo "WCE: 1" | camcontrol modepage /dev/da1 -m 0x08 -e
```
this assumes that /dev/da1 is in fact your USB stick.
If the second line returns a blank line or If the last command comes back with something like `camcontrol: no such modepage entry "WCE"`, then you cannot cache writes and it is going to take forever.


----------



## swegen (Feb 1, 2019)

You can also use the gstat(8) utility to monitor the current I/O-queues and transfer rates.


----------



## Toolforger (Feb 1, 2019)

Nah, the stick is write-enabled, I did OS configuration on it and it downloaded the updates just fine.
Turns out the file upgrade step was indeed just awkwardly slow, but it is telling me that it finished just fine.
gstat noted for future reference, that's going to give me a clearer idea if it's slow again.


----------



## Beastie (Feb 1, 2019)

Datapanic said:


> If the USB stick is not write cache enabled, it is going to take a long time to do the update.





Toolforger said:


> Nah, the stick is write-enabled, I did OS configuration on it and it downloaded the updates just fine.


Write enabled =/= write cache enabled. I just had a feeling there was some confusion here. If not, then don't mind me...


----------



## drhowarddrfine (Feb 1, 2019)

Toolforger said:


> following the instructions in https://www.adminbyaccident.com/fre...upgrade-freebsd-from-version-11-2-up-to-12-0/ .


I didn't read any of that. All I saw was blah, blah, blah...
The Handbook says to do what I did and accomplished in a couple of minutes or so--though not with a usb drive and that boils down to:
`freebsd-update fetch
freebsd-update install`
I don't understand why some third party site is needed for this.


----------



## Toolforger (Feb 1, 2019)

Beastie said:


> Write enabled =/= write cache enabled. I just had a feeling there was some confusion here. If not, then don't mind me...



Ah ok, I missed the "cache" bit.
No idea. Do I have to explicitly enable this? If yes, where can I read up on the topic?


----------



## Toolforger (Feb 1, 2019)

drhowarddrfine said:


> I don't understand why some third party site is needed for this.



The handbook doesn't say to what version it applies, so it's helpful to double-check that things are indeed as described in the handbook.
Besides, it was the first thing that the search engine spat out, it seemed reasonably knowledgeable, it gave me expected reactions (invaluable for double-checking).
Finally, I mentioned it just so people know my knowledge source; this was not an endorsement.


----------



## drhowarddrfine (Feb 1, 2019)

Toolforger said:


> The handbook doesn't say to what version it applies


Everything in the Handbook applies to the current version which is what you should be using.


----------



## Toolforger (Feb 1, 2019)

drhowarddrfine said:


> Everything in the Handbook applies to the current version which is what you should be using.



Well, do do I know... besides, I did see mentions of "this section of the handbook is outdated", so I guess it's wise to use multiple sources.
Besides, I tend to follow the first few search engine hits and see what kind of consensus emerges, then follow whatever instruction set looks most useful for the situation, personal perspective, and mood.


----------



## drhowarddrfine (Feb 2, 2019)

Toolforger That hit and miss strategy is needed for Windows where Microsoft offers nothing to the consumer for help.  That is the worst you can do for professional systems. Consult the source first. If you don't understand, ask questions here, the mailing lists, or then Google for other answers. People who use FreeBSD are a cut above but the handbook and mailing lists are by the developers of the system and should be your first source.


----------



## Datapanic (Feb 2, 2019)

Toolforger said:


> Ah ok, I missed the "cache" bit.
> No idea. Do I have to explicitly enable this? If yes, where can I read up on the topic?



To get back on topic, if your flash drive does not have write cache, then you are not going to be able to enable it.

A while back, I think 2015, there was a popular article about setting up a NAS with a ZFS pool and USB flash drives to boot FreeBSD on.  It's an okay setup unless you do write intensive tasks such as building ports.  And as you experienced, major updates will take forever.  I think it's better to setup a Root on ZFS box and ditch the USB flash drives.  That way, you can mirror your boot partition (if you want) on the disks.  The downside is that unless you previously reserved some space to install a boot partition on the ZFS disks, you are going to have to re-partition them and reinstall everything from scratch.


----------



## Toolforger (Feb 2, 2019)

drhowarddrfine said:


> Toolforger That hit and miss strategy is needed for Windows where Microsoft offers nothing to the consumer for help.  That is the worst you can do for professional systems. Consult the source first. If you don't understand, ask questions here, the mailing lists, or then Google for other answers. People who use FreeBSD are a cut above but the handbook and mailing lists are by the developers of the system and should be your first source.



Well, what can I say... I saw mentions of "the handbook is slightly outdated on topic so-and-so", so I couldn't assume that it's as authoritative as you make it out.
Besides, a single presentation doesn't fit all minds, so it's still valid to consult other sources.
So... please be nice to people who have a different approach, even if you disagree with it; they aren't all idiots, you know.



Datapanic said:


> To get back on topic, if your flash drive does not have write cache, then you are not going to be able to enable it.



Ah ok.
I  thought you were talking about ZFS writing out data more often than necessary because it thinks an USB drive is removable.
Is this a thing?



> A while back, I think 2015, there was a popular article about setting up a NAS with a ZFS pool and USB flash drives to boot FreeBSD on.  It's an okay setup unless you do write intensive tasks such as building ports.  And as you experienced, major updates will take forever.  I think it's better to setup a Root on ZFS box and ditch the USB flash drives.  That way, you can mirror your boot partition (if you want) on the disks.  The downside is that unless you previously reserved some space to install a boot partition on the ZFS disks, you are going to have to re-partition them and reinstall everything from scratch.



Mmm... feasible. It would take me a few hours because installation and setup are a lengthy (but documented) process.
OTOH I'm not sure that it's really worth it. The updates are started manually but the slow process finishes unattended, so I can let that run overnight and have no


----------

