ubermix Forums
Technical => Development and Scripting => Topic started by: urkomasse on November 20, 2012, 07:40:51 PM
-
Change the line for "swapon" so it happens as long as there is a /home/.swapfile
Delete it from where it currently is, and add this at the end.
if [ $MEMTOTAL -lt 1000000 ]; then
if [ ! -e /home/.swapfile ]; then
dd if=/dev/zero of=/home/.swapfile bs=1k count=524288 >/dev/null 2>&1
mkswap /home/.swapfile >/dev/null 2>&1
fi
fi
if [ -e /home/.swapfile ]; then
swapon /home/.swapfile
fi
If the user has chosen to create a swapfile at some point, we should use it, right?
-
Am thinking it might be better instead to just create and enable swap on all hdd systems, since it wouldn't likely have any significant impact. Would need to figure out a way to detect hard disks vs. flash-based storage, but don't think that would be too difficult. What do you think?
-
The trick there would be to detect:
- If it's a hard disk.
- If the user has already run the "enable hibernate" script.
Or the "enable hibernate" script needs to take into account the possibility that the swap file already exists. Not too hard either.
For detecting the drive, "hdparm -i" might be the way to go. I don't have any netbook with flash drive to try.
But yes, I agree, having swap with any netbook with a hard drive makes sense. Maybe just forget the checking for type of hard drive, and always create the swap if the /home/ partition has more than, let's say, 20Gb free?
I don't think we'll be seeing SSDs of that size in budget netbooks anytime soon.