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

169 天前
 villivateur

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

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

691 次点击
所在节点    问与答
3 条回复
yidinghe
169 天前
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
169 天前
Squash + overlayfs
flynaj
169 天前
可以看看 openwrt 是怎么处理的,刷机的路由器随便怎么断电都没有问题。

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

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

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

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

© 2021 V2EX