build world on memory disk

What are suggestions for best practices of building world on memory disk?

I tried doing the whole process from single user mode mounting the /usr/obj/ directory as a memory disk, because dropping down from multi-user mode deletes the entire build stored on RAM. Also, it can delete the build for merging and configuring, after a reboot is needed. The build could be copied back to the harddisk, but this doesn't seem like the way to go. Could the make command with packageworld, help with this?

A better way would be to set it like how I set the build for ports. build(7) says not to put
Code:
MAKEOBJDIRPREFIX=
into make.conf, but in the environment instead. It looks like this is already set for /usr/obj/, and this also changes the full make directory, not only the build.
 
Just build and install in multi-user mode. I know it's recommended to do install{world,kernel} in single user mode but I've never actually done this. I've always done it on a fully working system and I never had any issues with it. I think the only time I really had to boot the new kernel first before doing installworld was when UFS got updated around the FreeBSD 4.0 era.

I now for a fact this works: env MAKEOBJDIRPREFIX=/some/where/ make buildworld buildkernel and env MAKEOBJDIRPREFIX=/some/where make installkernel etc.
 
Not being required to drop down into single user mode, makes it a lot more simple and convenient.

The only thing that would require a reboot is make delete-old-libs, which is needed for ports built with base system libraries. This may not matter if it's a freshly installed system, or if I intend to reinstall all ports from scratch. Is the intact build directory needed to run make delete-old-libs successfully? Also, is a reboot required for running make delete-old-libs, from system clear of packages?

If this works, it would be a quick fix enough for me, but it doesn't solve it for entire instances, so suggestions are still helpful.
 
You don't have to reboot to do make delete-old-libs but the old libraries might be still in memory after the removal of the files, that's why a reboot is recommended after the system update. No need to remove packages either for any reason.
 
Is the intact build directory needed to run make delete-old-libs successfully?
Not entirely sure but I would guess it is.

Also, is a reboot required for running make delete-old-libs, from system clear of packages?
No, but it is required to make sure the old libraries aren't still loaded somewhere.
 
I think the only time I really had to boot the new kernel first before doing installworld was when UFS got updated around the FreeBSD 4.0 era.
To add to this, if things like this are truly required there will be a note in /usr/src/UPDATING, so make sure you've read that beforehand.
 
You don't have to reboot to do make delete-old-libs but the old libraries might be still in memory after the removal of the files, that's why a reboot is recommended after the system update. No need to remove packages either for any reason.

It solves it for my purposes of working from a fresh install, for building off of a RAM disk. However, for complex installs (and rebuilding ports before running this command), the libraries would have to be cleared from memory, either without rebooting or with preserving the build.

As I've said,
If this works, it would be a quick fix enough for me, but it doesn't solve it for entire instances.
This solves the problem situationally.
 
For minor updates or security patches rebuilding your ports isn't needed. If it is needed there will be a note in /usr/src/UPDATING. But about 999 out of a 1000 updates don't require a rebuild of any port. Major upgrades (from 9.x to 10.x for example) do require it but you can get the machine to boot and run using misc/compat9x for example. That will allow you to run packages built for 9.x on a 10.x system. You can use this as a stop-gap until you've rebuild your ports for your current version.
 
I highly recommend @wblock's short & sweet http://www.wonkity.com/~wblock/docs/html/buildworld.html

My only addition to this is that I reboot before running make, & then softlink ln -s /tmp /usr/obj into my ramdisk:

Code:
# my fstab entry
tmpfs     /tmp      tmpfs   rw,mode=01777,size=12g   0   0

It makes cleanup very easy. I have 16GiB of RAM in this system to 12 is plenty. I'm a huge ramdisk fan for pretty much everything.
 
Back
Top