Get the latest tech news

Save your disk, write files directly into RAM with /dev/shm


Given my interest in extending the life of my SD cards and hard drives as much as possible, I’m surprised I haven’t come across /dev/shm before. In a word it’s a world-accessible RAM scratchpad, which seems baked right into POSIX, so that virtually every Unix system already has it mounted as a tmpfs by default: 1 2 ❯ mount | grep '/dev/shm' tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,inode64) Today’s lucky 10,000, indeed.

In a word it’s a world-accessible RAM scratchpad, which seems baked right into POSIX, so that virtually every Unix system already has it mounted as a tmpfs by default: If you can live with that, and if you don’t run memory hog programs 24/7, you can put things you’re currently working with in there to mess with to your heart’s content, and get a few orders of magnitude more performance out of anything you might want to do with those files. In general I have found that moving 1-4 GB files I expect to work heavily with into/dev/shm first makes operating on them with standard command-line tools much, much more pleasant.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of Files

Files

Photo of RAM

RAM

Photo of disk

disk

Related news:

News photo

Show HN: Inspect and extract files from MSI installers directly in your browser

News photo

Remorseless extortionists claim to have stolen thousands of files from Freedman HealthCare

News photo

Anubis ransomware adds wiper to destroy files beyond recovery