site  contact  subhomenews

Swapfile for low-RAM PCs

July 05, 2009 — BarryK
Continuing my testing of Puppy on low-RAM machines, I have now modified /etc/rc.d/rc.shutdown to automatically create a swapfile.

This only happens under certain stringent conditions. The PC must have less than or equal to 128MB RAM and no existing swapfile or swap partition.

On the first shutdown, if a pup-save file is created on a hard drive partition, or session saved to the entire partition, and if the partition is a "fast" media (not USB), then a swapfile is created. The shutdown script does not ask, after all this is no more invasive than the operation of creating a save-file. Furthermore, a swapfile is really essential for reasonable performance. Note, it also depends on sufficient free space in the hard drive partition.

Note also, this automatic creation of a swapfile, named 'pupswap.swp', existed in the 'rc.sysinit' script in the Puppy 3.x series (I don't recall about the 2.x series), and I removed it for the 4.x series. Now I have brought it back, but now creating it at the first shutdown.


Swap file creation

Username: BarryK
"Okay, there is now an information message at shutdown about creation of the swapfile.

Username: BarryK
"I weighed everything up, decided it is better to do it at first shutdown. The 'init' scripts detects its existence and makes some space allocations accordingly, which is convenient.

Username: drongo
"Might be an idea to warn users to defrag NTFS partitions before proceeding. We occasionally get people complaining about Puppy causing problems on their Windows partition after creating pupsave files. Something like closedown without saving/reboot into Windows/defrag/reboot into Puppy. Not sure if you'd need this for FAT?

Swapfile created on the 3 series?
Username: ICPUG
"Barry says the swapfile was created on the Puppy 3 series and was removed from Puppy 4 series. I have a 128MB machine and it never had the swap file from the Puppy 3 series - so the limit must have been set lower. Also, justification for this swap file creation is that it is no more invasive than the pupsave creation. However, the user has a choice with the pupsave. They are not just informed - they can refuse to create it. Automatic creation of files should be used sparingly. Look what happened when the pup_xxx.sfs was automatically copied to the hard drive without the user having a say. We know best, doing things automatically, is the Microsoft way, not the Puppy way.

swapfile in 3.x -- and 2.x
Username: BarryK
"I just checked, the automatic creation of 'pupswap.swp' is also in the 2.x series. The code that creates 'pupswap.swp' is in rc.sysinit. In both 2.x and 3.x pups there is no check for the amount of ram. The only check is if running in PUPMODE=12. ... so it was a bit more restricted than my current implementation in terms of the PUPMODE, but unrestricted in terms of amount of RAM.

Username: BarryK
"drongo, Puppy already has a warning at shutdown, if partition is NTFS then please defragment it first before creating a save-file.

Username: ICPUG
"Yes the warning is fine with the pupsave - because one can choose not to create the pupsave - defrag - then create pupsave next time. However, if you create the swap file automatically then you cannot defrag before it is created.

Re: low-RAM and swapfile
Username: BarryK
"I bumped it up a bit, now the swapfile gets created if RAM is 256MB or less. Probably there is a good argument to not have any test for the amount of RAM, always create the swapfile if save-file is on a fast hard drive and there is no other swap file/partition.

Tags: woof