Subject: Re: Ramdisk?
To: None <port-arm32@netbsd.org>
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
List: port-arm32
Date: 11/19/1999 00:37:56
In <199911181328.NAA00957@yates.mpc-data.co.uk>
mpumford@mpc-data.co.uk wrote:

> > We need to run diskless, but for now I just wanted to create and mount a
> > ramdisk.
> > 
> > I built a kernel with an "md" configured in, the MFS defined,
> > MEMORY_DISK_HOOKS defined
> > and MEMORY_DISK_SIZE=8192.
> > 
> > On boot I get a message "md0: allocated 4096K (8192 blocks)"
> > (I guess from the code in md_hooks.c)
> > but, I can't seem to mount "md0".
> > 
> The md device is for using a ramdisk image embedded into the kernel. 
> This image can be set with mdsetimage. The idea is that you build a 
> mini UFS file system in an image file and embed it into the kernel. 
> For more info on building ramdisk images see the vnconfig and 
> mdsetimage manual pages.

FYI, md devices can also be used as "normal" ramdisk.
See mdconfig(8) man page and comments in /sys/dev/md.c.
(md* entry in etc.arm32/MAKEDEV is broken, though...)

---
# ls -l /dev/md0*
brw-r-----  1 root  operator  18,   0 Nov 19 00:19 /dev/md0
crw-r-----  1 root  operator  18, 128 Nov 19 00:18 /dev/md0c
# mdconfig /dev/md0c 2880 &
[1] 22059
# newfs -T floppy /dev/md0
newfs: /dev/md0: not a character-special device
/dev/md0:       2880 sectors in 80 cylinders of 2 tracks, 18 sectors
        1.4MB in 5 cyl groups (16 c/g, 0.28MB/g, 128 i/g)
super-block backups (for fsck -b #) at:
   32,  632, 1184, 1784, 2336,
# mount /dev/md0 /mnt
# df /mnt
Filesystem  1K-blocks     Used    Avail Capacity  Mounted on
/dev/md0         1283        0     1218     0%    /mnt
# umount /mnt
# newfs_msdos /dev/md0
# mount -t msdos /dev/md0 /mnt
# df /mnt
Filesystem  1K-blocks     Used    Avail Capacity  Mounted on
/dev/md0         1423        0     1423     0%    /mnt
#
---
Izumi Tsutsui
tsutsui@ceres.dti.ne.jp