btrfs: Mount with flushoncommit
flag
Not an expert on this, but my understanding is that without this flag, outages will result in a state that despite being consistent, most applications are not mature enough to handle. Namely, we ran benchmarks that reproduced appearance of zero-length files upon sudden poweroffs. Databases should be fine since they know well about the guarantees the filesystem must provide, but not applications are databases. So let's play safe about this. See: - https://thunk.org/tytso/blog/2009/03/12/delayed-allocation-and-the-zero-length-file-problem/ - https://github.com/Zygo/bees/issues/68#issuecomment-403262059
This commit is contained in:
parent
d52f8ffbe0
commit
c11646e08c
@ -40,7 +40,13 @@ def be_mounted(dev, mountpoint):
|
|||||||
# noinspection PyUnreachableCode
|
# noinspection PyUnreachableCode
|
||||||
be_unmounted(mountpoint)
|
be_unmounted(mountpoint)
|
||||||
|
|
||||||
|
fs = current_fs(dev)
|
||||||
|
if fs == "ext4":
|
||||||
run(f"mount {dev} {mountpoint}")
|
run(f"mount {dev} {mountpoint}")
|
||||||
|
elif fs == "btrfs":
|
||||||
|
run(f"mount -o flushoncommit {dev} {mountpoint}")
|
||||||
|
else:
|
||||||
|
raise Exception(f"Unsupported fs type: {fs}")
|
||||||
|
|
||||||
|
|
||||||
def be_unmounted(path):
|
def be_unmounted(path):
|
||||||
|
Loading…
Reference in New Issue
Block a user