Skip to content

Instantly share code, notes, and snippets.

@tsjk
Last active January 9, 2024 20:17
Show Gist options
  • Save tsjk/f636364c1d89a8f127998937c208b971 to your computer and use it in GitHub Desktop.
Save tsjk/f636364c1d89a8f127998937c208b971 to your computer and use it in GitHub Desktop.
Disabling of sleep on external disk using sdparm so that they do not disconnect in middle of transactions (e.g. WD_My_Book_25ED)
#!/bin/bash
# Usage: sdparm-disable_sleep.sh <device>
[[ -n "${1}" && -b "${1}" ]] \
&& sdparm --flexible --page=po -l -a "${1}" \
&& { sdparm --set=STANDBY_Z=0 -S "${1}" \
&& sdparm --set=SZCT=$((45*60*100)) -S "${1}" \
&& sdparm --flexible --page=po -l -a "${1}"; }
@tsjk
Copy link
Author

tsjk commented May 24, 2022

Doesn't actually fix things completely, but might make it better. I for one will think twice before buying more Western Digital disks.

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