|| Date Posted:
||January 3rd, 2001
|| Last Updated:
||May 15th, 2001
||2,878 total; 127 recently
|| Page Views:
|| User Rating:
||awaiting 10 votes
|| Jump to the Downloads section
Removeable RAM Disk device driver.
Short: RAM Disk device driver.
Author: email@example.com (Alexander G. M. Smith)
Uploader: firstname.lastname@example.org (Alexander G. M. Smith)
Type: system files/drivers/miscellaneous, system files/drivers/removeable storage
Requires: BeOS 5.0+
AGMSRAMDiskDevice is a device driver that simulates a removeable disk drive, using the computer's Random Access Memory (RAM). Because it uses memory rather than mechanical mechanisms to store the data, it is very fast, and forgets everything when you turn the power off or reboot. Well, not quite, it can save its contents to a file on a real disk when it shuts down and load it from the same file when it starts up.
Additional features are:
* The saved data is compressed with Deflate compression.
* The fake disk "media" can be ejected and loaded.
* You can change its configuration by editing a text file, no recompile needed.
* You can use virtual memory to store the data or use real memory.
* It can also simulate read-only, write-once, and non-removeable disks.
* It can appear right on your desktop after you boot, no need to use DriveSetup.
* It supports being partitioned into multiple drives using DriveSetup.
* Verbose error messages are logged when anything goes wrong.
Here's what the configuration file looks like:
# Settings for the AGMSRAMDiskDevice device driver, V1.0, Jan 2001.
# This file should be located in the device driver configuration
# folder, usually /boot/home/config/settings/kernel/drivers.
# Changes take effect at the next boot, or if you close all device
# file references to the RAM disk (difficult to do - unmount all RAM
# disk volumes and quit the "Tracker" program (use the command
# "quit application/x-vnd.Be-TRAK" from the Terminal) then un-eject
# the disk if it was ejected, and restart the Tracker (simultaneously
# press control-alt-del and click on the restart desktop button)).
# Uh, just reboot, it's easier.
# Size of the simulated disk. Generally should be less than the
# amount of memory installed in your computer (see the About BeOS
# box for the amount), to leave space for programs to run. Even
# with virtual memory, don't go over the installed memory size
# unless you like thrashing your hard drive.
# If set to "no" then it uses real memory, and prevents anything
# else from using that memory. So, other programs could be squeezed
# out. But it will be faster. If you say "yes" then virtual memory
# is used, which means that unused data gets moved to the system
# swap file if BeOS needs memory for other purposes. Naturally,
# it's slow if you use that unused data since it has to read it
# out of the swap file and back into memory.
# Set to "yes" to simulate a removeable disk drive. Yes, you can
# eject your RAM disk. When all the partitions on the disk are
# unmounted, BeOS will eject the media. The contents aren't lost,
# and if you allow writing to the disk image file, they will be
# compressed and stored in that file as part of the eject operation
# (but only if changes have been made). Set to "no" to simulate
# a standard non-removeable hard drive (makes it harder to create
# disk images). Oh, how do you un-eject a disk, you ask? At the
# moment the only utility I know of which can send the load-media
# command is AGMSDeviceTest applied to the magic device file:
# If you want to simulate a read-only disk set this to "yes". "no"
# allows you to write to the disk.
# This simulates a write-once media. It will return an error if you
# try to write to parts which have already been written to. A full
# format will clear the disk to enable writing everywhere again.
# For removeable disks, "yes" will start with the disk present
# in the drive. If set to "no", you will have to un-eject the
# disk (load-media is the term) to be able to do anything useful.
# If set to "yes", this makes writing the compressed disk image
# file a bit safer - it writes to a blah.tmp file first, then if
# that is successful, it replaces the old disk image with the
# temporary file. If set to "no", it will overwrite any existing
# disk image, even if errors occur (like out of space). On the other
# hand, if you don't have much free space, the direct write uses
# half as much as the safe write method.
# A double negative. If set to "no" then it will write the disk
# image file when you eject the disk or shutdown the computer.
# If set to "yes" then it won't save any changes to the disk.
# That's useful for a RAM disk which always starts out empty
# (from a prepared empty formatted disk image) when you boot.
# Specifies how much compression you want, from 0 (none) to
# 9 (maximum). If you find that system shutdown takes a long
# time (due to the time it takes to compress the RAM disk),
# you can try reducing this.
# Set this number to equal the number of mounted (unmounted ones
# don't count) partitions on your RAM disk. Due to goofyness in
# the BeOS file systems, it never closes all the device files when
# it shuts down, thus uninit_driver is never called, and we don't
# get to save the disk image when the system is shutting down.
# Instead I added a hack which counts the number of files
# remaining open, and when it reaches this magic number,
# and the file system requests a Flush, it will save the disk
# image. Set it to 0 to disable this hack; then the disk image
# will only get saved when you manually eject the disk or when
# they fix the filesystem shutdown code to clean up properly
# after itself.
# Name of the disk image to use for loading and saving. It's a
# file on your boot drive which contains the contents of the
# RAM disk, in a compressed format. If it is "" (the empty string)
# then the disk image feature isn't used and you will need to
# manually format and partition the RAM disk every time you use
# it (either with mkbfs or DriveSetup). Normally a good choice
# is "/boot/home/EmptyDiskImage". The first time you set things up,
# (changing the size etc), you will need to format the disk and
# make it save the disk image (easiest to do by ejecting it). You
# may want to create indices for common file attributes (see
# "lsindex" and "mkindex") so that you can do queries for those
# attributes on the new disk.
There are four different parts to the AGMSRAMDiskDevice, most of them files all confusingly called "AGMSRAMDiskDevice". The supplied zip file includes a 4 step file dragging festival that you can manually do to install the files. The default manual install will set up a 30 megabyte RAM disk, with changes that survive across reboots. This is what it dragging icons does in words.
First, the executable part needs to be stored in the kernel addons directory:
-rwxrwxrwx 1 agmsmith agmsmith 69650 May 14 18:08 AGMSRAMDiskDevice
Next, the text configuration file should be put in the system driver configuration directory:
-rw-r--r-- 1 agmsmith agmsmith 5382 May 14 18:04 AGMSRAMDiskDevice
A link needs to be added to the device control directory to associate the device name with the driver executable:
lrwxrwxrwx 1 agmsmith agmsmith 0 Dec 15 17:25 AGMSRAMDiskDevice -> /boot/home/config/add-ons/kernel/drivers/bin/AGMSRAMDiskDevice
The command from the Terminal to do this is "ln -s /boot/home/config/add-ons/kernel/drivers/bin/AGMSRAMDiskDevice /boot/home/config/add-ons/kernel/drivers/dev/disk/virtual/AGMSRAMDiskDevice", though you can just drag the provided link to the provided folder to do the same thing.
The final step is to create the disk image, or just copy the example one (which includes common pre-made file system indices) to the spot mentioned in the configuration file:
-rw-rw-rw- 1 agmsmith agmsmith 47847 Jan 2 22:07 AGMSRAMDisk.30MB.BFS.Empty
Making a Disk Image:
One common use is to set up an initial RAM disk image containing an empty file system and then never change it (see never_write_compressed_disk_image). First decide on the size you want, and edit the parameters file /boot/home/config/settings/kernel/drivers/AGMSRAMDiskDevice to set that size (initial_size_in_bytes), and also make the disk removeable (easier to set up that way) and writeable. Reboot so that the new settings take effect.
Now use DriveSetup to format your disk, create partitions (just one using 100% of the disk for now, of type BFS for Be File System), and then initialise your partition. Mount the new disk/partition (DriveSetup will ask to do this for you - say yes). The exit DriveSetup. You should see your new empty disk on the desktop.
If you want indexed attributes (so that Find/Query works), go to a Terminal and use mkindex to create them (run lsindex from directory /boot/home to see what your collection of indexed attributes is, then run mkindex attribute-name for all the attributes you want, with the current directory on your RAM disk to create them there).
You can also put on initial files and arrange the windows on the disk the way you want them.
Then eject the disk. Do this by right clicking on it and picking unmount. If you have more than one partition, you have to unmount them all for the eject to be done. You should see a new disk image file appear with the name and location you specified for path_name_of_compressed_disk_image_file.
Edit the configuration file again, this time turn off the removeable option and set never_write_compressed_disk_image to yes.
Reboot and your RAM disk should show up on the desktop. Add files to it, and other wise modify it. Reboot and it should reappear back in its initial state with all your modifications gone.
Viewing the Log:
If you want to see what's happening, and perhaps catch any error messages, you need to turn on debug logging. Reboot the computer, then just when BeOS is starting to boot, hit the space bar. A text menu should appear, pick the safe mode options from it, and then from the submenu, pick the Enable Console Debugging option. Now debug messages will be appended to the file /var/log/syslog and will also spew out the serial port at 19200 baud (which is why they are slow). You can watch the messages live by using the Terminal command "tail -f /var/log/syslog", which will work until the log file fills up and gets replaced by a new syslog file (hit control-C to stop the "tail" command, then restart it to get the new syslog).
For more verbose logging, turn on the DPRINT_NON_ERROR_MESSAGES define in the program and recompile it. Reboot, and the log should be full of comments on what's happening. Great for debugging file systems.
Occasionally the RAM disk can get corrupted and make your computer crash on bootup. To fix this, hit space right at the start of the BeOS bootup so that you can get the safe mode text menu. Select the option to disable user add-ons, and then continue booting. That will prevent the RAM disk driver from loading, letting you boot, and change the configuration options, or delete the corrupt disk image file.
The saved data is compressed with Deflate compression (same algorithm as in zip files) courtesy of ZLib from Jean-loup Gailly and Mark Adler. Thus a freshly formatted multi-megabyte disk with indices only takes a few dozen kilobytes.
Why am I writing this? It's preparation for writing a file system - initially one which is just another kind of RAM disk, but which grows and shrinks to match the amount of data, and which can have multithreaded access (multiple files can be simultaneously written). Once I've got that figured out (live notification, query indices and query language parsing and all), I'll make one for handling Zip files. After that, there's the GNU Hurd project with a lot of interesting file system ideas, and there's that ReiserFS... Or maybe the money will run out and I'll have to end my sabbatical. Time will tell.
AGMSRAMDiskDevice is released to the public domain. You can do whatever you want with it. However, all benefits and loses are yours, not mine. Watch out: you can easily lose all the information you put on the RAM disk, and the disk image file can go corrupt too.
- Alex (Ottawa, May 2001)
Details about this version:
Added a configuration option to specify the compression level, so that you can have faster shutdowns.
Intel Version - requires R5 (77 KB)
|Add Additional Location
| Source Included
Like this app? Have questions or comments?|
Why not tell the author? Use the "e-mail publisher" link to get in touch with the publisher; they usually love getting feedback.
Recent Downloads - # 533|
Total Downloads - # 934
Total Views - # 635
User Ratings - N/A
Rem. Storage Drivers
1. BePodder - 9.73
2. QEMU - 9.68
3. ScummVM - 9.57
4. Haiku AGP busm... - 9.35
5. cpu_fix - 9.31
6. vim6 - 9.31
7. VNCServer - 9.30
8. Beezer - 9.26
9. HandBrake - 9.25
10. BeeF - 9.25
1. Ati Radeon G... - 40,932
2. BeOS 5 Perso... - 36,763
3. BePDF - 22,622
4. Realtek RTL8... - 20,774
5. Ensoniq Audi... - 19,390
6. USB Joystick... - 17,833
7. ATI Rage 128... - 13,762
8. VLC Media Pl... - 12,318
9. DOSBox - 11,388
10. S3 Trio 64 v... - 10,962
|You are not logged in.|