# FreeBSD to RAM: is it possible?



## sossego (Sep 22, 2009)

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?


----------



## aragon (Sep 22, 2009)

What image?


----------



## phoenix (Sep 23, 2009)

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.


----------



## sossego (Sep 23, 2009)

http://forums.debian.net/viewtopic.php?f=16&t=29774&start=0

That is the howto.


----------



## tobe (Sep 24, 2009)

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.


----------



## sossego (Sep 26, 2009)

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.


----------



## MG (Sep 26, 2009)

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.


----------

