I am also having problems making the script work. My swap partition is /dev/sda1 No matter what I do I cannot make the swap to be set upon reboot.
admin@AHWNR:/tmp/home/root# free
total used free shared buffers
Mem: 239712 137684 102028 0 93916
-/+ buffers: 43768 195944
Swap: 0 0 0
admin@AHWNR:/tmp/home/root# fdisk -l
Disk /dev/sda: 31.9 GB, 31914983424 bytes
64 heads, 32 sectors/track, 30436 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Device Boot Start End Blocks Id System
/dev/sda1 1 30436 31166448 83 LinuxDisk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 121602 976759808 7 HPFS/NTFS
Disk /dev/sdc: 2000.3 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdc1 * 1 243
I guess the swap partition is not mounting?
admin@AHWNR:/tmp/home/root# df -h
Filesystem Size Used Available Use% Mounted on
/dev/root 24.5M 24.5M 0 100% /
tmpfs 117.0M 2.2M 114.8M 2% /tmp
devfs 117.0M 0 117.0M 0% /dev
/dev/mtdblock4 5.5M 392.0K 5.1M 7% /jffs
/dev/sdb1 931.5G 247.6G 683.9G 27% /tmp/mnt/BACKUP
/dev/sdc1 1.8T 335.0G 1.5T 18% /tmp/mnt/MEDIA
admin@AHWNR:/tmp/home/root#
here is what my pre-mount script looks like. I also made sure it had proper permissions with chmod a+x
#!/bin/sh
/usr/bin/logger -t START_$(basename $0) "started [$@]"
SCRLOG=/tmp/$(basename $0).log
touch $SCRLOG
echo "START_$(basename $0) started [$@]" >> $SCRLOG
if [ $1 = "/dev/sda1" ]
then
/sbin/swapon /dev/sda1 >> $SCRLOG
wait
fi
if [ $1 = "/dev/sda2" ]
then
fi
if [ "$?" -ne 0 ]
then
echo "Error in pre-mount execution! Script: $0" >> $SCRLOG
#exit $?
else
echo "Pre-mount execution OK. Script: $0" >> $SCRLOG
#exit 0
fi
/usr/bin/logger -t STOP_$(basename $0) "return code $?"
exit $?admin@AHWNR:/jffs/scripts#
mount output:
exit $?admin@AHWNR:/jffs/scripts# mount
rootfs on / type rootfs (rw)
/dev/root on / type squashfs (ro)
proc on /proc type proc (rw)
tmpfs on /tmp type tmpfs (rw)
devfs on /dev type tmpfs (rw,noatime)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw)
/dev/mtdblock4 on /jffs type jffs2 (rw,noatime)
usbfs on /proc/bus/usb type usbfs (rw)
/dev/sdb1 on /tmp/mnt/MEDIA type ufsd (rw,nodev,noatime,nls=utf8,fmask=0,dmask=0,sparse,force)
/dev/sdc1 on /tmp/mnt/BACKUP type ufsd (rw,nodev,noatime,nls=utf8,fmask=0,dmask=0,sparse,force)
ls -l on /jffs/scripts
drwxr-xr-x 2 admin root 0 Dec 31 2010 configs
drwxr-xr-x 2 admin root 0 Jul 16 14:57 scripts