如何调整/dev/shm的大小? [英] How to resize /dev/shm?

查看:165
本文介绍了如何调整/dev/shm的大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Ubuntu 18.04 上,当我运行

$ df -h

我看到了这个结果:

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

/dev/shm 的大小为3.9G.

如何更改/dev/shm 的大小?

推荐答案

  1. 编辑文件/etc/fstab (如果需要,使用 sudo ).
  2. 在此文件中,尝试找到这样的一行: none/dev/shm tmpfs defaults,size = 4G 0 0 .
  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.

情况1-您的/etc/fstab 文件中存在以下行:

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

  • 修改 size = 之后的文本.例如,如果您想要8G大小,请用 size = 8G 替换 size = 4G .
  • 退出文本编辑器,然后运行(如果需要,使用 sudo ). $ mount -o remount/dev/shm .
  • 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.

情况2-您的/etc/fstab 文件中不存在以下行:

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

  • 在文件末尾添加 none/dev/shm tmpfs默认值行,size = 4G 0 0 ,并在 size = 之后修改文本.例如,如果您想要8G大小,请用 size = 8G 替换 size = 4G .
  • 退出文本编辑器,然后运行(如果需要,使用 sudo ) $ mount/dev/shm .
  • 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.

这篇关于如何调整/dev/shm的大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