V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
villivateur
V2EX  ›  问与答

一个经常会意外断电的机器,如何选取文件系统?

  •  
  •   villivateur · 196 天前 · 719 次点击
    这是一个创建于 196 天前的主题,其中的信息可能已经有所发展或是发生改变。

    我这里有个产品,基于 ARM Linux ,客户会经常断电。这个产品运行的时候也会经常写各种参数文件、记录日志。

    应该如何选取文件系统?只要其经常断电的情况下,也不会出现文件系统损坏就行了。

    3 条回复    2024-06-15 01:57:31 +08:00
    yidinghe
        1
    yidinghe  
       196 天前 via Android   ❤️ 2
    https://www.reddit.com/r/linux/s/3qA3EyiNsd
    回答贴在下面:

    Actual file system engineer here. All modern file systems are power fail tolerant. The only one that is regularly used that isn't is FAT, or ext2 if you still use that.

    Now this just means your metadata will be consistent, any data that hasn't been written out to disk yet will be lost. ext3 will write all dirty data before it commits the journal every 5 seconds, so it is least likely to screw you, you will only lose the last 5 seconds worth of data. Ext4, btrfs and xfs all do this thing called delayed allocation, which means we avoid writing data until the last possible moment, so you could very well lose the last 5 minutes of data written but still have a consistent file system if your applications are not using fsync().

    I know next to nothing about ZFS, but delayed allocation is a pretty universal file system feature so you can bet they do roughly the same thing, making them no better at being power fail tolerant than any other modern file system. The other thing about ZFS is that they do not have a fsck, so if you trust your ZFS file system developers to not make mistakes then go for it, but speaking as a file system developer, the kind of mistakes we make are never simple and easily recovered from.
    busier
        2
    busier  
       195 天前 via iPhone
    Squash + overlayfs
    flynaj
        3
    flynaj  
       195 天前 via Android
    可以看看 openwrt 是怎么处理的,刷机的路由器随便怎么断电都没有问题。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   4550 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 22ms · UTC 09:58 · PVG 17:58 · LAX 01:58 · JFK 04:58
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.