# Backup and restore configurations from ports



## minimike (Jul 25, 2011)

Hi there

To configure all my installed and build ports from /usr/ports has taken several hours. How I could backup these settings and restore them on worst case this box or to another computers?


----------



## SirDice (Jul 25, 2011)

Backup /var/db/ports/ and/or create packages from installed ports with pkg_create(1).


----------



## graudeejs (Jul 25, 2011)

SirDice said:
			
		

> and/or create packages from installed ports with pkg_create(1).



Better yet, install ports-mgmt/bpkg
and run
`# bpkg -B`
it will backup all installed ports to /var/tmp/bpkg/


----------



## draco003 (Sep 19, 2011)

if I used the command:
[CMD=]bpkg -B[/CMD]
when I make a fresh installation what are the steps required so that I restore all the ports in the backup?

Thanks


----------



## graudeejs (Sep 19, 2011)

You probably won't be able to install everything with single command, because you probably don't have custom FreeBSD metaport, and thus custom packages.

You will need to *pkg_add* packages from /var/tmp/bpkg manually.

For example

```
# cd /var/tmp/bpkg
# pkg_add xorg-*
# pkg_add libreoffice-*
...
```
and so on.

I added * where package version and archive extension is expected. Dependencies will be installed automatically.


----------



## draco003 (Sep 20, 2011)

Thanks very much

I backed it up and will tell you when I get my new HDD


----------



## graudeejs (Sep 20, 2011)

If you simply want to use current software on other hdd, why won't you use dump & restore, if you're using UFS, or *zfs send* and *zfs receive* if you use zfs?

It's much simpler, and much safer


----------



## draco003 (Sep 25, 2011)

Thanks very much graudeejs 

yes I'm using UFS and your other post about the dump & restore is amazing I'll give it a try ^^

Well done!

Draco


----------



## wblock@ (Sep 26, 2011)

Remember that backing up or copying packages doesn't copy the run-time configuration files in /usr/local/etc.


----------



## draco003 (Sep 26, 2011)

Thanks ^^

I'll also backup /usr/local/etc as well as /etc


----------

