How to increase size of /dev/shm?

Hi, I’d want to increase the size of /dev/shm (currently is of 7,8GB)
By reading here tmpfs - ArchWiki is stated that:

Mounting tmpfs at /dev/shm is handled automatically by systemd and manual configuration in fstab is not necessary.

But I can’t find the systemd units nor config files where to set the size of /dev/shm.

Create an override file for /usr/lib/systemd/system/tmp.mount.

Hi @D.Dave,

According to that very article you linked to:

Tip: Temporary files in tmpfs directories can be recreated at boot by using systemd-tmpfiles.

I made an override config file with the following content:

[Mount]
What=tmpfs
Where=/dev/shm
Type=tmpfs
Options=rw,nosuid,nodev,noexec,inode64,size=9G

But I get the error:

Cannot create mount unit for API file system /dev/shm. Refusing

How did you create it?

/etc/systemd/system/tmp.mount.d/override.conf

API VFS are not supported as .mount units. Currently the only way to configure mount options for them is by adding an /etc/fstab file. And I think this is unlikely to change.

You need to give more complete answers, help people to help you, otherwise you won’t get the help and you’ll get very frustrated. Anyway, that’s where, how would’ve included that. But that doesn’t answer the question. After creating it, you should’ve reloaded systemd for it to become visible and the and then reloaded the unit for the changes to take effect.

  1. First create the drop-in:
sudo systemctl edit tmp.mount
  1. Then you need to only change what you wish to be different:
[mount]
Options=
Options=rw,nosuid,nodev,noexec,inode64,size=9G

Save and exit.

  1. Now you need to reload systemd:
sudo systemctl daemon-reload

You should now be able to see the override in the status output:

systemctl status tmp.mount

There should be a line similar to:

Drop-In: /etc/systemd/system/pacman-filesdb-refresh.service.d
└─override.conf
  1. If so, you can reload the mount unit:
sudo systemctl restart tmp.mount

Hope this helps!

it’s for tmp and no for shm (shm is an “alias”)

systemctl cat tmp.mount 

for change

sudo systemctl edit tmp.mount
1 Like

I just followed what already exists: the instruction on the arch wiki (and in past I already used override.conf), and there is only this way to create an override: I just avoided to be redundant.

However: check my post n°7: /dev/shm cannot be mounted by any mount unit:

There is also a link on the Systemd’s Github which confirm this.

If this is the case, simply add the line to /etc/fstab, IIRC.

Indeed :+1:

I think it’s obvious to see I’ve never overrode any .mount unit…

Oops. I thought changing only the Options= line would work, but it only changes /tmp size. Apparently /dev/shm is hardcoded and adding /etc/fstab line would be the best option. Either that or maybe creating a new .mount unit.

I also tried dev-shm.mount (with the same error), but as explained in post n°7, /dev/shm cannot be mounted using a mount unit.

Roger that.