Hello.
So I assume you have laptop-mode installed. I do, and if I don't configure it, I'm suffering from this problem as well. Not too frequent, but it still hurts.
So, with laptop-mode(l-m from now on) installed, edit your l-m conf:
sudo nano /etc/laptop-mode/laptop-mode.conf
And as you say it happens only on battery, LM and BAT are the attributes we're looking for. One of the first options is enable l-m on BAT. If you wanna take the easy way, do this, tho I wouldn't recommend it. Spinning your drives head down during battery life is essential, assuming you're on BAT cause your laptop is carried around or so, just not standing still.
So, let's continue, the next interesting options imho are: LM_BATT_MAX_LOST_WORK_SECONDS=600 LM_AC_MAX_LOST_WORK_SECONDS=300
CONTROL_READAHEAD=1
LM_READAHEAD=3072 NOLM_READAHEAD=1024
USE_RELATIME=1
Tho this is sth you may consider up to your preferences, this is not causing your load_retry...
Now we're getting closer:
CONTROL_HD_IDLE_TIMEOUT=1
LM_AC_HD_IDLE_TIMEOUT_SECONDS=720 LM_BATT_HD_IDLE_TIMEOUT_SECONDS=70 NOLM_HD_IDLE_TIMEOUT_SECONDS=7200
This is rather important, but still not the option causing load_retry. NOTE: You may adjust all options to your prefs so far...
Now the next values to specify are the PowerManagement options. THIS IS CAUSING YOUR LOAD_RETRYs
So, enabling laptop-mode to CONTROL_HD_POWERMGT=1
and specifying values to use: BATT_HD_POWERMGMT=200 LM_AC_HD_POWERMGMT=220 NOLM_AC_HD_POWERMGMT=245
[color=red]NOTE: The range of possible values is 128 - 254 Some HDs work with a value of 255 too, which represents a wildcard, however mine doesn't. So here's the section to play with, you may have to adjust it over time, but once you found your prefered settings, you're basically done.
I used to backup the original file and adjust these values over and over again. As mentioned, values between 128 and 254, while 254 is the highest=most aggressive value. This will cause your harddrive to avoid any attempt to spin down. 128 is the most soft value, usually only of use if you're using your laptop while riding a horse or so, however this is the most secure value while in L-M.
Then a couple of options you may make up values again, and one rather important value: LM_DIRTY_BACKGROUND_RATIO=3 NOLM_DIRTY_BACKGROUND_RATIO=10
Again, these are MY settings I found out to work for ME and MY laptop. But at least you know where to look for them now, I hope :)
Oh, and the very last option: LM_SECONDS_BEFORE_SYNC=60
Now edit your hdparm.conf and adjust the values to avoid conflicts.
sudo nano /etc/hdparm.conf
And set the values according to the ones you just specified. I.e. if you enabled PowerManagement in l-m.conf, disable it in hdparm.conf et vice versa.
Usually I'd recommend choosing either or, depending on your actual time on battery. If you're using your laptop as a desktop replacement most of the time anyway you might want to use hdparms values rather than l-m-tools. I'd configure them both, hdparm.conf for major home usage, and l-m.conf for university or so. Then, before starting off to school, just replace hdparm with the default and l-m with your configured. back home switch back using hdparm and disabling l-m again.
Just for instance... GL.