Various nuggets of useful technical information.

Friday, June 27, 2008

Adding Swap partitions on Fedora Core

Physically install the disk.

Locate it in /dev

If IDE it should be detected as hdX
If SCSI or SATA it should be detected as sdX

Use fdisk to partition it

fdisk /dev/device_name

n - for new partition
p - for primary partition
1 - for partition number
Specify start and end cylinders or sizes

t - for type change
L - to list types
82 - for Linux Swap - verify by looking at list when listed

w to writeout to disk and save the partition table.

So, the new partition will be /dev/device_name1

Once the drive has been partitioned above, run:
mkswap /dev/device_name1

Test it by switching it on:
swapon /dev/device_name1

.. and then running top to see it being added to the swap memory size:
top - 16:33:31 up 111 days, 21:59, 1 user, load average: 0.00, 0.00, 0.00
Tasks: 136 total, 1 running, 134 sleeping, 0 stopped, 1 zombie
Cpu(s): 0.0%us, 0.1%sy, 0.2%ni, 99.6%id, 0.1%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 2006264k total, 1990932k used, 15332k free, 230972k buffers
Swap: 2096376k total, 144k used, 2096232k free, 1602840k cached


Add it to /etc/fstab by adding a line as follows specifying it is a swap partition:
/dev/sda2 swap swap defaults 0 0


Reboot when done.


No comments: