Raspberry Pi external HDD
1. Should show you what drives are there connected to the Raspberry Pi
sudo fdisk -l
2. Create a directory for the mount
mkdir /media/nas
3. Test by mounting the drive to the directory
sudo mount /dev/sda1 /media/nas
4. Edit the file /etc/fstab
and add the following line to automount the dive on boot
/dev/sda1 /media/nas ntfs-3g rw,default 0 0
Spindown external HDD
1. Find out the device names
sudo blkid
2. Install hdparam
sudo apt-get update
sudo apt-get install hdparm -y
3. Check for drive compatibility
Make sure your drive supports hd parm, if you have multiple hard drives it could be /dev/sda or /dev/sdb – the command blkid will show you all disk drives connected.
sudo hdparm -y /dev/sda1
sudo /usr/sbin/hdparm -y /dev/sda1
You should get output like this indicating a successful standby command
/dev/sda1:
issuing standby command
Check if your drive supports write cache
sudo hdparm -I /dev/sda1 | grep 'Write cache'
sudo /usr/sbin/hdparm -I /dev/sda1 | grep 'Write cache'
If you see a * (asterix) then you are good to go.
* Write cache
4. Use hdparam
To make hdparm spindown the device you can use the -B flag
Values between 1 and 127 allow spinning down of the hard drive.
sudo hdparm -B127 /dev/sda1
Time to make hdparm configurations permanent edit the configuration file /etc/hdparm.conf
The spindown_time value is multiplied by 5 and you have the total time in seconds. So a value of 120 yields 10 minutes (120*5=600).
Enable write cache and spindown time by adding this text to the bottom of the file
/dev/sda1 {
write_cache = on
spindown_time = 120
}
Restart the hdparm service
More hdparm configurations are available here.