0

I'm running Ubuntu 16.04 on a laptop. I have a small, 120GB SSD drive, and a secondary 1TB HDD.

Today I made Linux use a swap partition that is located on that second drive. After testing things out (opening LOTS of chrome tabs) and checking if the swap partition is used (it is), I noticed, that the drive in question doesn't spindown after some amount of time like it used to.

Battery life on my laptop is a huge deal to me, because I often have to work while traveling, with no way to recharge. Is there a way to force Linux out of using swap partition, and turn the second hdd off? Is there a way to do it automatically?

2 Answers 2

2

To force Linux not use the swap, run sudo swapoff -a

As for turning off the disk, you can do that through the included "Disks" application. See screenshot. (The option is grayed out for me as it is my system drive)

enter image description here

8
  • Any ideas on making Ubuntu do it automagically? :) Commented May 2, 2016 at 23:42
  • @BłażejMichalik - Automatically when what happens? Commented May 2, 2016 at 23:43
  • After a set amount of time, or whatever it is by default when there is no swap on it. Commented May 3, 2016 at 0:11
  • @BłażejMichalik You could look into the tlp package. Once installed, it sets up various power-saving optimizations automatically. It's quite "set-it-and-forget-it"; once it's installed, you don't need to manually do anything to make it work. Spinning down hard drives when they are idle is not enabled by default, but it can be enabled by editing the DISK_SPINDOWN_TIMEOUT_ON_AC and DISK_SPINDOWN_TIMEOUT_ON_BAT values in the /etc/default/tlp configuration file. More information here: linrunner.de/en/tlp/docs/tlp-configuration.html More generally linrunner.de/en/tlp/tlp.html
    – user533208
    Commented May 3, 2016 at 2:54
  • 1
    @NickWeinberg - I would post that as an answer. Commented May 3, 2016 at 10:55
2

You could look into the tlp package (sudo apt install tlp will install it). Once installed, it sets up various power-saving optimizations for laptops automatically. It's quite "set-it-and-forget-it"; once it's installed, you don't need to manually do anything to make it work.

Spinning down hard drives when they are idle is a feature supported by tlp; however, it is not enabled by default. It can be enabled by editing the DISK_SPINDOWN_TIMEOUT_ON_AC and DISK_SPINDOWN_TIMEOUT_ON_BAT values in the /etc/default/tlp configuration file (the values indicate the number of seconds before the drive spins-down to save power; by default they are 0, indicating no spin-down).

More information about manually configuring tlp: http://linrunner.de/en/tlp/docs/tlp-configuration.html

More general information about tlp: http://linrunner.de/en/tlp/tlp.html

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .