Changing swap location

When I installed my system, I installed it to a 4Gb Compact flash card (via a CF/IDE converter) and it automatically set me up with 220Mb of swap space (PC has 512Mb RAM)

Now I’ve added a 40Gb hard drive and the hard drive will last longer than the CF card so I know I can change the swap space location but I don’t know how.

I’ve got about 1Gb swap space partition already on the hard drive.

Is it worth moving the swap space? Currently the hard drive is set to power down via hdaparm as soon as it can. Obviously it’s not gonna power down much if it’s being used as swap space.

you should have a
/etc/vfstab (solaris)
/etc/mnttab (linux?)
or similar, which tells your machine what filesystems to mount where.

swap should be mounted to /tmp as a tempfs filesystem type (I’m guessing a little)… so create a partition on the hdd, and edit your mnttab/vfstab file to suit :slight_smile:

then either umount -f /tmp and mount /tmp, or might need a reboot - not too sure tbh

Create filesystem, format as swap (different filesystem type), mount.

Use swapon/swapoff commands to move your swap space

http://unixhelp.ed.ac.uk/CGI/man-cgi?swapon+8

How’d I set it to do it on boot?

I tried setting the partition in /etc/fstab to /dev/hdc5 (the partition) but it mounted /dev/hda5 still. Though I didn’t remove the UUID number of whatever it is.

I’ll have another play tomorrow.

Googling your question…

When you make more swap space available with the swapon command, the
additional swap space is available until the system is rebooted. To make
additional swap space permanent, you must specify the swap file entry in
the /etc/fstab file.

the entry in /etc/fstab will have the filesystem or label, mount point none, type swap. man fstab for more details