extX(X=2,3,4)等文件系统的数据盘也需要预留 5%的空间吗?

2021-08-20 16:15:15 +08:00
 zhoudaiyu

看了一些说法,如serverfault里面说的预留是为了即便系统盘空间打满后,系统的一些关键进程还能跑,比如 ssh 什么的。但是数据盘有必要预留这么大吗?尤其是比如 7 个 T 的盘要少将近 350G 的磁盘空间,感觉很亏啊!难道这个预留空间还有什么别的用途?还有个问题想请教一下,就是可以通过一个命令( tune2fs -m 0 /dev/foo_bar )优化这个空间,这个命令对 I/O 量很大的磁盘会产生性能抖动吗?

1397 次点击
所在节点    Linux
8 条回复
heyjei
2021-08-20 16:58:57 +08:00
>>> 引用 https://listman.redhat.com/archives/ext3-users/2009-January/msg00026.html
If you set the reserved block count to zero, it won't affect
performance much except if you run for long periods of time (with lots
of file creates and deletes) while the filesystem is almost full
(i.e., say above 95%), at which point you'll be subject to
fragmentation problems. Ext4's multi-block allocator is much more
fragmentation resistant, because it tries much harder to find
contiguous blocks, so even if you don't enable the other ext4
features, you'll see better results simply mounting an ext3 filesystem
using ext4 before the filesystem gets completely full.

If you are just using the filesystem for long-term archive, where
files aren't changing very often (i.e., a huge mp3 or video store), it
obviously won't matter.
privil
2021-08-20 17:01:35 +08:00
这个命令对 I/O 量很大的磁盘会产生性能抖动吗? 应该是不会,只是标记一下可用块的数量而已。
zhoudaiyu
2021-08-20 17:08:09 +08:00
@heyjei #1 太感谢了,看来是没啥事,大哥你是咋搜到的啊
@privil #2 感谢,看了 1 楼大哥的回答,看来是没什么影响
billlee
2021-08-20 21:47:42 +08:00
设定 5% 这个默认值的时候还没有这么大的硬盘,大硬盘上可以改成 1% 什么的
Remember
2021-08-22 14:25:32 +08:00
为什么要用这么落后的 fs,就算 btrfs 不足以让你心安,xfs 也已经成熟很多年了啊
zhoudaiyu
2021-08-22 14:36:12 +08:00
@Remember 我是小弟,我说不好使啊
jim9606
2021-08-23 11:18:27 +08:00
我跟你说根 fs 没空间之后(指空间剩余 0B,连空文件都不能创建的那种) ssh 会有啥问题:
1. bash 按 tab 补全就会提示没空间
2. 包管理器因为创建不了 lock 文件导致无法运行
3. 部分服务因为创建不了 pid 文件而无法启动

但是只要有一点点空间让小文件能被创建,就没有问题。预留空间可能会用于临时存放 dump 、日志,还有像包管理器也需要一定的空闲空间容纳下载的软件列表、待安装软件包等。写日志如果没做轮替或者没有限制写日志频率也有可能轻松把磁盘撑爆,留空间有助于在为告警后为排查问题争取点时间。
zhoudaiyu
2021-08-23 11:29:12 +08:00
@jim9606 看来对 ssh 倒是没啥影响

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/797061

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX