GIT – There are many reasons for creating a memory based file system in , not least of which is to provide a near zero latency and extremely fast area to story files. A prime use of a RAM is for application caching directories or work areas.

There are two main types of RAM disk which can be used in Linux and each have their own benefits and weaknesses:

  • ramfs
  • tmpfs

See my other post for the differences between ramfs and tmpfs.

Check the amount of free RAM you have left on your machine before creating a RAM disk. Use the Linux  free to see the unused RAM. The below is an example of a 31GB of ram in a production .

The free command shows the amount of RAM availale on your system in addition to the amount of memory used, free and used for caching. SWAP space is also displayed and shows if your system is writing memory to disk.

Create a folder to use as a point for your RAM disk.

Then use the mount command to create a RAM disk.

Substitute the following attirbutes for your own values:

  • [TYPE] is the type of RAM disk to use; either tmpfs or ramfs.
  • [SIZE] is the size to use for the file system. Remember that ramfs does not have a physical limit and is specified as a starting size.
  • [FSTYPE] is the type of RAM disk to use; either tmpfsramfsext4, etc.

Example:

You can add the mount entry into /etc/fstab to make the RAM disk persist over reboots. Remember however, that the data will disappear each time the machine is restarted.

See my other post for the differences between ramfs and tmpfs.

Print Friendly

Comments

comments

Bài viết liên quan