Making a swap partition in Linux

I have just made an backup of my old data in NTFS partition in my laptop. So, it is a good time to format that partition into ext3. In my case, the partition is a logical partition inside Win95 extended partition (f or W95 Ext'd (LBA)) while itself is NTFS (8 or HPFS/NTFS). In summary, my partition table is as follow.

/dev/hda1   Linux
/dev/hda2   W95 Ext'd (LBA)
/dev/hda5   HPFS/NTFS
/dev/hda6   Linux swap / Solaris

At the end of this transformation, I expect to have as below.

/dev/hda1   Linux
/dev/hda2   Linux extended
/dev/hda5   Linux
/dev/hda6   Linux swap / Solaris

Below is my instructions.

  1. Deactivate the swap

    swapoff -a
    
  2. Delete /dev/hda2

  3. Add /dev/hda2 as Linux extended
  4. Add /dev/hda5
  5. Add /dev/hda6
  6. Change partition type of /dev/hda6 to 82 or Linux swap / Solaris
  7. Write the partition
  8. Reboot to take effect
  9. Format /dev/hda5 to ext3

    mkfs.ext3 /dev/hda5
    
  10. Format /dev/hda6 to Linux swap

    mkswap /dev/hda6
    
  11. Activate the swap partition

    swapon -a
    
  12. Mount /dev/hda5 on boot by adding below line to /etc/fstab

    /dev/hda5       /media/data     ext3    defaults,errors=remount-ro 0       1
    
  13. Mount that partition

    mount -a
    

You might try to reboot again to make sure everything works just fine.

Tags: , ,

Post new comment