freebsd rebuild

one of the most common, but at the same time easiest problems to solve, when you’re working with FreeBSD system installed on too small disk is rebuilding the system.

in my specific case, it was very old i386 system initially installed around release 6 on a 20GB HDD. at around release 11 I ran out of tricks to pull and still make it, so had to finally add a disk. fortunately, just before that, the machine was moved from physical box to virtual machine.

OK, so how to rebuild the system in such situation?

first of all, you have to add filesystem somewhere. in my case, I’m using /home (here’s /etc/fstab):

/dev/da1p1      /home           ufs     rw      0       0

then, every build stage needs to be passed env settings to know where to build - buildworld, kernel and installworld will be executed in this way:

env MAKEOBJDIRPREFIX=/home/build make -j4 buildworld
env MAKEOBJDIRPREFIX=/home/build make -j4 kernel KERNCONF=server
env MAKEOBJDIRPREFIX=/home/build make -j4 installworld

obviously, what we’re left with is mergemaster:

mergemaster -FiU

and then:

reload

hopefully, that solves your problem. you just need to remember to clean up /home/build and /usr/obj.