The maximum RAM disk size is a Linux kernel option. By default, it's pretty low. You can increase it by editing the line

# kopt=root=LABEL=slash ro

in the file /boot/grub/menu.lst. The option to add is "ramdisk_size=size-in-KiB". Normally, you would put this option directly in your Grub menu entries, but that would get overwritten the next time a kernel upgrade runs "update-grub". By putting it into that special # kopt comment line (and then running update-grub) the change will be preserved.
   More info at: http://ubuntuforums.org/archive/index.php/t-316735.html

However, please note that a RAM disk is probably not what you want. If you want to save files in RAM (for speed), then use tmpfs. Tmpfs is like a RAM disk, but better. The size dynamically grows.

   More info at: http://www.ibm.com/developerworks/library/l-fs3.html#2

Under Ubuntu, you have a tmpfs "device" all set up and ready to use. Just copy some files to /dev/shm/...

# Here is the mountpoint, at /dev/shm (as in, "SHared Memory")
r...@archive:/boot/grub# mount | grep shm
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)

# First, note there are 0 Gigs used on my system...
r...@archive:/boot/grub# free -g
            total       used       free     shared    buffers     cached
Mem:            11          0         11          0          0          0
-/+ buffers/cache:          0         11
Swap:            3          0          3

# Now I copy a 4 Gig file into the tmpfs
r...@archive:/boot/grub# dd if=/dev/zero of=/dev/shm/testfile1 bs=1M count=4096
4096+0 records in
4096+0 records out
4294967296 bytes (4.3 GB) copied, 3.58491 s, 1.2 GB/s

# And here you see the 4 Gigs of RAM is used.
r...@archive:/boot/grub# free -g
            total       used       free     shared    buffers     cached
Mem:            11          4          7          0          0          4
-/+ buffers/cache:          0         11
Swap:            3          0          3
r...@archive:/boot/grub#


Thanks,
Derek

On 12/09/2009 04:43 PM, Jeremiah Jester wrote:
I'm trying to create a ram disk under ubuntu. Determined size is 99M.  I
have over a gig of free memory but still fails with "no space left on
device". Any ideas?

Thanks,
JJ


r...@jesterj:~# rm -rf /dev/ram

r...@jesterj:~# mknod -m 660 /dev/ram b 1 1

r...@jesterj:~# dd if=/dev/zero of=/dev/ram bs=1k count=99999
dd: writing `/dev/ram': No space left on device
65537+0 records in
65536+0 records out
67108864 bytes (67 MB) copied, 0.355596 s, 189 MB/s

r...@jesterj:~# cat /proc/meminfo | grep "MemFree"
MemFree:         1625368 kB

Reply via email to