1Gb ramdisk in RHEL3
Dave Johnson
dave-gnhlug-list at davej.org
Fri Jul 25 16:01:10 EDT 2008
Michael ODonnell writes:
>
>
> 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
If you're using a ramdisk for purposes other than booting, make sure
you have backported this fix if you are running a kernel older than
2.6.24:
if you don't, your ramdisk blocks will disapear once you use all the
ram in the system and the kernel needs to free memory
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=5d0360ee96a5ef953dbea45873c2a8c87e77d59b
--
Dave
More information about the gnhlug-discuss
mailing list