Linux – How to prevent the Linux kernel from waking a secondary HDD from sleep

hard-disklinuxpower-managementsuspend

Is there a way to instruct the (Linux) kernel not to wake up a secondary hdd after a system sleep/wake-up cycle? I'm asking because in my laptop I have an SSD as a primary drive containing the system root and a secondary HDD where I keep a backup system and files I access sporadically. Since the laptop usually goes through many daily sleep/wake-up cycles (I mean Suspend to RAM, not hibernation) for many days, I would like to put the secondary HDD to sleep manually and instruct the kernel to keep it asleep across system sleep/wake-up cycles.

Best Answer

since you only use the secondary hdd for backup, I would suggest telling fstab not to mount the drive automatically and to make a backup script that mounts the drive, makes the backup and unmounts the drive again.

example of the fstab line with the noauto option:

/dev/sdb1 /media/backup ext4 user,noauto 0 0

bash script for the backup would than begin with mount /media/backup and end with umount /media/backup

Related Question