August 27, 2011

Steps to create a RAMDISK i.e. /dev/ram

Subject: Commands to create a /dev/ram block device in debian

While checking in Debian 6,  it was observed that the /dev/ram disks are not created by default. To create the block device:

1) Login as root from the terminal and create the block device:

     root@lino90:~ mknod -m 660 /dev/ram b 1 1

    Command description:
                      mknod - make block or character special files
    Options:
               -m --mode=MODE
                       set file permission bits to MODE, not a=rw - umask
                b      create a block (buffered) special file

2) Then,  zero out the space that need to be on the ramdisk
    
     root@lino90:~ sudo dd if=/dev/zero of=/dev/ram bs=1K count=16K

To create a file system on the ramdisk and mount the ramdisk, refer to my earlier blog Optimizing Squid - (Part 1).