What's the "right" way to upgrade?

A very stupid question, which will indicate how clueless about FreeBSD I actually am.

I have been running FreeBSD for about three years now, coming from a long history of many Unix-like OSes (including a long stint using OpenBSD, Linux since 0.99.13, and so on). But there is one thing I've never had to do, neither with OpenBSD nor with FreeBSD: upgrade a BSD-based system in place. So far, I've always had to move to new hardware (and therefore re-install the OS from scratch) frequently enough that the base install hasn't become obsolete, without any upgrading.

By now, I'm down to having a single server at home, a FreeBSD 9.0 machine, which has been running pretty happily for 1.5 years. No updates have been done at all. But that version of the OS is getting long in the tooth, and I think it's time to upgrade, preferably in one big fell swoop. Not all the way to 10.0 (as that's too young), but I want to stay at the most recent stable and extended release, 9.2. And because this is a production machine where stability is very important, I want to do one big upgrade to go to 9.2, and then leave the base OS on the machine alone again for a year or so (just dealing with applications and ports). I believe that "stable" should mean: "leave it alone", and in the old mantra "don't mess with a running system".

My system has about 100 packages/ports installed (only in a few cases did I need to locally patch the source code for ports). It runs a variety of daemons and services (DNS, DHCP, Apache, PF/NAT, Sendmail, and so on), all of which have been carefully hand-configured. And it has a few ZFS file systems with important data. The kernel is completely unmodified. Our network connection to the outside world is slow (the best we can get is a slow DSL line), so downloading gigabytes is out of the question.

Because disk space on the /usr partition is somewhat limited (as it is on a small SSD, and less than a dozen GB are free), and the CPU is quite slow (single 1.8 GHz Atom), nearly all of the ports were installed from pre-built packages (using pkg_add). I don't think rebuilding all the ports is viable, or is it?

And to make life easier, I want to end up with a completely "normal" system when I'm done upgrading, a system that looks like it had been installed from 9.2 media, and then had up-to-date packages downloaded or ports compiled. And because disk space on the root disk (excluding users' /home directories) is at a premium, I don't want to end up with too much debris (old versions of stuff) on disk.

