Skip to content

Instantly share code, notes, and snippets.

@weisi
Created April 19, 2012 12:22
Show Gist options
  • Save weisi/2420684 to your computer and use it in GitHub Desktop.
Save weisi/2420684 to your computer and use it in GitHub Desktop.
workaround for linux 3.3 SATA hotplug issue after suspend/resume
#!/bin/bash
# Written by multiple1902 <multiple1902@gmail.com>
#
# workaround for linux 3.3 SATA hotplug issue after suspend/resume
#
# gist page:
# https://gist.github.com/2420684
#
# bug report:
# https://lkml.org/lkml/2012/2/19/70
#
# inspired by:
# http://www.spinics.net/lists/linux-ide/msg43225.html
#
if [ ! $( id -u ) -eq 0 ]; then
echo "Please enter root's password."
exec su -c "bash ${0} ${CMDLN_ARGS}"
exit ${?}
fi
cd '/sys/devices/pci0000:00/0000:00:1f.2/'
for i in `ls | grep ata`; do
echo on > $i/power/control;
done
for i in `ls | grep host`; do
echo on > $i/power/control;
echo '- - -' > $i/scsi_host/$i/scan;
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment