Throttle dev.raid.speed_limit_max to 1000 during preseed for package installs

2018-10-11 Thread Gabriel Evanoff
I'm trying to find a work-around for the following bug: 
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=838503
Package installs during imaging of a new Stretch host with a simple raid1 
system disk takes ~2000 seconds. The packages installs on an equivalent Jessie 
install take ~300 seconds. This may not be much of an issue for isolated host 
installs, but I’m looking to speed up and automate the process to facilitate 
bulk imaging.
I've found that when imaging a Stretch host, if I console in and `echo 1000 > 
/proc/sys/dev/raid/speed_limit_max` I can throttle the raid sync and greatly 
speed up package installs. But I have thus far only been able to do this 
manually. I'm trying to find a way of setting this value early enough in 
preseed that it applies throughout the bulk of the package installs. So far 
I’ve attempted the following approaches (and more) without success:

  *   d-i preseed/early_command   string  echo "dev.raid.speed_limit_max = 
1000" >> /etc/sysctl.conf
 *   No /etc/sysctl.conf file is found when I console in to check
  *   d-i preseed/include_command   string echo 1000 > 
/proc/sys/dev/raid/speed_limit_max
 *   When I check on the value after the command should have run, it is 
still the default of “20”
  *   d-i preseed/late_command   string  echo 1000 > 
/proc/sys/dev/raid/speed_limit_max
 *   When I check on the value after the command should have run, it is 
still the default of “20”
  *   I can set the value through a late_script, but that runs well after most 
of the packages have already installed.
  *   The command sysctl doesn’t seem to exist for this version of BusyBox 
(BusyBox v1.22.1).

Can anyone provide recommendations for the appropriate method for setting this 
kernel parameter during preseed at a point early enough to be useful?




Re: Throttle dev.raid.speed_limit_max to 1000 during preseed for package installs

2018-12-06 Thread Gabriel Evanoff
I wanted to follow up on this post for anyone who might be interested in a 
workaround for Bug#838503 (also mentioned in the bug thread here: 
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=838503 -- thanks to Steve 
McIntyre!).



The key here is to use "partman/early_command" to load the md_mod kernel module 
and then set the value in /proc/sys/dev/raid/speed_limit_max once it actually 
exists.

Using "partman/early_command" appears to be the only way to feed arbitrary 
commands into preseed around the time of the disk partitioning, but before it 
is far too late to be of any use performance-wise (eg as with 
"preseed/late_command"). There is no "partman/late_command", sadly, which would 
make this easier. When "partman/early_command" runs, the md_mod kernel module 
has not yet been loaded, so that needs to be done first. Just add the following 
to your preseed configuration:



d-i partman/early_command string modprobe md_mod ; echo 1000 > 
/proc/sys/dev/raid/speed_limit_max



This sets the raid sync for the duration of the preseed process.