I realised after my previous post I realised that it would be worthwhile talking about adding a new partitition.

The first thing you need – or I assume – is that you have a separate hard-drive which is not active (mounted) or can be unmounts using the standard umount command.

We assume the device is sdc  (it could be sdb, sda, hda1 etc..).

  1. Ensure the drive is unmounted – turn off any swap already on it with swapoff (or if it’s clean of swap partitions then you can ignore swapoff)
  2. type in “parted /dev/sdc”  This loads the parted prompt which allows you to manage the disk.
  3. enter “print” to view details of any existing partitions and free space.
  4. once you have decided the size you need (at minimum I would recommend match your RAM) type “mkpartfs part-type linux-swap start end”  Where for the start and end match the start point available in the print command and ending a number x megabtes above i.e. if the start point is 1024 then the end point would be 5120 for a four gigabyte partition (4096)
  5. once done type quit to exit parted.  The new partition will have been given a number e.g. sdc2 (or higher if others exist)
  6. all that needs doing is to format the partition “mkswap /dev/sdc”
  7. to enable it’s the same process as for the file – “swapon /dev/sdc”

If you want to make it work each boot – then edit the fstab using

vi /etc/fstab

add to the bottom: (press insert to enter edit mode)

/dev/sdc2 swap swap defaults 0 0

then press escape and shift-Z shift-Z

as before you can check to see if it’s been added by using