Search This Blog

Wednesday, January 6, 2010

Create Ramdisk Image

To make a ramdisk image

1) Copy a root file system in a common directory.

2) Make a dummy image file
$ dd if=/dev/zero of=ramdisk.img bs=1M count=16

3) Format the image with ext2 file system
$ mke2fs -F ramdisk.img

4) Mount the image as loop device
$ mount -o loop ramdisk.img tmp

5) Copy the content of the root file system
$ cp rootimg tmp -rf
$ sync

6) Unmount the loop image
$ umout tmp

7) This ramdisk can be used to write on the ramdisk partition.