Check if Linux shared memory shmem RAM or HDD

/dev/shm/ and /run/shm/ map shmem shared memory to a RAM drive on typical Linux systems, useful for IPC. They are also present in Windows Subsystem for Linux (WSL). On WSL, they write to HDD instead of RAM. It’s easy to tell if RAM vs. HDD is being used for shared memory, since RAM has GB/sec speeds vs. HDD having MB/sec speeds.


  1. note free space in df -kh /dev/shm and free -h

  2. write 1 GB to shmem

    dd if=/dev/zero of=/dev/shm/blah bs=10M count=100
  3. recheck df -kh /dev/shm and free -h for which one has 1GB space more used. This tells if hard drive or RAM was used.

Benefits of /dev/shm for IPC

For programs using shared memory for heavy writing operations, problems include:

  1. order(s) of magnitude slower /dev/shm/ operations when HDD is used versus RAM
  2. wearing of solid state drive if /dev/shm is pointed there


dd if=/dev/zero of=/dev/shm/blah bs=10M count=100

You’ll see

  • SSD: 100s of MB/sec
  • HDD: 10s of MB/sec
  • RAM: 1000s of MB/sec