Friday, August 6, 2010

Increasing swap space RHEL 5

This is a Red Hat Enterprise Linux box 5 on HP blade with RAID 1 disk using LVM.

))))) Find the mount for swap (((((

[root@visce proc]# cat /etc/fstab | grep swap
/dev/VolGroup00/LogVol03 swap                    swap    defaults        0 0

))))) Current size of /swap is 8GB (((((

[root@visce proc]# lvdisplay /dev/VolGroup00/LogVol03
  --- Logical volume ---
  LV Name                /dev/VolGroup00/LogVol03
  VG Name                VolGroup00
  LV UUID                q842pi-17-vj5k-ew5F-eEZQ-MgweEb
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                8.00 GB
  Current LE             256
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:3

))))) Turn off swap space. Make sure your server will be ok to do this on. (((((

[root@visce proc]# swapoff /dev/VolGroup00/LogVol03

))))) Increase the size of your /swap partition with LVM to 26GB in this case. Free space must exist on disk. (((((

[root@visce proc]# lvresize /dev/VolGroup00/LogVol03 -L 26000M
  Rounding up size to full physical extent 25.41 GB
  Extending logical volume LogVol03 to 25.41 GB
  Logical volume LogVol03 successfully resized

))))) Make new partition swap ready. (((((

[root@visce proc]# mkswap /dev/VolGroup00/LogVol03

))))) Swap back on. Check /proc/meminfo for new size. (((((

[root@visce proc]# swapon /dev/VolGroup00/LogVol03

No comments:

Post a Comment