Partitions are created and deleted with the fdisk or cfdisk programs. Set up the partition table and add a swap partition to the device hda
using fdisk by typing fdisk /dev/hda.
Enter n to create a new partition. Press Enter.
Enter p to set up the partition as a primary partition. Press Enter.
Set up /dev/hda2 as a partition by entering 2 for the partition number. Press Enter.
Set up /dev/hda2 as a 128MB partition by entering +128M for the size. Press Enter.
Change the /dev/hda2 to a swap partition by entering t for type. Press Enter.
Change the /dev/hda2 to a swap partition by entering 2 for the partition number, and 82 as the hex code. Press Enter.
Type q to quit fdisk. Press Enter.
Here are the final results of creating the 128MB swap partition on /dev/hda2. Type the command mkswap /dev/hda2 to initialize the swap partition. Press Enter.
Click anywhere on the screen to continue.
Add an entry for the swap to the /etc/fstab file, in this case: /dev/hda2 swap swap defaults 0 0. Click anywhere on the screen to
continue.
The file /etc/fstab will contain the above after adding an entry for the swap to /etc/fstab. Click anywhere on the screen to continue.
Activate the swap partition typing swapon -a, which reads /etc/fstab and turns on all swap entries listed therein. Press Enter.
Verify the swap partition's status by typing swapon -s or the free command. Press Enter.
Here are the results of checking the swap partition's status using swapon -s. This completes the Simulation.