V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
zhoudaiyu
V2EX  ›  Linux

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

  •  
  •   zhoudaiyu · 2021-08-20 16:15:15 +08:00 · 1392 次点击
    这是一个创建于 977 天前的主题,其中的信息可能已经有所发展或是发生改变。

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

    8 条回复    2021-08-23 11:29:12 +08:00
    heyjei
        1
    heyjei  
       2021-08-20 16:58:57 +08:00   ❤️ 1
    >>> 引用 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
        2
    privil  
       2021-08-20 17:01:35 +08:00
    这个命令对 I/O 量很大的磁盘会产生性能抖动吗? 应该是不会,只是标记一下可用块的数量而已。
    zhoudaiyu
        3
    zhoudaiyu  
    OP
       2021-08-20 17:08:09 +08:00
    @heyjei #1 太感谢了,看来是没啥事,大哥你是咋搜到的啊
    @privil #2 感谢,看了 1 楼大哥的回答,看来是没什么影响
    billlee
        4
    billlee  
       2021-08-20 21:47:42 +08:00   ❤️ 1
    设定 5% 这个默认值的时候还没有这么大的硬盘,大硬盘上可以改成 1% 什么的
    Remember
        5
    Remember  
       2021-08-22 14:25:32 +08:00
    为什么要用这么落后的 fs,就算 btrfs 不足以让你心安,xfs 也已经成熟很多年了啊
    zhoudaiyu
        6
    zhoudaiyu  
    OP
       2021-08-22 14:36:12 +08:00 via iPhone
    @Remember 我是小弟,我说不好使啊
    jim9606
        7
    jim9606  
       2021-08-23 11:18:27 +08:00
    我跟你说根 fs 没空间之后(指空间剩余 0B,连空文件都不能创建的那种) ssh 会有啥问题:
    1. bash 按 tab 补全就会提示没空间
    2. 包管理器因为创建不了 lock 文件导致无法运行
    3. 部分服务因为创建不了 pid 文件而无法启动

    但是只要有一点点空间让小文件能被创建,就没有问题。预留空间可能会用于临时存放 dump 、日志,还有像包管理器也需要一定的空闲空间容纳下载的软件列表、待安装软件包等。写日志如果没做轮替或者没有限制写日志频率也有可能轻松把磁盘撑爆,留空间有助于在为告警后为排查问题争取点时间。
    zhoudaiyu
        8
    zhoudaiyu  
    OP
       2021-08-23 11:29:12 +08:00 via iPhone
    @jim9606 看来对 ssh 倒是没啥影响
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1018 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 20:14 · PVG 04:14 · LAX 13:14 · JFK 16:14
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.