[CentOS] Odd Question... MAX Ram Disk Size

Aleksandar Milivojevic amilivojevic at pbl.ca
Thu Mar 31 15:59:06 UTC 2005

Scott Heisler wrote:
> I want to put that image file on a RAMDISK on my server.
> The image file is between 3 and 4 gig.  I have 6 gig in the server, so
> plenty of memory.  I modified GRUB to increase the size of my ram
> disk... First I started with a 200mb, that worked group, formatted, etc.
> Then I tried 1gig - everything looks like it works but when I mount it,
> it tells me the volume is not formatted or has invalid super blocks.
> Perhaps I'm exceeding the allowable built-in ramdisk limit, but I
> couldn't find any docs anywhere that would tell me what that limit was.

When you say ramdisk, do you mean ramdisk as in ramsdisk device 
(hardware) that keeps information accross system reboots and/or power 
cycles, or ramdisk as in file system that exists only in your server's 
RAM and is lost each time machine is rebooted?  Not clear from your 
question.  You mention having "enough RAM for it in server" (which would 
imply later), but you also say that you are looking for "device" (which 
would imply former).

If you are looking for self-contained device, there are many solid state 
disks (SSD) available on the market.  Basically, they look like disk, 
the "only" difference is instead of having magnetic plates, they store 
information into internal RAM (either battery backed up, or of the 
non-volatile type).  System sees them as normal IDE/SATA/SCSI/FC drive 
(depending on the interface), and you don't need to have anything 
special to access them.  The speed is usually limited by interface used 
and type of memory used (obviously EEPROM based SSD will have much worse 
write times then DRAM with battery backup based SSD).

If you are looking for solution to use your server's memory as temporary 
RAM disk (you don't care information being lost when you reboot or power 
cycle), something like this works nicely:

# mount -t tmpfs -o size=8g none /ramdisk

That would create 8GB memory-based file system.  The memory file system 
uses is swappable.  So just make sure free RAM + free swap is larger 
than 8GB, and you should be fine.  Of course, you can create smaller or 
larger system too.  Basically it is the same thing as tmpfs on Solaris 
systems.  I kind of like to mount /tmp this way (of course, with much 
smaller size, usually 32-128MB, depending on server's needs).

Or you can place it in fstab to have it always available:

none   /ramdisk   tmpfs   size=8g   0   0

Aleksandar Milivojevic <amilivojevic at pbl.ca>    Pollard Banknote Limited
Systems Administrator                           1499 Buffalo Place
Tel: (204) 474-2323 ext 276                     Winnipeg, MB  R3T 1L7

More information about the CentOS mailing list