Hi,
I have modified the scripts in /etc/apm in order to :
1. umount the swap on /dev/mmcda3
2. stop the processes accessing /mnt/card and /mnt/card2 on the SD card
2 remount /mnt/card and /mnt/card2 RO
... when suspending
and doing the opposite when resuming.
My config :
SD card : partition 1 DOS partition 2 ext2 partition 3 swap
pdaxii13 on C1000 "ipk-batch-install.tgz" install method.
I added the script "fs" in /etc/apm/scripts.d/ :
#! /bin/bash
#
# fd
#
# Ensures there is no IO on the SD card before suspending
# in order to avoid data dorruption
DOS_MNTPT_ON_SD=/mnt/card
DOS_DEVICE_ON_SD=/dev/mmcda1
EXT2_MNTPT_ON_SD=/mnt/card2
EXT2_DEVICE_ON_SD=/dev/mmcda2
SWAP_DEVICE_ON_SD=/dev/mmcda3
# See how we were called.
suspend() {
# Turn swap off.
swapoff $SWAP_DEVICE_ON_SD >/dev/null 2>/dev/null
# Remount dos data partition RO.
fuser -k -SIGSTOP -m $DOS_MNTPT_ON_SD >/dev/null 2>/dev/null
mount -o remount,ro $DOS_MNTPT_ON_SD >/dev/null 2>/dev/null
# Remount ext2 data partition RO.
fuser -k -SIGSTOP -m $EXT2_MNTPT_ON_SD >/dev/null 2>/dev/null
mount -t ext2 -o remount,ro $EXT2_DEVICE_ON_SD $EXT2_MNTPT_ON_SD >/dev/null 2>/dev/null
# Syncing all devices
sync
sleep 2
return 0
}
resume() {
# Turn swap on.
swapon $SWAP_DEVICE_ON_SD >/dev/null 2>/dev/null
# Remount dos data partition RW.
mount -o remount,rw $DOS_MNTPT_ON_SD >/dev/null 2>/dev/null
# Remount ext2 data partition RW.
mount -t ext2 -o remount,rw $EXT2_DEVICE_ON_SD $EXT2_MNTPT_ON_SD >/dev/null 2>/dev/null
# Syncing all devices
sync
sleep 2
# Resuming all processes
fuser -k -SIGCONT -m $DOS_MNTPT_ON_SD >/dev/null 2>/dev/null
fuser -k -SIGCONT -m $EXT2_MNTPT_ON_SD >/dev/null 2>/dev/null
return 0
}
case "$1" in
suspend)
suspend
;;
resume)
resume
;;
*)
echo "Usage: $0 {suspend|resume}"
exit 1
esac
exit $?
I put these two links pointing to "fs"
In /etc/apm/suspend.d : 920fs
In /etc/apm/resume.d : 001fs
Seems to work reliabely. Needs to be tested and adapted to your config. It is not very generic but gives some hints to avoid these nasty IO errors on the filesystem when resuming.
Best,
Ulutte