Analytic

Wednesday, December 31, 2008

Change RAMDISK size in Debian

Edit /boot/grub/menu.lst (or grub.conf or lilo.conf) and add ramdisk_size=512000 to this line:
kernel /vmlinuz root=/dev/md1 ro console=tty0 console=ttyS0,57600

kernel /vmlinuz root=/dev/md1 ro ramdisk_size=512000 console=tty0 console=ttyS0,57600

it defines 512 MB Ramdisk.

Reboot system.

To create an ext2fs file system, the following command is used :

mke2fs -m 0 /dev/ram0

The -m 0 option keeps mke2fs from reserving any space on the file system for the root user. This makes the complete ramdisk space available to any regular user.


To mount the ramdisk :


mkdir /mnt/RAMDISK
mount /dev/ram0 /mnt/RAMDISK

Run mount to check whether the RAMDISK has been mounted.
Now the RAMDISK can be used as a regular directory. You can read, write, delete and modify files on the RAMDISK as if you are working on a regular hard disk. Linux would handle it as if it were handling a regular directory on the disk. The difference between RAMDISK and normal DISK would be invisible to a regular user.

The only problem is that if the system is either rebooted or crashes. In that case, all data in the RAMDISK is lost. You will need to recreate the RAMDISK and redo all that has been done.

No comments: