My hook looks like this:
#!/bin/sh
# Drop to: /etc/pm/sleep.d
# Use this script to prevent data loss on gnome-mounted MMC/SD
# cards. It syncs data and umounts all mmcblk devices prior to
# suspend, and cancels suspend if umounting was not posssible
# (i.e: something locks a file)
case "$1" in
hibernate|suspend)
sync
for drive in $( ls /dev/mmcblk?p* ); do
umount ${drive} > /dev/null
# If umount failed: abort suspend
if [ $? -gt 0 ]; then
# Test if device keeps mounted. Previous command could fail
# (i.e device was not mounted) with a non-stopper
# problem for the suspend precess
mount | grep ${drive}
if [ $? -eq 0 ]; then
echo "Failed to umount ${drive}" > /tmp/suspend.log
exit 1
fi
fi
done
;;
esac
My hook doesn't work without published patch, and without this hook data corruption is possible... so, I vote for high importance on this bug.
Had the same problem in xubuntu 11.04.
Published patch corrects pm-utils behaviour. I use a pm hook to umount SD cards on suspend, in order to avoid data corruption on resume (as described on https:/ /bugs.launchpad .net/ubuntu/ karmic/ +source/ linux/+ bug/424877).
My hook looks like this:
#!/bin/sh
# Drop to: /etc/pm/sleep.d
# Use this script to prevent data loss on gnome-mounted MMC/SD
# cards. It syncs data and umounts all mmcblk devices prior to
# suspend, and cancels suspend if umounting was not posssible
# (i.e: something locks a file)
case "$1" in
hibernate|suspend)
sync
for drive in $( ls /dev/mmcblk?p* ); do
umount ${drive} > /dev/null
# If umount failed: abort suspend
if [ $? -gt 0 ]; then
# Test if device keeps mounted. Previous command could fail
# (i.e device was not mounted) with a non-stopper
# problem for the suspend precess
mount | grep ${drive}
if [ $? -eq 0 ]; then
echo "Failed to umount ${drive}" > /tmp/suspend.log
exit 1
fi
fi
done
;;
esac
My hook doesn't work without published patch, and without this hook data corruption is possible... so, I vote for high importance on this bug.