I recently rushed through an installation of CentOS 6 on a system with 32GB of memory installed. At first I didn’t notice the resulting automatic swap partition had eaten up 32+GB of my 40GB solid-state drive. When I unexpectedly ran out of disk space on the root partition, I finally realized what had happened. Below, for future reference, are the simple steps I took to shrink the swap space back to a reasonable 2GB size and re-allocate the freed swap space to the root partition. All of these steps can be performed without a reboot of the system.
swapoff -v /dev/vg_testhost/lv_swap
lvm lvresize /dev/vg_testhost/lv_swap -L 2G
swapon -v /dev/vg_testhost/lv_swap
lvm lvresize -l+100%FREE /dev/vg_testhost/lv_root
Copyright (C) 2013 by Ed
Braaten. All rights reserved.
Other Blog Entries