EXTENDING SWAP PARTITION IN LINUX
EXTENDING SWAP PARTITION IN LINUX

CALL NOW FOR FREE CONSULTATION

+91 9983340133, +91 9001997175

grras

EXTENDING SWAP PARTITION IN LINUX

Firstly, we have to understand what is swap in linux???

Swap is one of the file system, which is used as a virtual RAM for the system, it provide the extra memory resource to the system when it is required. We can extend RAM space through this partition.

Now, we can see how we extend swap partition:

  • First, we check the available RAM space of our system.
[root@localhost ~]#  free  -m
  • Create a partition of swap type
[root@localhost ~]#  fdisk   /dev/sda

When we type this command then some command option has been display then type ‘m’ show so many option like ‘n’ is used for to create partition, then asking partition type whether it is extended or primary we select one of them , then we change type of partition by  ‘t’ .Here through ‘l’ we check hex code of swap then give it according to them then finally we save it from ‘w’ command.

  • Tell the changes to kernel.
[root@localhost ~]# partx   -a   /dev/sda
  •     We can check our swap partition is made or not.
[root@localhost ~]#  fdisk   -l
  •  Then we format our swap partition.
[root@localhost ~]#  mkswap  /dev/sdax

 

Here x is partition number .When we run this command we get UUID no. also copy this no.

  • Then we create swap partition entry in /etc/fstab file.
[root@localhost ~]#  vim  /etc/fstab

 

When we open this file then paste the UUID number here(if we not get UUID no. then don’t worry we do entry by using partition no directly).Remember  swap has no mount point so when we fill the entry of mount point of swap then we type ‘swap’ ,file system swap ,defaults 0 0(means it is not go from checking).

  • Then finally we run the swapon command, which is used to enable the devices and file for paging and swapping.
[root@localhost ~]#  swapon  /dev/sdax
  •  Then finally we verify whether our swap partition is extended or not.
[root@localhost ~]# free  -m

Finally we have extended our swap partition.

Leave a Reply

Your email address will not be published. Required fields are marked *