Subject: Re: Help with memory disk
To: Frederick Bruckman <fredb@immanent.net>
From: None <roberto@redix.it>
List: netbsd-help
Date: 05/17/2003 23:39:47
All I want do to is to install netbsd on flash memory and mount root and
other fs as read only; only fs like /var or /tmp should be writable and I
need to create ramdisk in memory for those devices (it is a bad things to
write on flash for tmp files or logs).
And I do not have any swap partition on disk to use the command mount_mfs.
So I need pure ramdisk.
I'll try to understand the mechanism in "/usr/src/distrib/i386/floppies" as
you suggested.
Thanks,
Roberto
--On Friday, May 16, 2003 10:27:52 -0500 Frederick Bruckman
<fredb@immanent.net> wrote:
> On Fri, 16 May 2003 roberto@redix.it wrote:
>
>> I'd like to setup several memory disk (ramdisk), but I did not find any
>> helpful info on the docs (sorry).
>> I'd like to know:
>> - what are the kernel options to enable ramdisk?;
>> - which are device files I need?;
>
> The ramdisk needs "pseudo-device md 1" (or > 1), and "/dev/md0a" and
> "/dev/md0d" for one ramdisk; you could do "cd /dev; sh MAKEDEV md1" to
> support a second (and so on).
>
>> - what command to create, mk file sys. and mount?
>>
>> P.S.: All I've found is for FreeBsd but seems to me inapplicable to
>> NetBsd: mknod /dev/ad0a c 116 0
>> mknod /dev/ad0c c 116 2
>> disklabel -e /dev/ad0c and define a partition a: type 4.2BSD
>> disklabel -B -r /dev/ad0c
>> newfs /dev/ad0a
>> mount /dev/ad0a /memory_fs
>
> The "/dev/MAKEDEV" script does the first two steps (or not, if you
> only need one ramdisk), then you'd need to run "mdconfig(8)". (See
> also "md(4)".) The rest should be about the same. I've never tried it.
>
> The release build uses "makefs(8)" and "mdsetimage(8)" to create a
> file system image and install it into the kernel, which is how the
> install disks manage to boot from a ramdisk. If that's what you're
> trying to do -- make a bootable image -- you might be able to usurp
> the release building mechanism in "/usr/src/distrib/i386/floppies".
>
> Frederick
>