FreeBSD to RAM: is it possible?

sossego

Retired from the forums
Being also a Debian user, I've noticed that the image can be loaded to ram from the boot menu. Can the same thing be done with FreeBSD?
 
And what Debian package did you install to get that option? I've never seen it on my Debian 3.1, 4.0, or 5.0 systems. I've seen that option on various LiveCDs, though, where the entire contents of the CD are loaded into a RAM disk/tmpfs and then use that for the / partition.

In theory, you should be able to write a boot script that will create a memory disk (using md(4)), and extract a tarball of the / partition into it (or copy the contents of the real / off the disk), then mount it as /.

AFAIK, there's nothing pre-built to do this. Although maybe the NanoBSD, MiniBSD, or PicoBSD guys have something like this.
 
Look at the installation iso, it load a compressed image to RAM and execute sysintall from here.

Edit:
The compressed image is /boot/mfsroot.gz (it's loaded from /boot/loader.conf), you can uncompress it and mount it to see what's inside.
Sysinstall is started because init is missing (see /boot/default/loader.conf: init_path="/sbin/init:/sbin/oinit:/sbin/init.bak:/rescue/init:/stand/sysinstall"), but if you put a normal base system as a compressed image in mfsboot.gz, i think it'll boot normally.
 
I've extracted mfsroot to the user home directory on Debian. What type of file is it? I know that it would be easier to do this on FreeBSD but I want to run any tests first on qemu.
 
An mfsroot file is a small image of a BSD root filesystem. mdconfig can initialize it as memory disk or a file-based filesystem.
While booting, FreeBSD can load a mfsroot filesystem in memory and mount it on /
Later versions of Qemu can boot from md-devices created by mdconfig.
The FreeBSD install cd's also use such a file. It contains the sysinstall program and all the binaries needed for installation.
 
Back
Top