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.
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
I don't think that is possible. The drive is probed by the BIOS / UEFI upon boot, not just the kernel.
What I do, though, is instruct the system to put the drive in sleep mode right after the system boots. Check https://wiki.archlinux.org/index.php/Hdparm#Putting_a_drive_to_sleep_directly_after_boot.
In my case I have:
[Unit] Description="Ranolfi's script to sleep hard drives on boot" [Service] Type=oneshot ExecStart=/usr/bin/hdparm -q -S 120 -Y /dev/sdc [Install] WantedBy=multi-user.target
It makes no difference whether the drive or its partitions are mounted by fstab (or crypttab, for that matter) or not.
(Edit): Strictly speaking, it appears to be possible to get the kernel to ignore a disk by patching it. That won't prevent the drive from waking up, though - quite the opposite, the patch I linked to will prevent you from accessing the drive, you'll be unable to access your files even sporadically, and also unable to put the drive to sleep.