Revision [9583]
This is an old revision of SwapFile made by coolpup on 2010-09-28 08:07:52.
How to create a Swap File
These instructions may only be current for Puppy 1.x so revisions to the instructions need to be updated for Puppy 2.x to make sure it works and also be very careful when using dd if=/dev/zero!
Puppy Linux will automatically use a Linux swap partition. With Puppy 2.x and later when using a pup_save file, Puppy will use these files for swap on boot if in same directory as the pup_save file : WIN386.SWP, PAGEFILE.SYS, pup.swp and, with Puppy 2.01, pupswap.swp. Puppy 2.01 and later will create a swap file if needed in same dir as pup_save if needed, unless using 2.02 or later which won't create one if not one of the following file systems: msdos (FAT12/16), vfat (FAT32), ext2, ext3, reiserfs, minix
This is a procedure for building a swap file, that is, simply a file rather than a partition. Puts the swap file on the same partition that holds the personal data file (pupxxx or pup_save*.3fs). This has been tested on Win98SE and a different procedure is needed for WinXP. |
Note: For WinXP which uses NTFS, replace the dd step with:
if /mnt/home is an NTFS drive, do not use dd (writing to your NTFS drive can corrupt the file system)
... boot to Windows and create the file by typing something like:
fsutil file createnew C:\pup.swp 512000000
then boot Puppy again
Short on memory? Under 128MB is. Then build a swap file.
Go to Start > Run > Rxvt
Type, then press Enter:
dd if=/dev/zero of=/mnt/home/puppy.swp bs=1024 count=800k
Be patient. This will take several minutes.
That 800k translates to 800MB (819,200KB).
So decrease according to available disk space.
Type, then press Enter:
mkswap /mnt/home/puppy.swp
Type, then press Enter:
swapon /mnt/home/puppy.swp
Go to Start > File Managers > uXplor
Drill down to /root/.etc/rc.d/rc.local and right-click and select edit.
Add this line to the bottom:
swapon /mnt/home/puppy.swp
Save the file. This will turn on the swap file upon next boot.
alternative description
find somewhere to put the swap file ... type:
df -h
to see how much free space you have on each partition
create an empty swap file:
for example, to make a 512 meg swap file on /mnt/home called pup.swp, type:
dd if=/dev/zero of=/mnt/home/pup.swp bs=1M count=512
if /mnt/home is an NTFS drive, do not use dd (writing to your NTFS drive can corrupt the file system) ... boot to Windows and create the file by typing something like:
fsutil file createnew C:\pup.swp 512000000
then boot Puppy again
make the empty file a swap file:
mkswap /mnt/home/pup.swp
mount the swap file:
swapon /mnt/home/pup.swp
you can see if it's working by typing:
free
to automatically mount the swap file when Puppy boots, put a line like this in an init file, like /etc/rc.d/rc.local:
swapon /mnt/home/pup.swp
See also this forum topic if having problems with NTFS.
Got a swap partition? Use it instead of building a swap file.
This assumes you have a hard disk partition defined as a swap partition.
That won't be enough.
You need to use mkswap before Puppy Linux can automatically recognize it at boot time.
In this example, the swap partition is the 7th partition on the first hard disk drive.
Change appropriately for your system.
Go to Start > Run > Rxvt
Type, then press Enter:
mkswap /dev/hda7
Type, then press Enter:
swapon /dev/hda7
Next boot, the swap partition will be recognized.