swap file – My Random Tips https://www.myrandomtips.com Useful Tips to Save Time Sun, 25 Aug 2019 14:01:18 +0000 en hourly 1 https://wordpress.org/?v=6.8.1 https://www.myrandomtips.com/wp-content/uploads/2017/10/cropped-light-bulb-icon-42x42.png swap file – My Random Tips https://www.myrandomtips.com 32 32 Increase swap space in Redhat 7 | Centos 7 https://www.myrandomtips.com/linux/increase-swap-space-redhat-7-centos-7/ https://www.myrandomtips.com/linux/increase-swap-space-redhat-7-centos-7/#respond Fri, 22 Feb 2019 16:44:18 +0000 https://www.myrandomtips.com/?p=578 So you would like to add more swap space in Redhat 7 or Centos 7 after installation. Sometimes it is necessary to add more swap space after installation. For example, you may upgrade the amount of RAM in your system from 512 MB to 1026 MB, but there is only 512 MB of swap space. It might be… Read More »

The post Increase swap space in Redhat 7 | Centos 7 appeared first on My Random Tips.

]]>
So you would like to add more swap space in Redhat 7 or Centos 7 after installation.

Sometimes it is necessary to add more swap space after installation. For example, you may upgrade the amount of RAM in your system from 512 MB to 1026 MB, but there is only 512 MB of swap space. It might be advantageous to increase the amount of swap space to 1026 MB if you perform memory-intense operations or run applications that require a large amount of memory. It is recommended that you extend an existing logical volume.

How To increase swap space in Redhat 7 | Centos 7

How to Increase Swap Space in Redhat 7 or Centos 7

4 Step on extending the logical volume

  1. Check if enough space to extend the swap file
  2. Turn off the swap file
  3. Extend the swap file and format
  4. Turn back on the swap file and check if swap file has increased

Extend swap on an existing LVM2 logical volume

First make sure nothing is using the swap volume and also ensure you have enough space in your volume group.

Commands to Check enough Space

cat /etc/fstab # check name of swap volume group e.g /dev/mapper/centos-swap swap

lvdisplay /dev/mapper/centos-swap # show volume group info for VG Name

vgdisplay centos # show how much space is free in VG e.g. centos

How to Extend the Swap Volume

1. Disable swapping for the associated logical volume:

swapoff -v /dev/mapper/centos-swap

2. Resize the LVM2 logical volume by 256 MB:

lvm lvresize /dev/mapper/centos-swap -L +256M

3. Format the new swap space:

mkswap /dev/mapper/centos-swap

4. Enable the extended logical volume:

swapon -va

5. Test that the logical volume has been extended properly:

cat /proc/swaps free

Summary

I hope this guide is some help on how to add more swap space in Redhat 7 or Centos 7 after installation, it can be very useful when increasing the physical ram on your Redhat 7 or Centos 7 box.

For other Redhat related tutorials on my website please click here.

To Check our More Tips Please have a look at my YouTube Channel and subscribe for video tutorials as they are released, and if you have any requests please leave a comment below.

The post Increase swap space in Redhat 7 | Centos 7 appeared first on My Random Tips.

]]>
https://www.myrandomtips.com/linux/increase-swap-space-redhat-7-centos-7/feed/ 0