[comp.os.minix] RAM disk as file in MINIX 1.5

mendelsohn@frodo.mgh.harvard.edu (Andrew Mendelsohn) (02/14/91)

Has anyone tried me to create a RAM disk from a file instead of a 
partition?
    To save a partition, it seems possible to make a disk image with
dd and then access it as a device.  However, I am not sure how to 
create a device that would be essentially a dummy, but point to the disk
image.  Any advice?
                         andy mendelsohn
                         mendelsohn@frodo.mgh.harvard.edu

wjb%cogsci.COG.JHU.EDU@vm1.nodak.edu (02/14/91)

>Has anyone tried me to create a RAM disk from a file instead of a
>partition?
>    To save a partition, it seems possible to make a disk image with
>dd and then access it as a device.  However, I am not sure how to
>create a device that would be essentially a dummy, but point to the disk
>image.  Any advice?

	Hmmm, that's an interesting thought.  I've thought about loading a
RAMdisk with utilities programs, but didn't like the idea of tar'ing a bunch
of files over to it.

	You can do what you want without making any major changes to the
system at all.  I'm assuming that we are talking about IBM-PC Minix here.
First get a copy of the shoelace package, it lets you do lots of things, one
of which is specifying the size of your RAMdisk in a configuration file even
if nothing is loaded into it.  Then in your /etc/rc file do a "dd < diskfile
> /dev/ram" and then mount /dev/ram.  Before shutting down your system
unmount /dev/ram and do the reverse "dd" command ("dd < /dev/ram >
diskfile").  I have a "shutdown" script to unmount stuff anyway so adding
this would be easy.  All of this assumes that you have a filesystem image as
a file on your system.  To start everything out, you would mkfs /dev/ram,
mount it and copy the files you want over to it.

	All of this is standard Minix except for using "shoelace" to set the
size of the RAMdisk.  I would guess that the changes needed to set the
RAMdisk size to some constant on non IBM-PC versions of Minix should be
fairly simple.

				Good Luck,
				Bill Bogstad