Skip to content

Instantly share code, notes, and snippets.

@AnatomicJC
Last active August 5, 2021 20:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AnatomicJC/260e4a0c53f116c06b8fa351715691d6 to your computer and use it in GitHub Desktop.
Save AnatomicJC/260e4a0c53f116c06b8fa351715691d6 to your computer and use it in GitHub Desktop.
XFS write-cache

/etc/systemd/system/xfs-write-cache.service

[Unit]
Description=Set XFS Write cache to write through

[Service]
Type=oneshot
User=root
Group=root
ExecStart=/usr/lib/systemd/system-sleep/xfs-write-cache
RemainAfterExit=true
StandardOutput=journal

[Install]
WantedBy=multi-user.target

/usr/lib/systemd/system-sleep/xfs-write-cache

#!/bin/sh
echo "write through" | sudo tee /sys/block/sda/queue/write_cache

We put xfs-write-cache executable script in /usr/lib/systemd/system-sleep/ because we want the "write through" setting to be set again after a resume.

Source: https://serverfault.com/questions/980677/xfs-with-no-barrier-mount-option-deprecated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment