Emergency backup before FreeBSD port upgrade

I recently saw a blog post with some tips for dealing with the FreeBSD ports tree. The tip I thought was particularly useful regarding creating binary backups (_i.e._ packages) of important ports before upgrading them, just in case you need to roll back by installing the package.

pkg_create -b portname

will create a package for portname.

Otherwise if you’re using the portupgrade tool you can add the -b flag to create a package backup, i.e.

portupgrade -rRb portname

That should create a package in /usr/ports/packages/All/ (and do a recursive build in both directions).

The original blog post can be found at

Whilst on the subject of good ideas when doing port upgrades, it’s often well worth running the command with a -n switch which prevents portupgrade from actually performing the upgrade, it just shows you what it would do - really useful if you want to see just how much stuff is going to be updated when you run the command for real! So normally I end up doing the following:

portupgrade -brRn <portname>
portupgrade -brR <portname>

Written on 26 Nov 2009 and categorised in FreeBSD, tagged as Ports, FreeBSD, Backup, and Portupgrade

Home, Post archive

site copyright Eric Freeman

Valid XHTML 1.0 Strict