Comment 31 for bug 560384

Revision history for this message
toby saunders (tobydafencer) wrote :

1 - open the text editor found in Accessories(? I think, don't have the Aspire in front of me), copy/paste the following:

# Drop to: /etc/pm/sleep.d
# Use this script to prevent data loss on mounted MMC/SD
# cards. It syncs data and umounts all mmcblk devices prior to
# suspend, and cancels suspend if umounting was not possible
# (i.e: something locks a file)
case "${1}" in
    hibernate|suspend)
        /bin/sync
        for drive in $( /bin/ls /dev/mmcblk?p* ); do
        /bin/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 process.
        /bin/mount | /bin/grep ${drive}
        if [ $? -eq 0 ]; then
            exit 1
        fi
        fi
    done
    ;;
# resume|thaw)
## Do nothing. All devices will be automatically mounted again.
# ;;
esac
2 - Save as 010_unmount_SD.sh in your Home folder

3 - Open the Terminal (under Accessories)

4 - Use the following command to copy the file to the correct location (you will be prompted for the Admin password when you hit Enter):

sudo cp 010_unmount_SD.sh /usr/lib/pm-utils/sleep.d/010_unmount_SD.sh

5 - Set the proper permissions with this command (you will again be prompted for the Admin password):

sudo chmod 755 /usr/lib/pm-utils/sleep.d/010_unmount_SD.sh