Ram disk size

Hi! Have such a question: how to set ramdisk size? Ramdisk: How do you install and set up Ramdisk under Linux (CentOS, RHEL, Fedora)? | Technology: Learn and Share

Here is some article, but somehow GRUB setting takes no effect, size is still limited to 100MB. I need to get ramdisk with size about 700-1500 MB.
Hope, that someone can help me.

Addon information:
OpenSuSE 11.4 (64 bit), Kernel 3.0.

Hm, I am in no way an expert here, but that documentation you point to is rather old. I personlay would try to use tmpfs when I needed a file system in RAM. IIRC it resizes according to need.

Where it is located? How to access it? I guess, that it will not match, cause if it’s stable, it will use hubrid(HDD+RAM, that’s not good, I need RAM only), if it uses RAM only, it can consume all memory available and cause crash. I need a RAM drive with fixed size, but more, then 100 MB.

You could try to find some documentation yoursef. The following is an extract from

man 8 mount
Mount options for tmpfs
       size=nbytes
              Override default maximum size of the filesystem.  The size is given in bytes,  and  rounded  up  to
              entire  pages.   The  default  is half of the memory. The size parameter also accepts a suffix % to
              limit this tmpfs instance to that percentage of your physical RAM: the default, when  neither  size
              nor nr_blocks is specified, is size=50%

       nr_blocks=
              The same as size, but in blocks of PAGE_CACHE_SIZE

       nr_inodes=
              The  maximum number of inodes for this instance. The default is half of the number of your physical
              RAM pages, or (on a machine with highmem) the number of lowmem RAM pages, whichever is the lower.

       The tmpfs mount options for sizing ( size, nr_blocks, and nr_inodes) accept a suffix k, m or g for Ki, Mi,
       Gi (binary kilo, mega and giga) and can be changed on remount.


       mode=  Set initial permissions of the root directory.

       uid=   The user id.

       gid=   The group id.

       mpol=[default|prefer:Node|bind:NodeList|interleave|interleave:NodeList]
              Set  the NUMA memory allocation policy for all files in that instance (if the kernel CONFIG_NUMA is
              enabled) - which can be adjusted on the fly via 'mount -o remount ...'

              default
                     prefers to allocate memory from the local node

              prefer:Node
                     prefers to allocate memory from the given Node

              bind:NodeList
                     allocates memory only from nodes in NodeList

              interleave
                     prefers to allocate from each node in turn

              interleave:NodeList
                     allocates from each node of NodeList in turn.

              The NodeList format is a comma-separated list of decimal numbers and  ranges,  a  range  being  two
              hyphen-separated decimal numbers, the smallest and largest node numbers in the range.  For example,
              mpol=bind:0-3,5,7,9-15

              Note that trying to mount a tmpfs with an mpol option will fail if the running kernel does not sup-.
              port  NUMA;  and  will  fail  if its nodelist specifies a node which is not online.  If your system
              relies on that tmpfs being mounted, but from time to time runs a kernel built without NUMA capabil-
              ity  (perhaps a safe recovery kernel), or with fewer nodes online, then it is advisable to omit the
              mpol option from automatic mount options.  It can be added later, when the tmpfs is already mounted
              on MountPoint, by 'mount -o remount,mpol=Policy:NodeList MountPoint'.

And here tmpfs - Wikipedia, the free encyclopedia it says “… well as filesystem size and inode limits to prevent out of memory situations …”.

And Google brings much more like a rather recent http://www.mjmwired.net/kernel/Documentation/filesystems/tmpfs.txt

Well, I was talking through skype to my friend, and we revealed one problem, possibly because of that setting given in grub does not work.

During startup, module brd is not loading. Have to run “modprobe brd” manually all the time, to create /dev/ram* devices.

linux-2x9m:/dev # insmod /lib/modules/3.0.0-39-default/kernel/drivers/block/brd.ko
insmod: error inserting ‘/lib/modules/3.0.0-39-default/kernel/drivers/block/brd.ko’: -1 File exists

it says module exists. How to make module to initialize on startup?

Hi
Just use YaST->System->/etc/sysconfig editor then System->Kernel and add to INITRD_MODULES and save.

Thanks! Now /dev/ram* is automatically created.

Hmm, but still size parameter is being ignored :frowning: . Any more ideas how to fix that? Maybe somehow, it’s possible to set that size value on fly?

Hi
You need to add the module options (parm);


 /sbin/modinfo brd
filename:       /lib/modules/2.6.37.6-0.7-desktop/kernel/drivers/block/brd.ko
alias:          rd
alias:          block-major-1-*
license:        GPL
srcversion:     51D18FC93E2D2BFC3F8992E
depends:        
vermagic:       2.6.37.6-0.7-desktop SMP preempt mod_unload modversions 
parm:           rd_nr:Maximum number of brd devices (int)
parm:           rd_size:Size of each RAM disk in kbytes. (int)
parm:           max_part:Maximum number of partitions per RAM disk (int)

Look at /etc/modprobe.d/00-system.conf and place your options in 99-local.conf

Tried it out

options rd rd_nr=5 max_part=3 rd_size=300000

still only 100 mb :frowning:

Hi
It should be the module name brd nor rd?

Well, original module name = brd, and rd = > used as alias.

Hi
What happens if you make the size as the article indicates in multiples of 1024…