Turns out unmounting the SD automatically on suspend/hibernate is easy. The sleep demon will execute files in /etc/pm/sleep.d before sleeping or hibernating.
I added a script to this directory to automatically unmount the SD card's block device, like this:
On the commnd line, type:
Code:
sudo gedit /etc/pm/sleep.d/99_umountsd
Paste the following into the editor, then save the file:
#!/bin/bash
case $1 in
hibernate)
umount /dev/mmcblk0p1 # change me!
;;
suspend)
umount /dev/mmcblk0p1
;;
# thaw)
#
# ;;
# resume)
#
# ;;
esac
In the script, you need to change the "/dev/mmcblk0p1" to the device name for your mounted SD card. (Use the mount command to print out a list of all your mounted volumes if you don't know what the device name is.)
Finally, make the file executable:
Code:
sudo chmod a+x /etc/pm/sleep.d/99_umountsd
You may need to reboot in order for these changes to take.
It worked fine for me... your mileage may vary.
I didn't have to have the script remount the SD drive after being woken out of sleep... it seems to do this automatically.
Bookmarks