Put disabled HDD into deep-sleep mode
For EasyOS "Copy session to RAM & disable drives" mode, forum
member 'MochiMoppel' has suggested that "hdparm -Y <drive>" be
applied to the "disabled" drives. See forum thread:
https://forum.puppylinux.com/viewtopic.php?f=54&t=1583
HDDs, that is, magnetic-platter type, not SSDs, will go to sleep
anyway, if unused for a certain time. The 'hdparm' utility can be used
to adjust the timeout for that to occur. However, MochiMoppel says that
to cut all the noise and power consumption, the drive should be put into
deep-sleep mode, with the "-Y" parameter.
Documentation on the hdparm options can be found here:
https://www.linux-magazine.com/Online/Features/Tune-Your-Hard-Disk-with-hdparm
The deep-sleep mode may require that the computer be restarted, to
bring out out of deep-sleep, and that is good from the security
viewpoint. For that reason alone, as an extra surety that an intruder
cannot find some way to access the drive, this is worth doing.
I have inserted some code into the 'init' script in the initrd, at line 1392:
#20201211 MochiMoppel has suggested use hdparm to power-down the internal drives...
if [ "$xWKG_DEV" ];then #note, in future could test for $LOCKDOWN instead of $xWKG_DEV
if [ "$CAPS_DROP" ];then
echo -n '' > /easy_new/root/.initrd-debug/hdparm-power-down
REMDRVS="$(echo "$BLKIDS" | grep -o '^/dev/sd[a-z]' | sort -u | grep -v "${WKG_DRV}" | tr '\n' ' ')"
for aREMDRV in $REMDRVS
do
HDDflg="$(cat /sys/block/${aREMDRV##*/}/queue/rotational)" #1 if magnetic platter drv, 0 if ssd.
if [ "$HDDflg" == "1" ];then
echo "Powering-down drive: ${aREMDRV}"
echo "Powering-down drive: ${aREMDRV}" >> /easy_new/root/.initrd-debug/hdparm-power-down
cttyhack /bin/hdparm -Y ${aREMDRV} >> /easy_new/root/.initrd-debug/hdparm-power-down 2>&1
sleep 0.1
fi
done
fi
fi
It seems to work, no error message, though I have no way of really knowing, except the drive should be dead quiet.
You can try this yourself:
- Write easy-2.5.3-amd64.img.gz to a USB-stick
- Boot the USB-stick, normal bootup
- Click on the first partition of the USB-stick to mount it (that is the boot-partition)
- Click on 'initrd' to open it up.
- Click on file 'init' to launch in a text editor
- Insert the above code, at line 1392 (just before "mount -o move /dev /easy_new/dev")
- Save and exit the text editor
- Click on file 'initrd' to update it.
- Menu: "Shutdown -> Reboot, lockdown in RAM"
- Tick "Copy session to RAM & disable drives" radio button, then reboot
Point-10, no need to tick the "Permanent" checkbox, as you only want to do it once, find out if it works.
Changing the subject: In "Copy session to RAM & disable drives"
mode, there is a "save" icon on the desktop. I created a file, then
saved the session, but my file seemed not to have been saved. Will check
this out ASAP.
Tags: easy