Hacker News new | ask | show | jobs
by joshspankit 1985 days ago
With sudden power loss, the difference is that any single write may be in the cache for longer than the time it would have taken to write it. In the case of no cache with a power loss there is only a single possible failure: power loss during write. With cache that expands to two possible failures: Power loss during write from cache, and power loss with unwritten data in the cache.
1 comments

You can disable 'write cache' on your linux system.

to see wether or not write cache is active

cat /sys/block/[your block device]/queue/write_cache

write back means the write operation is completed as soon as it hits the linux write cache you can set it to write through to make it wait untill the controller responds, this has obvious performance implications depending on the workload. note that alot of hdd's and all ssd's have their own caches and you'll need to disable those as well.

that would at least give alot of performance back from the read cache.

check nvme controller write cache [1]

sudo nvme id-ctrl /dev/nvme0|grep vwc

disable nvme write cache

sudo nvme set-feature /dev/nvme0 -f 0x6 -v 0

I have not tested anything and I do not recommend this in the slightest, dont expect to be protected against sudden power failure data loss. it will also destroy your ssd and amplify writes considerably.

[1] https://wiki.archlinux.org/index.php/Solid_state_drive/NVMe#...