ramdisk for FreeBSD 4.8

Paul Civati paul at xciv.org
Fri Jan 23 13:17:07 GMT 2004

Martin Hepworth <martinh at solid-state-logic.com> wrote:

> I'm trying to get a ram disk setup on my 4.8 system. I'm trying to 
> replicate the tmpfs filesystem on GNU/Linux, but from what I can see 
> FreeBSD ramdisks are a fixed size.

I *think* you're confusing two different things here?

A RAM disk is a memory based file system, and what you've done below is
try to build a file system on a file, which can be done, but is something

If you simply want a tmpfs style /tmp file system that is memory based then
use the mfs file system by adding a fstab entry something like this:

# Device                Mountpoint      FStype  Options         Dump    Pass#
/dev/ar0s1b             /tmp            mfs     rw,nosuid,-s=131068

and then mount /tmp, adjust the -s flag for the size (which is 512byte blocks).

Obviously adjust the actual disk/swap device for one that matches the disk
on your system.

> anyway I've done a small one (!) with the following..
> 1) dd if=/dev/zero of=newimage bs=1k count=5k
> 2) vnconfig -s labels -c vn0 newimage
> 3) disklabel -r -w vn0 auto

Normally, if you use vnconfig, and from my notes, you'd need to do next:

4) disklabel -e vn0
[ duplicate (c:) to another partition (a:) and adjust letter/fstype ]
5) newfs -b 8192 -f 1024 -U /dev/vn0a
6) mount /dev/vn0a /mnt

> 5) dd if=newimage of=/dev/md0
> 6) mount /dev/md0c /mnt
> anyway the thing is, do I need to do item 5 and 6 on the list above when 
> rebooting, or can I rely on /etc/fstab to mount on boot?

Never used the md device myself, so I can't say how you would use it.


Paul Civati <paul.civati(at)xensia.com> www.xensia.net
Xensia, London UK - Quality UK Hosting Services - 0870 321 2855

More information about the Ukfreebsd mailing list