ramdisks [a solution]

Bill Davidsen davidsen at tmr.com
Thu Apr 16 00:00:59 UTC 2009


Mike Wright wrote:
> Sharpe, Sam J wrote:
>> 2009/4/15 Mike Wright <mike.wright at mailinator.com>:
>>> Oh, great pool of collective wisdom, oracle of all, please be so kind 
>>> as to
>>> share your knowledge with me.
>>>
>>> I seek knowledge of ramdisks.
>>>
>>> 1) In /dev there are 16 ramdisks of 16M each.  Are these free for the
>>> current user or are there other system processes that require them?
>>
>> Yes they should be free.
>>
>>> If they are free to use do I need them to exist if I have no use for 
>>> them?
>>
>> They don't exist (they aren't using any RAM) if you aren't using them...
>>
>>> 2) Where are these created?  I've seen documents that say one may add 
>>> kernel
>>> options in grub/lilo to set their size but that implies that they all 
>>> have
>>> that same size in common.  Where is their quantity determined?
>>
>> The kernel creates them. Here's a primer that's still pretty relevant:
>> http://www.vanemery.com/Linux/Ramdisk/ramdisk.html
> 
> Been there...
> 
>>
>> In particular if you look at /boot/config-`uname -r` which is the
>> config your running kernel was created with, you will see:
>> CONFIG_BLK_DEV_RAM=y
>> CONFIG_BLK_DEV_RAM_COUNT=16
>> CONFIG_BLK_DEV_RAM_SIZE=16384
>>
>> So without a kernel reconfig, you can't change them, but see my answer
>> above about them not using any space.
> 
> Wow.  Now that was very informative.  I didn't think to look in the 
> kernel configs.
> 
>>
>>> 3) Must they be created during the boot process?
>>
>> Depends what you mean. Yes those ones must be created during the boot
>> process because the kernel is configured like that, but extra ones can
>> be created outside the boot process as well.
>>
>>> Is there a way to override all of that and create my own layout?  For my
>>> application I'd rather have two ramdisks, one 10M and the other 30M, 
>>> plus
>>> any other(s) that may be required by the o/s.
>>
>> Now that, I don't know the answer to because I've never wanted two ram
>> disks of different sizes. I've set the ramdisk_size kernel parameter
>> to something bigger and only used one disk but never two of different
>> sizes. You'll need some other collective wisdom ;o)
>>
> 
> I came up with a solution that uses LVM and it works a *charm*, albeit, 
> probably because of large block sizes relative to the 16M size of the 
> ramdisks, seems inefficient (costs 25% each).  Maybe I can tune these 
> and get better.
> 
> pvcreate /dev/ram15
> pvcreate /dev/ram14
> pvcreate /dev/ram13
> pvcreate /dev/ram12
> 
> vgcreate my36Mdisk /dev/ram15 /dev/ram14 /dev/ram13
> vgcreate my12Mdisk /dev/ram/12
> 
> lvcreate -n myRamDisk1 -L 36M my36Mdisk
> lvcreate -n myRamDisk2 -L 12M my12Mdisk
> 
> mkfs.....
> 
> 
> ... and I have my ramdisks and my app screams!!!!
> 
> 
> Sam, thanks for the help :D
> 
Wow that sounds complex, why not just make the ramdisks larger? Just use the 
boot parameter which sets that:
   ramdisk_size=N
where N is the size in kilobytes, so for 256M you specify 262144.

-- 
Bill Davidsen <davidsen at tmr.com>
   "We have more to fear from the bungling of the incompetent than from
the machinations of the wicked."  - from Slashdot




More information about the fedora-list mailing list