1Gb ramdisk in RHEL3
Michael ODonnell
michael.odonnell at comcast.net
Fri Jul 25 15:42:14 EDT 2008
OK, the ramdisk story is looking a bit better now.
First, the tmpfs trick is definitely cool and worth remembering
but isn't what we're looking for because some of what makes it
cool also makes it unsuitable for our purposes. In particular,
tmpfs has close ties to the kernel's buffer cache so files
in tmpfs may actually be on backing store and since we're
investigating a ramdisk solution to get some low-latency
characteristics that makes tmpfs unsuitable for our purpose.
Too bad, because rigging tmpfs is easier than rigging a ramdisk.
The key to getting the !@$#@!!! ramdisk to be usable was figuring
out that ext2 and the ramdisk device driver had to agree on
block size. The default for ramdisk is 1k and the default for
ext2 is 4k. At first I tried to specify ramdisk_size=1048576
and ramdisk_blocksize=4096 on the kernel commandline (units are
Kb for the former and bytes for the latter) and all would have
been well..... except that the machine in question boots from an
initrd and the ext2 filesystem therein was already specified as
using 1k blocks and the kernel panic'd when it failed to mount
the initrd due to that mismatch.
So, since I don't feel like rebuilding the initrd's filesystem
with 4k blocksize I had the ramdisk fall back to the default 1k
and told mkfs.ext2 to build the filesystem in the ramdisk using
a 1k blocksize, thus:
dd if=/dev/zero bs=1024k count=1048576 of=/dev/ram9
mkfs.ext2 -b 1024 /dev/ram9
mount /dev/ram9 /mnt/test
More information about the gnhlug-discuss
mailing list