Which brings up the question. I've read chapter 23 of the manual, about how to upgrade. And I have two DVDs here, with the complete 9.1 and 9.2 installs. In all other OSes I've worked with, you can upgrade from the distribution media, and it simply does a wholesale replacement of all the files on disk (leaving a little bit of a mess with configuration files, but I'll know to back them up first, and I have records of what has been configured and edited). The FreeBSD model is completely different, downloading upgrades over the network, and then moving them into place in little bits.

Obviously, there is a very "clean" but tedious alternative to upgrading: Take the old root disk out, put a blank disk in, do a clean install of 9.2, then do a clean install of all the required packages, and then manually move all configuration over.

The big question is this: what do the experts here recommend? Is there something wrong with my desires or my plan to do one big jump from 9.0 to 9.2, and then park there for a long time?

The small question is this: given that I have downloaded the 9.1 and 9.2 distribution media, can I use that to run the upgrade (as described in the FreeBSD Handbook), instead of downloading all the bits over the network?
 
Code:
freebsd-update -r 9.2-RELEASE upgrade
freebsd-update install
reboot
freebsd-update install
portmaster -f
freebsd-update install
reboot

ETA: use the --packages-build --delete-build-only and -d switches to save space. For example: portmaster --packages-build --delete-build-only -fd

Alternatively, uncomment:
Code:
PM_PACKAGES_BUILD=pmp_build
PM_DEL_BUILD_ONLY=pm_dbo
in /etc/portmaster.rc.
 
nanotek said:
Code:
freebsd-update -r 9.2-RELEASE upgrade
freebsd-update install
reboot
freebsd-update install
portmaster -f
freebsd-update install
reboot

Will the result be the same as a clean install? Is there a way to tell freebsd-update to not download everything over the network, but use the existing distribution media? Will this compile all the ports from source? That might not be a problem with modern hardware, I got my aversion to compiling from source when I was running on a 386-40. But the OS update pretty much needs to finish overnight. If this turns into a lengthy procedure, I'm probably better off going with a reinstall onto a new disk.

ETA: use the --packages-build --delete-build-only and -d switches to save space. For example:
portmaster --packages-build --delete-build-only -fd

Alternatively, uncomment:
Code:
PM_PACKAGES_BUILD=pmp_build
PM_DEL_BUILD_ONLY=pm_dbo
in /etc/portmaster.rc
I'm not sure I understand what this does. And the postmaster documentation isn't terribly clear (it seems to consist of a lightly commented version of the .rc file).

Thanks for the suggestion!
 
ralphbsz said:
Will the result be the same as a clean install?
Is there a way to tell freebsd-update to not download everything over the network, but use the existing distribution media?
Will this compile all the ports from source? That might not be a problem with modern hardware, I got my aversion to compiling from source when I was running on a 386-40. But the OS update pretty much needs to finish overnight. If this turns into a lengthy procedure, I'm probably better off going with a reinstall onto a new disk.

The result will be an effective upgrade to 9.2-RELEASE. I'm not entirely sure how any upgrade will be more like a clean install and not an upgrade. If it's the former you're after, perhaps a clean install is what's needed. I don't know how to use local media for the update, but I'm sure it can be done. Hopefully the experts around here will offer some help. Using Portmaster, as per my advice, will compile all ports but use binary packages for dependencies (see below). The update process, as described, won't take long at all. Regarding your ports, depending on how many you have installed, overnight might suffice.

ralphbsz said:
I'm not sure I understand what this does. And the postmaster documentation isn't terribly clear (it seems to consist of a lightly commented version of the .rc file).

Thanks for the suggestion!

The --packages-build switch explicitly instructs Portmaster to install binary packages (where available) for all build dependencies, thus saving time, space, CPU (i.e. resources). The --delete-build-only switch instructs Portmaster to delete all build dependencies after compilation, thus saving space. The -d switch instructs Portmaster to delete temporary installation files (in /usr/ports/distfiles), thus saving more space. You can set options permanently in portmaster.rc, as previously described.

Hope that helps.
 
In almost all cases you won't be able to tell the difference between a clean install and an upgrade if the upgrade is done properly. There won't be any visible leftovers from the older version of the OS because the upgrade takes care of deleting the files that would conflict with newer version of the OS. However, this applies only to the base system and not to installed ports and packages, they have to handled separately with methods already mentioned by others in this thread. FreeBSD has a strong separation between what is considered part of the operating system and what is a third party application.
 
nanotek said:
Using Portmaster, as per my advice, will compile all ports but use binary packages for dependencies (see below). The update process, as described, won't take long at all. Regarding your ports, depending on how many you have installed, overnight might suffice.
"Not long at all" is good enough for me. Actually, I was thinking about it: It doesn't have to all be done in one fell swoop. I could for example pick out a few big ones (Apache, Samba, BIND), and do them ahead of time by hand. Then the automated part will probably run pretty fast.

And none of this is super critical: If the upgrade goes south (for example takes two days to run), it's not the New York Stock Exchange or Strategic Air Command that goes offline. So I'll go with portmaster (after doing the base system first, and hand-upgrading a few big ones).

kpa said:
In almost all cases you won't be able to tell the difference between a clean install and an upgrade if the upgrade is done properly. There won't be any visible leftovers from the older version of the OS because the upgrade takes care of deleting the files that would conflict with newer version of the OS.
Again, that's good enough for me.

The only remaining question is: how to save network bandwidth, by using the distribution media as a source. I'm also thinking to make a list of all the packages I have (which are probably the ones that will be upgraded), download them at a place with high bandwidth, and then carry them home. I'll try to figure out how to teach the package system to prefer a local repository when available. Any hints?

Thanks for the help.
 
ralphbsz said:
I'll try to figure out how to teach the package system to prefer a local repository when available. Any hints?
If you use pkgng you can use a repository file like this:
Code:
myrepo: {
  url: file:///where/I/stored/my/packages
  mirror_type: none
  enabled: yes
}

With the old pkg_* you simply cd(1) to the directory and pkg_add(1) them.
 
Back
Top