update with rules for kernel >= 6.2

This commit is contained in:
Frede Hundewadt 2023-07-21 11:03:06 +02:00
parent 28459b2d92
commit 5ce3f85b29
2 changed files with 13 additions and 5 deletions

View file

@ -1,3 +1,11 @@
# rule to disable write cache for usb storage #
# rule to disable write cache for usb storage that supports write-cache command
# requires hdparm to be installed # requires hdparm to be installed
ACTION=="add|change", KERNEL=="sd[a-z]", ENV{ID_USB_TYPE}=="disk", RUN+="/usr/bin/hdparm -W 0 /dev/%k" ACTION=="add|change", KERNEL=="sd[a-z]", ENV{ID_USB_TYPE}=="disk", RUN+="/usr/bin/hdparm -W 0 /dev/%k"
#
# the following rules is introduced with kernel 6.2
# https://docs.kernel.org/admin-guide/abi-testing.html#abi-sys-class-bdi-bdi-strict-limit
# https://docs.kernel.org/admin-guide/abi-testing.html#abi-sys-class-bdi-bdi-max-ratio
# https://docs.kernel.org/admin-guide/abi-testing.html#abi-sys-class-bdi-bdi-max-bytes
ACTION=="add|change", KERNEL=="sd[a-z]", ENV{ID_USB_TYPE}=="disk", RUN+="/usr/bin/echo 1 > /sys/block/%k/bdi/strict_limit", RUN+="/usr/bin/echo 50 > /sys/block/%k/bdi/max_ratio", RUN+="/usr/bin/echo 16777216 > /sys/block/%k/bdi/max_bytes"

View file

@ -1,15 +1,15 @@
# Maintainer: # Maintainer: root.nix.dk
pkgname='udev-usb-sync' pkgname='udev-usb-sync'
pkgver=0.1 pkgver=0.1
pkgrel=1 pkgrel=2
pkgdesc='Disable writecache when USB storage device is plugged' pkgdesc='Finetune writecache when USB storage device is plugged'
arch=('any') arch=('any')
url='https://codeberg.org/wonky/udev-usb-sync' url='https://codeberg.org/wonky/udev-usb-sync'
license=('MIT') license=('MIT')
depends=('hdparm') depends=('hdparm')
provides=("${pkgname}") provides=("${pkgname}")
source=('99-usb-sync.rules') source=('99-usb-sync.rules')
sha256sums=('ed0253bbbd5b64529efd752978ba17176e3ff23d3f7f220bbacd3fa3a3691df9') sha256sums=('012b9991a9eee3149eb27e8d3c7b4d40b56bbfe2030ce84823a90c968410f8d0')
package() { package() {
install -d -m755 $pkgdir/etc/udev/rules.d install -d -m755 $pkgdir/etc/udev/rules.d