What is RamDisk? A RamDisk is a part of the memory space you use as a hard disk partition. In other words, you assume that the memory is a hard drive and you store files on it. It is to improve the read/write speed, because you know that the memory I/O speed is N times the hard disk's 5 million ah !).
Sample Code: Create a ramdisk and mount it
# Create a mount point:
Mkdir/tmp/ramdisk0
# Create a filesystem:
Mke2fs/dev/ram0 # or: mkfs-t ext2/dev/ram0
# Mount the ramdisk:
Mount/dev/ram0/tmp/ramdisk0
If the formatting of ramdisk fails, your kernel does not support ramdisk. The Kernel configuration option is CONFIG_BLK_DEV_RAM.
* Execute df-k/dev/ram0 and how much space you actually use.
* Do not place any uncopied data in this region. If you have modified the Directory and need to keep the changes, you can back up the directory in some ways.
Set a cron process. Make it check for file changes every 10 minutes and back up these changes
* The default ramdisk size is 4 Mb = 4096 blocks. When you perform mke2fs, you can see the size of your ramdisk.
* To use ramdisk, you must obtain Kernel support or load it into the system as a module. The Kernel configuration option is CONFIG_BLK_DEV_RAM. The advantage of compiling ramdisk Into A loadable module is that you can re-determine the size of ramdisk during loading.
* A cool practice is to use a computer with 1g memory and use M as "/tmp ". if you have many processes using "/tmp", this will increase your system speed. At the same time, the items in the/tmp directory will be deleted when the system restarts. This is a good thing.