# Upgrading Without Re-Downloading All Patches Or Files



## nx (Jan 20, 2011)

*My Problem*

Sometimes after starting an upgrade eg from 7.x to 8.1 the process will stop after failing to download all patches or files.
When I start the upgrade again, I would like it to resume from the last failed patch/file (including the failed one).
This would save me a lot of time and some bandwidth as some of my server upgrades require 30k+ patches and files.


*How I Upgrade*

I'm following the upgrading guide on the FreeBSD 8.1-RELEASE Announcement page: http://www.freebsd.org/releases/8.1R/announce.html
and using:

```
freebsd-update upgrade -r 8.1-RELEASE
```


*My Questions*

*1*. If the update failed to download all patches but did download and apply some - can the upgrade be resumed from that point - not have to re-download and apply the successful patches?

*2*. If the update downloaded and applied all patches but failed to download all files after - can the upgrade be resumed from that point - not have to re-download all patches (and apply them again) and already successfully downloaded files?

*3*. Is there any way to change the upgrade command to see the number of files that are downloaded or log this elsewhere - to get a sense of 'progress' like shown when patches are being downloaded?

*4*. Is it possible to log the patch/file downloading process to diagnose why downloads failed?

*5*. Are there any commands to download all patches and files first in a more robust way, so I know they are 'all there', and then run the upgrade from that point, possibly so identical servers could re-use these (like ports)?

*6*. If not all patches are downloaded, for example 10,000 patches are required but only 5,000 are downloaded and applied, and then the upgrade process starts fetching files - will the upgrade fail during file fetching because of this - or will the upgrade only be a partial upgrade even after following all the correct commands to complete the full upgrade cycle and FreeBSD reports a new version number?

*7*. On a slightly different topic - during the upgrade process is it better to portupgrade -faP or -fac or what? I've read various posts arguing for each and I'd like to get the upgrade process right.
(Sorry - I should put this in another post and tag the commands - will do after other questions answered, if that's ok?)


Your help would be appreciated by me and anyone else suffering long upgrades.

Thanks


----------



## phoenix (Jan 21, 2011)

Mentioning which process you are using for upgrades would be helpful.  I'm guessing freebsd-update(8)???


----------



## nx (Jan 21, 2011)

@phoenix,

Sorry mate - I had that info in my original post but no one replied so I abbreviated it and accidentally left it out.

I've update my original post to keep all info together.

Thanks!


----------



## SIFE (Jan 22, 2011)

> 1. If the update failed to download all patches but did download and apply some - can the upgrade be resumed from that point - not have to re-download and apply the successful patches?


I had never tested but I don't think so.


> 2. If the update downloaded and applied all patches but failed to download all files after - can the upgrade be resumed from that point - not have to re-download all patches (and apply them again) and already successfully downloaded files?


While the update success to apply patched there is no need to download files after because its already did, correct me if I don't understand you.


> 3. Is there any way to change the upgrade command to see the number of files that are downloaded or log this elsewhere - to get a sense of 'progress' like shown when patches are being downloaded?


You should have some shell knowledge, then start to edit this file /usr/sbin/freebsd-update.


> 4. Is it possible to log the patch/file downloading process to diagnose why downloads failed?


I don't know, generally I see what I get from the console after freebsd-update command fail.


> 5. Are there any commands to download all patches and files first in a more robust way, so I know they are 'all there', and then run the upgrade from that point, possibly so identical servers could re-use these (like ports)?




```
freebsd-update fetch
```
If you want to use this patches in other PC's you should create a server and edit /etc/freebsd-update.conf and set some modification to match your new server update.


> 6. If not all patches are downloaded, for example 10,000 patches are required but only 5,000 are downloaded and applied, and then the upgrade process starts fetching files - will the upgrade fail during file fetching because of this - or will the upgrade only be a partial upgrade even after following all the correct commands to complete the full upgrade cycle and FreeBSD reports a new version number?


It will not fail rather then it will download new patches if there are and apply theme, even if patch half of you system witch I don't think so because freebsd-update first download all necessary patches and then start patching.


> 7. On a slightly different topic - during the upgrade process is it better to portupgrade -faP or -fac or what? I've read various posts arguing for each and I'd like to get the upgrade process right.


The best is to read this /usr/ports/UPDATING first, I didn't try before to upgrade packages as binary so I don't know how to answer to this question.


----------



## nx (Jan 22, 2011)

THANKS SIFE for taking the time to reply to a lot of questions! 


Re:

1. Bummer! 

2. The freebsd-update process starts with a 2 part download process - patches then files.
   Thus unfortunately my question remains - how to download failed (to download files from the last failed file and including it) without downloading and applying all patches in the phase before this again? This is what freebsd-update does, and I have unfortunately 'tested' too many times. =)

3. Thanks - I'm a noob that may almost be 'graduating' to 'noob-intermediate' and I may be up to that! I didn't even consider it. I looked at the freebsd-update man page and didn't see an option to log/print download progress so assumed something more 'complex' could be done via a pipe or something using another prog. I will spend the rest of my life trying to hack this - it will give me something to do while waiting for upgrade/update files to 'invisibly' download. 

4. What do you see from 'the console after freebsd-update command fail' when downloading the files after downloading the patches? I only see something like 'xxxxxx files downloading... failed' (from my memory). There is nothing else printed to console.

5. AWESOME - your reply here may have made all my other questions redundant! THANK U!!!

6. The problem is that freebsd-update doesn't always download all patches before applying what it has downloaded (if connection flakes out at one end) - and then it moves onto the next download phase - downloading files. But this may be no problem for me now as I'm going to try your suggestion in reply to 5.

7. Thanks, I read up on portupgrade - found some more forum info on it, and am no longer using -faP. I'll also look at the link you provided.


Thanks again mate!

Any one else want to try to fill in the blanks here?

(Sorry for so many questions!)


----------



## SIFE (Jan 22, 2011)

> 4. What do you see from 'the console after freebsd-update command fail' when downloading the files after downloading the patches? I only see something like 'xxxxxx files downloading... failed' (from my memory). There is nothing else printed to console.


Like what you say , nothing more or less.
I forget to post this link, how to build you own server update.


----------



## nx (Jan 22, 2011)

Thanks so much SIFE for all your help!

Your link above to building a FreeBSD Update Server is exactly what I've been looking for! 

Unless others can answer some of the outstanding questions, I'm going to assume that freebsd-update has the limits that I've found ie having to re-download and apply all patches again (in a second update attempt) after failing to download any files after patches in a first update attempt, and the only answers/solutions are 'this is the way it's done for now'.

However, thanks to you, I have enough new info that I should be able to update more easily and stop the limits of freebsd-update (and my 'noobness'=) wasting my time/bandwidth.

Thanks again mate!!!


----------

