formatting

This commit is contained in:
Frede Hundewadt 2023-03-05 07:24:52 +01:00
parent a18a7af9ea
commit c49169e1d6

View file

@ -1,6 +1,6 @@
# udev-usb-sync
Linux filesystem cache
## Linux filesystem cache
Linux agressively caches files in order to improve overall performance.
@ -11,6 +11,7 @@ How long you have to wait depends on your system and the quality of the USB stor
Numerous issues regarding this has resulted in various suggestions involving sysctl tweaks and trim.
udev rule to disable write-cache
## udev rule to disable write-cache
In another place one user threw in an udev rule which would disable write-cache for devices when they were added and while it was just an idea - it triggered my curiosity.
I dug into the intricacies of udev and found a method to only target USB storage devices.
@ -26,17 +27,17 @@ ACTION=="add|change", KERNEL=="sd[a-z]", ENV{ID_USB_TYPE}=="disk", RUN+="/usr/bi
The rule activates on
* add or change
* kernel event involvinig disk devices sd[a-z]
* only if the device environment ID_USB_TYPE==disk
* run hdparm -W 0 /dev/%K
* kernel event involvinig disk devices **sd[a-z]**
* only if the device environment **ID_USB_TYPE==disk**
* execute **hdparm -W 0 /dev/%K**
Create a file in /etc/udev/rules.d/99-usb-sync.rules and paste above content into the file and save it.
Create a file in **/etc/udev/rules.d/99-usb-sync.rules** and paste above content into the file and save it.
Install hdparm package.
Install **hdparm package**.
sudo pacman -Syu hdparm
Then plug an usb device - open in your file manager - copy a huge amout of files to the device - when the copy is done - click eject in the file manager - and the device ejects immediately.
Then plug an usb device - open in your file manager - copy a huge amout of files to the device - when the copy is done - click eject in the file manager - note how quick the device is ejected.
For those preferring that I have created a PKGBUILD 2 for it which will pull the hdparm dependency upon installation.