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?

gablee
  • 21

1 Answers1

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