summarylogtreecommitdiffstats
path: root/udev-usb-sync
blob: ccaab7eed819a4da27d6b43be0f659351508cac8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/bash
#
# script to tweak USB storage device filesystem sync
#
# sources /etc/usb-dev-sync/usb-dev-sync.conf
#

use_tweaks=1
max_bytes=16777216
max_ratio=50
strict_limit=1

# read user config
source /etc/udev-usb-sync/udev-usb-sync.conf

if [[ "$use_tweaks" = 0 ]]; then
	exit 0
fi

if [[ -z "$1" ]]; then
	exit 1
fi

echo "$max_bytes" > "/sys/block/$1/bdi/max_bytes"
echo "$max_ratio" > "/sys/block/$1/bdi/max_ratio"
echo "$strict_limit" > "/sys/block/$1/bdi/strict_limit"