# Require procedure to test an upgrade/updates safely



## Harvey (Sep 11, 2013)

Hi

I have a live production box that needs updating/upgrading patches - _it's a_ fairly complicated software stack. _I am h_esitant to hit the upgrade/update button on a live system.

_I w_ould like to recreate the above server and simulate the upgrade before I do this to a live system. _I am u_nable to do snapshots as this is a stand alone system.

Is there a neat procedure to pull the current software versions to build a new server?


----------



## kpa (Sep 11, 2013)

Are we talking about the base system or ports here? If it's the base system and your software does not survive minor version upgrades to the base OS you have some rethinking to do about your software. If it's ports I would set up a jail that replicates the real host as much as possible and test the updates there.


----------



## SirDice (Sep 11, 2013)

You can use pkg_create(1) to create packages from already installed ports. I'd probably set up a virtual machine, install the same FreeBSD version on it and copy the packages I created with the aforementioned pkg_create(1). After that you just need to copy the configuration files and you should have a relatively exact copy. Good enough to test the upgrade procedure at least.


----------



## jb_fvwm2 (Sep 11, 2013)

Maybe be wary that [cmd=] pkg_add [/cmd] fails often here, many times with GNOME ports, with an obscure nonfixable (so far) bug, so the ports may have to be built (some of them) at the new machine, or they may be upstream and installable with portmaster. (Hopefully not relevant to this thread.)


----------



## J65nko (Sep 11, 2013)

With a ZFS install as described in @vermaden's HOWTO: FreeBSD ZFS Madness and with his sysutils/beadm script, you can manage different boot environments, allowing you to test upgrades without affecting a working setup. 
From that howto:


> The main purpose of the Boot Environments concept is to make all risky tasks harmless, to provide an easy way back from possible troubles. Think about upgrading the system to newer version, an update of 30+ installed packages to latest versions, testing software or various solutions before taking the final decision, and much more. All these tasks are now harmless thanks to the Boot Environments, but this is just the tip of the iceberg.


----------



## ShelLuser (Sep 11, 2013)

And another option, if we're talking ports that is, is to use `# portmaster --list-origins`. This will create a list which can be directly fed into portmaster thus installing the same ports on your other system.


----------



## Harvey (Sep 23, 2013)

Many thanks for the pointers.

For ports this looks like what I should be doing.

```
#!/bin/sh

for pkg in `pkg_info -E '*'`
do
pkg_create -b $pkg
echo $pkg package complete.
done
```
Still unsure how to do base system. 

 First attempt at building a jails seem to take a long time and resource hungry on a live server. So avoiding for now.
 Been looking at dump as it's an UFS filesystem. Can do snap dumps for all partitions except /tmp which so far never completes.  Restore looks sound but unable to boot from the new disk. Assuming MBR and boot are not configured correctly for the Virtual Box. May need some help with this ?????? _[ Don't -- Mod ]_


----------



## SirDice (Sep 23, 2013)

Just install a new system and only copy the data. That's usually quicker than trying to restore(8) a complete system.


----------

