I am running Kubuntu from External Hard Drive. My Internal Hard Drive has Windows on it. I don't want to use it while on Ubuntu and want to turn it off to produce less heat as well consume lower battery. I think spinning down hard drive isn't an option for me. Because, it wear out the hard drive and I don't plan to spend on HDD's :)
Asked
Active
Viewed 5.4k times
3 Answers
49
sudo hdparm -Y /dev/sdX
where /dev/sdX is the device you'd like to turn off. You can also run sudo blkid to determine the device's 'fingerprint' (UUID), which would allow you to more reliably control which device is being turned off.
In this case, you'd run:
sudo hdparm -Y /dev/disk/by-uuid/DEVICE-IDENT-HERE
man hdparm
-Y Force an IDE drive to immediately enter the lowest power
consumption sleep mode, causing it to shut down completely. A
hard or soft reset is required before the drive can be accessed
again (the Linux IDE driver will automatically handle issuing a
reset if/when needed). The current power mode status can be
checked using the -C option.
muru
- 207,228
earthmeLon
- 11,658
20
You likely have the udisks2 package installed; you can use
udisksctl power-off -b /dev/sdX
where /dev/sdX is the device you'd like to turn off.
From udisksctl man page (version 2.7.6):
power-off
Arranges for the drive to be safely removed and powered off. On the OS
side this includes ensuring that no process is using the drive, then
requesting that in-flight buffers and caches are committed to stable
storage. The exact steps for powering off the drive depends on the
drive itself and the interconnect used. For drives connected through
USB, the effect is that the USB device will be deconfigured followed
by disabling the upstream hub port it is connected to.
Note that as some physical devices contain multiple drives (for
example 4-in-1 flash card reader USB devices) powering off one drive
may affect other drives. As such there are not a lot of guarantees
associated with performing this action. Usually the effect is that the
drive disappears as if it was unplugged.
Taylor R
- 586
13
You can use the following (here sdX is the name of corresponding block device of interest):
sync
echo 1 > /sys/block/sdX/device/delete
or (from non-root user):
sync
echo 1 | sudo tee /sys/block/sdX/device/delete
mwfearnley
- 3,497
Tomilov Anatoliy
- 699