This is how I create RAM disk manually on Linux Debian Jessie:

mount -o size=1G -t tmpfs none /mnt/tmpfs

My question is, how do I make this automatic at each computer startup?


You don't need a script for that: there's a system facility to mount a filesystem at boot time. Add it to the file /etc/fstab. Open this file in your favorite text editor and add a line like this:

none /mnt/tmpfs tmpfs size=1G

Make sure not to accidentally modify other lines.

Note that there's already a tmpfs filesystem¹ mounted at /run. Debian doesn't make /tmp tmpfs by default, but you can make it so by editing /etc/default/tmpfs and changing the RAMTMP line to


¹ This isn't a RAM disk: it doesn't reserve memory, only the space used for files takes up memory, and its pages can be swapped out just like application data.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.