So a few months ago I was visiting Georgia and had a pleasant dinner with a few guys from the Georgia Team. Somehow the topic of Windows Vista came up and some of the “cool” features that it had, one of which being an ability to add available space from an inserted USB drive to the virtual memory (swap). Well, I quickly outlined a plan in my head on how it *could* work, but never sat down to actually try it. Today I finally made time to try it.
After twenty minutes I had a basic implementation. Not very flexible, but it worked on the USB drive I plugged it. The first implementation took only 43 lines of bash code, much of that simply being echo output, so it could have been smaller.
After some more testing and expanding it now seems a little more solid. It’s a bit over 100 lines of bash code, with plenty of room to grow but I wanted to get some feedback from the general public. If you would like to help alpha test this application you can get a copy of the script below. If you’d like to help on this project I think there is plenty of improvement and could make for a good team project as well.
In any event, here is a basic outline of what it does and how to use it at this point. It may not be completely intuitive, but that is part of what I need feedback on. Below are three steps to increase your swap size by using excess space on a pluggable USB disk.
- Insert USB disk and allow gnome / KDE to auto-mount the device.
- Run ./swapboost.sh -n to create a new swap addition
- Check your system memory. Your swap should now be extended by the amount of free space on the device. (swapon -s will show you all available swap areas).
When you would like to make use of the disk again for that other than swap you can run the cleanup portion of the script by doing the following.
- Run ./swapboost.sh -d to delete added swap and safely unmount your USB disk.
- Check your system memory. Your swap should now be reduced by the amount of space previously added. (swapon -s will show you only your default swap area).
I’d love to get some feedback on this script. I know there are some features that need improving. A GUI would be great. The ability to select the size to expand the swap, instead of *only* the full size. A more intuitive launcher.. etc. The list can go on and on. Again, if you’d like to join this project I think it could be fun. If you’d simply like to give some feedback check out the v0.1alpha release below.
This release goes out to my boys in Georgia. Thanks for planting the seed.
Remember, this script is in alpha stage and the user assumes all responsibility for its potential lack of function. If this messes up your machine it is not my fault. Use at your own risk. (I had to get that out of the way. It most likely won’t really screw things up, but you never know at this stage.)