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 http://jackalltrade.blogspot.com/2006/10/step-by-step-set-up-large-ramdisk-on.html 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.