tmpfs for FreeBSD?

Dan Nelson dnelson at
Wed Aug 11 22:53:23 PDT 2004

In the last episode (Aug 11), adp said:
> I'm looking for a ramdisk-style filesystem for FreeBSD that can be
> used for scratch space, e.g., tmpfs in Solaris. The filesystem should
> be able to grow and shrink in memory (and use real disk space as
> needed) depending on the amount of free RAM on the system. I don't
> want just a fixed sized block of memory reserved for /tmp. I will be
> using this for scratch files that are quickly created and then
> destroyed, and will average around 2MB each. We are expecting out tmp
> filesystem to need around 256MB to 512MB on average.

The best available at the moment is a swap-backed filesystem.  It will
consume ram/swap as it grows, but won't release swap space when you
delete files.  If you're running 5.*, just put this in rc.conf:


and make sure you have at least 512MB of swap, so if it does happen to
grow to full size and then have most of its files deleted, the free
blocks can be pushed out to swap.

	Dan Nelson
	dnelson at

More information about the freebsd-questions mailing list