Answer a question

On Ubuntu 18.04, When I run

$ df -h,

I see this result:

Filesystem      Size  Used Avail Use% Mounted on
...
tmpfs           3,9G   73M  3,8G   2% /dev/shm
...

/dev/shm has a 3.9G size.

How could I change the size of /dev/shm?

Answers

  1. Edit file /etc/fstab (with sudo if needed).
  2. In this file, try to locate a line like this one : none /dev/shm tmpfs defaults,size=4G 0 0.

Case 1 - This line exists in your /etc/fstab file:

  • Modify the text after size=. For example if you want an 8G size, replace size=4G by size=8G.
  • Exit your text editor, then run (with sudo if needed) $ mount -o remount /dev/shm.

Case 2 - This line does NOT exists in your /etc/fstab file:

  • Append at the end of the file the line none /dev/shm tmpfs defaults,size=4G 0 0, and modify the text after size=. For example if you want an 8G size, replace size=4G by size=8G.
  • Exit your text editor, then run (with sudo if needed) $ mount /dev/shm.
Logo

更多推荐