Disk Sleep

This seems to only be an issue with the RPI3 when using a USB Hard disk.
With the RPI4 it uses a different USB Controller and uses UAS instead which provides better performance and doesn't have the same problems.
So for a RPI4 you can ignore this.

I did notice with the RPI3 it would continually sleep the drive almost straight away.
With the RPI4 this doesn't seem to be an issue since it uses UAS, however this does mean we can't use smartmon tools with the RPI4 to check the disk SMART status.

RPI3 Disk Sleep

With a USB Drive attached, sometimes it will go into sleep continuously.
There's a couple of ways to work around this.

First install some tools.

apt install hdparm smartmontools

The first approach is to try disabling the spinddown using dietpi-drive_manager
Another approach is to use hdparm to disable advanced power management
this seems to be necessary in some cases as some drives ignore the timeout.

# Get drive info
smartctl -i /dev/sda
# Check drive health
smartctl -H /dev/sda

# To check drive sleep status without waking it up
smartctl -i -n standby /dev/sda

# To check the advanced power management value (default is 127)
hdparm -B /dev/sda
# To disable advanced power management
hdparm -B 255 /dev/sda

Run on Boot

To set this to run on boot up (as it reset between reboots)

Create the file /var/lib/dietpi/postboot.d/hd.nosleep.sh

#!/bin/sh
hdparm -B 255 /dev/sda

Make sure the file is executable

chmod +x /var/lib/dietpi/postboot.d/hd.nosleep.sh