How to create a ramdisk, or tmpfs instance

ramdisk:
ram disk is a portion of memory which being used as if it is a disk drive.
ram disks have fixed size, and act like a partition disk.
The access to ram disk is much faster than a real physical disk, however all contenent
of the ram disk will be lost when the system is power off.

You can even take a detailed look at the new ramdisk with the tune2fs command:$ sudo tune2fs -l /dev/ram

If you need to automating creation of ramdisk on boot, add these lines above
to the local init file rc.local.

Inconvenient of ramdisks:
– simulation of a physical disk device with a fix size.
– needs to filesystem driver (ext2) to format and interpret this data
– multiple memory operation copy, fake block device into the page cache (and copying changes back out)
– ramdisks cannot swap and you do not have the possibility to resize them.

ramfs:
ramfs is a very simple filesystem that exports Linux’s disk caching
mechanisms (the page cache and dentry cache) as a dynamically resizable
RAM-based filesystem.

tmpfs:
A ramfs derivative called tmpfs was created to add size limits, and the
ability to write the data to swap space.
Normal users can be allowed write access to tmpfs mounts.
Everything in tmpfs is temporary in the sense that no file will be created on
you hard drive.