RHCE

How to create Swap Memory in REDHAT

In this article, I will explain ‘how we can create swap memory in Linux?’ So to create Swap memory please follow the instructions given below-

1. Create a new partition of hard disk/drive.

[ root@rdsaini ~]#fdisk /dev/sda

Screenshot (41)

  • command (m for help)= n (type n here)
  • e or p ( type either e for extended partition and p for primary partition )
  • 2,3,4,…… ( type your partition no.)
  • First cylinder (XXXX-XXXX , default XXXX ) = press enter
  • +500M ( write size according to your wish or available size of disk)
  • command (m for help)= w (type w here for write disk changes)

2. Change the type of disk partition.

Screenshotseed

  • command (m for help)= t (type t for change type of partition here)
  • command (m for help)= w (type w here for write disk changes)
  • command (m for help)= p (type p for to whether your disk partition is created or not)

3. Reboot your system after successfully creation of new partition.

[ root@rdsaini ~]#partprobe /dev/sda

4. You can check by following command that you already have a swap space or not.

[ root@rdsaini ~]#free -m

dsd

5. Format the the partition.

[ root@rdsaini ~]#mkswap /dev/sda2

Screenshot (51)

6. To enable or utilise your swap space give the next command

[ root@rdsaini ~]#swapon /dev/sda2

Screenshot (54).png

7. To disable or delete virtual RAM or swap space give the next command

[ root@rdsaini ~]#swapoff /dev/sda2

Screenshot (54).png

This post is all about How to create Swap memory in Linux. Guys if you have doubt or any query with this post then don’t hesitate to contact with me. And if you have any suggestion for me then please write to me the comment box. If you like my posts please share it with your friends

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s