linux ramdisks – howto pick the right kernel parameters to create 800MB large ramdisks…

To play with the application ansys / fluent doing an out-core solving process that requires fast scratch space, I was attempting to combine several cluster nodes ram-disks through lustre.

The surprise here is two-fold: With kernel 2.6 the old ramdisk-parameter is obsoleted by the newer ramdisk_size and ramdisk_blocksize. The other one is that by default, it fails in a bizarre way:

mkfs seems happy, but mount says “mount: wrong fs type, bad option, bad superblock on /dev/ramdisk, or too many mounted file systems”. A peek in the output of dmesg told me:

EXT2-fs: Magic mismatch, very weird !

Very wierd indeed. I was puzzled, but thanks to I got to the bottom without having to read the kernel source: He ran into the same issue and figured out that it was the blocksize and solved it by specify the blocksize of the filesystem to be 1k instead of the default 4k.

I now use the kernel parameters ‘ramdisk_size=819200 ramdisk_blocksize=4096’ instead since all data I want to store will be in very few large files anyways and so the 4k blocksize is more efficient and more friendly to the lustre tools anyways…

Note that the ramdisk_size is in KB whereas the blocksize is in bytes.


~ by MrMichaelWill on April 1, 2008.

2 Responses to “linux ramdisks – howto pick the right kernel parameters to create 800MB large ramdisks…”

  1. Hi,

    I followed your technique and successfully set up a big ramdisk, but ran into trouble partitioning it. Details:

    I’m trying to set up a logical volume over a 256MB ramdisk and a 1TB raid array partition. My ramdisk (set up in grub.conf with ramdisk_size=262144 ramdisk_blocksize=4096) fails to make a type 8e partition either in fdisk or sfdisk. The error in fdisk is

    WARNING: Re-reading the partition table failed with error 22: Invalid argument.
    The kernel still uses the old table.
    The new table will be used at the next reboot.

    And, of course, after the next reboot, my ramdisk data is gone. I noticed your base case (according to the reference you gave) was a file system directly on the unpartitioned volume; but I have to partition it to use LVM.



  2. You don’t need partitions for LVM either – just do a pvcreate on the ramdisk device and then you can use it. Keep in mind though that the content of your 1TB logical volume will be missing 256MB of its space after a reboot… what exactly are you trying to achieve?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: