[Mimedefang] Ram based directory on FreeBSD 5.2x

Wesley Peters wpeters at stbernard.com
Mon Mar 15 13:58:13 EST 2004


On Wednesday, March 10, 2004 11:29 PM, Rob <mailto:rob_macgregor at hotmail.com> alleged:
>> 
>> Do you need more than this?  There's a better (more 5.x-ish) way to do
>> this; but it needs a starter script in /etc/rc.d and a configuration
>> knob in /etc/rc.conf.  I'll look into that, but you wouldn't see such
>> a feature in a "release" version until 5.3.
> 
> As long as there is some way to call it from fstab that
> allows you to run in
> non-compatability mode I don't expect there's a problem.
> It's that darn
> compatability mode :)  I personally would be happy with, say, mount_md as
> a hard link so that you can still provide full backwards support, while
> providing access to the full power of mdmfs (actually, that's exactly the
> hack I did on my own box - manually created a link).
> 
> Thanks for offering to fix this.  As somebody else has
> already raised a PR I
> won't.

I just committed the attached script to FreeBSD-CURRENT.  

NOTE: this script is NOT written for FreeBSD 4.x and won't do you a 
bit of good there.  If you're waiting to 5.3 to upgrade to FreeBSD
5, don't worry, it'll be there when you get there.

To use this, plunk it in /etc/rc.d with ownership and permissions the 
same as everything else in there.  You can configure as many 'ramdisks' 
as you like with the following settings in /etc/rc.conf:

	ramdisk_units="n [n ...]"

A list of the md "unit numbers" to configure.  To configure md10 and md11 
use:

	ramdisk_units="10 11"

You must specify at least a type for each ramdisk.  For each given type, 
there may be additional required options, such as a size for memory-
based types.  Note: since this runs BEFORE the fstab mounts, you will 
not be able to specify file-backed md devices, that is why the script 
is named 'ramdisk'.

	ramdisk_{unit}_mdoptions="{mdconfig -a options}"

Examples:

	ramdisk_10_mdoptions="-t malloc -s 64m"
	ramdisk_11_mdoptinos="-t swap -s 1g"

You may optionally specify the options used to newfs each ramdisk with:

	ramdisk_{unit}_fsoptions="{newfs options}"

Examples:

	ramdisk_10_fsoptions="-b 2096 -f 512"
	ramdisk_11_fsoptions="-O 1"

These options are passed directly to the newfs command.  No setting will
probably work in the general case; the "-b 2096 -f 512" settings are
suitable for relatively small ramdisks.

You can optionally specify ownership and permissions with:

	ramdisk_{unit}_owner="{owner}"
	ramdisk_{unit}_perms="{perms}"

where {owner} is any ownership specification suitable for the chown(1)
program and {perms} is any permission specification suitable for the
chmod(1) program.  The ownership and permission settings are applied
to the /dev/md{unit} device file after mdconfig -a and newfs have 
been run.

Sorry to spam the list with this volume of information, but I want
FreeBSD 5.x to be THE platform of choice for MIMEDefang users.  ;^)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ramdisk
Type: application/octet-stream
Size: 2399 bytes
Desc: ramdisk
URL: <https://lists.mimedefang.org/pipermail/mimedefang_lists.mimedefang.org/attachments/20040315/760cfd41/attachment.obj>


More information about the MIMEDefang mailing list