大网数据广告活动
服务器运维问答

Mounts happening on boot, but not defined in /etc/fstab

· 52CE 我爱测

On every boot, my machine (CentOS 7) mounts all these: # df -h Filesystem Size Used Avail Use% Mounted on /dev/sda1 30G 2.6G 28G 9% / devtmpfs 287M 0 287M 0% /dev tmpfs 294M 0 294M 0% /dev/shm tmpfs 294M 34M 261M 12% /run tmpfs 2…

问题原文

原帖链接 · Nuno · CC BY-SA 4.0

On every boot, my machine (CentOS 7) mounts all these:

# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1        30G  2.6G   28G   9% /
devtmpfs        287M     0  287M   0% /dev
tmpfs           294M     0  294M   0% /dev/shm
tmpfs           294M   34M  261M  12% /run
tmpfs           294M     0  294M   0% /sys/fs/cgroup

But my /etc/fstab only contains these:

# cat /etc/fstab
UUID=823db525-82d9-467e-acdf-7379cbd85171 /    xfs     defaults        0 0

Where would all the mounts of "tmpfs" be defined?
Where can I configure their sizes?

If I add more entries in my /etc/fstab, such as something like:

tmpfs       /dev/shm     tmpfs   defaults,noatime      0 0

Would that cause a conflict with whatever setting is already mounting that on boot?

已采纳解答

原帖链接 · HBruijn · CC BY-SA 4.0

CentOS 7 uses systemd.
Systemd will create some API File Systems automatically, with default (kernel) settings but you can still add those to /etc/fstab to use custom options:

... Even though normally none of these API file systems are listed in /etc/fstab they may be added there. If so, any options specified therein will be applied to that specific API file system. Hence: to alter the mount options or other parameters of these file systems, simply add them to /etc/fstab with the appropriate settings and you are done...

In addition to the conventional /etc/fstab control file systemd supports .mount unit files which can be used to manage your custom mounts.
See man systemd.mount for more detail.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2018-10-18)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。