2

I have an external Seagate HDD (/dev/sdb) with 2 partitions connected to my media center (Acer 3820TG laptop running 14.04) and it keeps the computer from suspending. Since I want my media center to be quick to boot, I would rather use suspend than a complete shutdown. The HDD contains all of the media files, so it is essential to the setup.

I tried to simply unmount both partitions (/dev/sdb1 and /dev/sdb2) but I run into the same situation as before, where the screen goes black for 5-10 seconds before the computer resumes.

With the udisks --detach /dev/sdb/ command, though, I get what I want: the drive powers off and the computer can suspend.

How could I setup an automated way to: 1) detach /dev/sdb before suspending and 2) re-mount /dev/sdb after resuming?

1 Answer 1

0

Personally, I'd approach this with a simple script:

#!/bin/sh

# find if we have sdb mounted

df | grep -iq /dev/sdb

# if the last command tells us we found
# something, then unmount it and suspend the system
# two seconds later

if [  $? -eq 0 ]; then

  sudo udisks --detach /dev/sdb/
  sleep 2
  sudo pm-suspend
fi

Optionally you can add a line gnome-screensaver-command -l to lock the screen before suspending

8
  • Thanks for the answer, it looks promising. I'll test it tomorrow. Since I'm a new Linux user, though, I have a few questions: 1) if the script includes sudo, does that mean that I'll have to enter the su password every time I want to suspend? 2) if the solution works, will I be able to re-mount the disk upon resume or does '--detach' mean that I have to physically disconnect and reconnect the drive for it to be detected again?
    – gablee
    Jun 6, 2015 at 15:25
  • detach means the usb port that is connected to the external drive will power down and the LED light (if you have any on the drive) should turn off. Since currently I have no access to USB drives or anything of sort, I can't tell you for sure, but I believe once you come back from suspend, the drive should be still available for mounting in the file manager, on the left side. That's why I omitted any remount statements in my script. As far as sudo goes, you could add udisks and pm-suspend to your sudoers file, to allow you password-less execution. You still need to write sudo,but not password Jun 6, 2015 at 15:34
  • Here's the link to relevant information about password-less execution of commands: askubuntu.com/q/159007/295286 Jun 6, 2015 at 15:37
  • After playing with your solution and other manipulations, it turns out that the only thing I can do is to deactivate wake on USB altogether in /proc/acpi/wakeup. The page about password-less execution was very useful for some other stuff, though, so thanks!
    – gablee
    Jun 8, 2015 at 18:27
  • @gablee so what exactly worked, what didn't ? Please share, I'm open to learning Jun 8, 2015 at 18:34

You must log in to answer this question.

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