[Debian] Ramdisk for moar speeed! (English)

Remember the days in which you created ramdisks in DOS back in the 80s? Well, those days still exist. Debian creates a ramdisk every time you start the operating system and it’s not reserved as an exclusive system function. You can create as many of them as you have RAM for.

Personally, I have 64GB of RAM in my server I named [faun] and when I want to experiment with something that I don’t want permanently written to disk, I use a ramdisk. It’s safe that way.

If you’d like to create one, su into root and follow these instructions. First, create the directory.

# mkdir /memdisk

You can name it whatever you want, but I call mine memdisk. Now let’s figure out how large we want our disk. Let’s start with something small. Very small. Let’s say 1GB. When we write out the line to create it, it’ll be in MB, not GB so let’s get our bits-to-byte ratios correct. 1GB equals 1024MB. So let’s write that.

# mount -t tmpfs -osize=1024m tmpfs /memdisk

Do you see what I did there? If you have enough RAM, go larger. How about 4GB?

# mount -t tmpfs -osize=4096m tmpfs /memdisk

8GB is a good size if you’re playing with git.

# mount -t tmpfs -osize=8192m tmpfs /memdisk

Personally, I do 16GB or 32GB depending upon what I’m testing.

# mount -t tmpfs -osize=16384m tmpfs /memdisk
# mount -t tmpfs -osize=32768m tmpfs /memdisk

But you can go as low as 64MB.

# mount -t tmpfs -osize=64m tmpfs /memdisk

As long as the size of your ramdisk is calculated correctly, you can make it almost any size you want. Experiment. Play. Hack!

Enjoy!

 

Source: https://debiantalk.wordpress.com