Compare commits

...

2 Commits

Author SHA1 Message Date
7de24b8870 fix mq-deadline for hdds: 2 2026-03-30 15:37:46 -04:00
1a798612aa update 2026-03-30 15:12:44 -04:00
2 changed files with 29 additions and 22 deletions

30
flake.lock generated
View File

@@ -197,11 +197,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1774274588, "lastModified": 1774875830,
"narHash": "sha256-dnHvv5EMUgTzGZmA+3diYjQU2O6BEpGLEOgJ1Qe9LaY=", "narHash": "sha256-WPYlTmZvVa9dWlAziFkVjBdv1Z6giNIq40O1DxsBmiI=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "cf9686ba26f5ef788226843bc31fda4cf72e373b", "rev": "7afd8cebb99e25a64a745765920e663478eb8830",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -263,11 +263,11 @@
"rust-overlay": "rust-overlay" "rust-overlay": "rust-overlay"
}, },
"locked": { "locked": {
"lastModified": 1774433292, "lastModified": 1774858933,
"narHash": "sha256-wFeQPKZfSSVv7BAYpRK31UBy1V9/pPJ9/hLaLJIgIp0=", "narHash": "sha256-rgHUoE4QhOvK3Rcl9cbuIVdjPjFjfhcTm/uPs8Y7+2w=",
"owner": "nix-community", "owner": "nix-community",
"repo": "lanzaboote", "repo": "lanzaboote",
"rev": "1e7ee8915a87c0675aa4532d70eb1a26e9b94cd8", "rev": "45338aab3013924c75305f5cb3543b9cda993183",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -285,11 +285,11 @@
"systems": "systems_3" "systems": "systems_3"
}, },
"locked": { "locked": {
"lastModified": 1774407052, "lastModified": 1774896109,
"narHash": "sha256-rUkn7Bo3PAlpcZl8+0FDsTwFyDwvS4xwMT9+RJ+XJoE=", "narHash": "sha256-0ue9vbpiLP5ZHZd5e7eQAplM9Rb4tunV+u5xcJDJ+lc=",
"owner": "Infinidoge", "owner": "Infinidoge",
"repo": "nix-minecraft", "repo": "nix-minecraft",
"rev": "70daf1f48885f0b4a70797076cd2ff5d9139b46e", "rev": "cb646a9e33cfa6b7d5facd9b7d4ca738ad1ff953",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -300,11 +300,11 @@
}, },
"nixos-hardware": { "nixos-hardware": {
"locked": { "locked": {
"lastModified": 1774465523, "lastModified": 1774777275,
"narHash": "sha256-4v7HPm63Q90nNn4fgkgKsjW1AH2Klw7XzPtHJr562nM=", "narHash": "sha256-qogBiYFq8hZusDPeeKRqzelBAhZvREc7Cl+qlewGUCg=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixos-hardware", "repo": "nixos-hardware",
"rev": "de895be946ad1d8aafa0bb6dfc7e7e0e9e466a29", "rev": "b8f81636927f1af0cca812d22c876bad0a883ccd",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -548,11 +548,11 @@
"trackerlist": { "trackerlist": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1774480183, "lastModified": 1774822185,
"narHash": "sha256-MCHf8kXli88XoVFfiA5E3iR4LPrUDp8efoQLNqP/Il8=", "narHash": "sha256-vEVjI/PWBfxLd1dzlo1MUSqeH5J33OLU7a5dfuzOKu4=",
"owner": "ngosang", "owner": "ngosang",
"repo": "trackerslist", "repo": "trackerslist",
"rev": "0b178b413075b716cce75b8eedc15535d669b0c8", "rev": "c77ccbef4be871a37dcbd3465d62bb8b5c7bc025",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@@ -44,13 +44,20 @@
Type = "oneshot"; Type = "oneshot";
RemainAfterExit = true; RemainAfterExit = true;
}; };
path = with pkgs; [
coreutils
gawk
zfs
];
script = '' script = ''
for dev in /sys/block/sd*; do # Only tune disks in the hdds pool not all rotational disks.
[ -f "$dev/queue/rotational" ] || continue # zpool status gives by-id device names; we resolve to /sys/block/<name>.
[ "$(cat "$dev/queue/rotational")" = "1" ] || continue zpool status hdds | awk '/^\t/ && $1 ~ /^(ata-|nvme-|scsi-)/ {print $1}' | while read -r id; do
link="/dev/disk/by-id/$id"
# skip removable devices (USB sticks report removable=1) [ -L "$link" ] || continue
[ "$(cat "$dev/removable")" = "0" ] || continue name=$(basename "$(readlink -f "$link")")
dev="/sys/block/$name"
[ -d "$dev" ] || continue
echo mq-deadline > "$dev/queue/scheduler" echo mq-deadline > "$dev/queue/scheduler"
echo 4096 > "$dev/queue/read_ahead_kb" echo 4096 > "$dev/queue/read_ahead_kb"
@@ -63,7 +70,7 @@
echo 4096 > "$dev/queue/max_sectors_kb" 2>/dev/null || true echo 4096 > "$dev/queue/max_sectors_kb" 2>/dev/null || true
echo "Tuned $(basename "$dev"): mq-deadline, 4M readahead, 15s deadlines" echo "Tuned $id -> $name: mq-deadline, 4M readahead, 15s deadlines"
done done
''; '';
}; };