We have this old CentOS4 box and I am trying to increase the space.

I want the full 8GB to show up in a "df -h" but it shows only the first Volume of ~4GB. How can I add the 2nd volume to the first? Can I just edit fstab and mount the Group?? After creating my notes below it looks like the 2nd volume is swap space. Can I just remove the swap space and make it disk space on the first volume? If so how??

# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00 3.9G  3.1G  662M  83% /
/dev/xvda1                       99M   13M   81M  14% /boot

# vgdisplay -s
"VolGroup00" 7.88 GB   [7.88 GB   used / 0    free]

# lvdisplay | grep Name
LV Name                /dev/VolGroup00/LogVol00
VG Name                VolGroup00
LV Name                /dev/VolGroup00/LogVol01
VG Name                VolGroup00

# sfdisk -s
/dev/xvda:   8388608

# less /etc/fstab
/dev/VolGroup00/LogVol00 /                       ext3    defaults        1 1
LABEL=/boot             /boot                   ext3    defaults        1 2
/dev/VolGroup00/LogVol01 swap                    swap    defaults        0 0
  • You really want to get rid of your swap space? You probably need it, with something that old. Probably better to create a new VM. But doing this is easy enough. Apr 22, 2014 at 22:08
  • It's a VM so don't really need the swap. I just figured out how to remove it. Trying to figure out how to allocate the 4GB... Apr 22, 2014 at 22:12

3 Answers 3


The question is, erm, a little confusing, but if I understand what you want correctly, you're trying to reclaim the drive space taken up by swap and use it for your LV that holds your root file system. Easy enough, if you have the right underlying filesystem. Ext3 can dynamically expand the file system while hot, which means you're in luck because your root filesystem is ext3. As root (please excuse any naming issuess with the LV tools, it's been months since I've had to do this and I know there are cases where you specify the path rather than simply the name):

swap off
lvremove LogVol01
lvresize --size +3.5G LogVol00
resize2fs / 

The swap off portion does what it says on the tin, which should remove the swap space from active use. The lvremove will blow the swap partition way completely and return it as free space to use in the volume group. The lvresize will then push the partition out, in the process claiming the newly-formed space. The resize2fs then expands the filesystem mountpoint to use all of the partition space it currently resides on.

Don't forget to remove your swap instance from /etc/fstab.

  • these steps pretty much worked for me. my "df -h" now shows ~8GB. Apr 22, 2014 at 22:51

You are making a confusion between the http://en.wikipedia.org/wiki/File_system on top of the LVMs and the Logical Volumes Manager.

Logical volumes are block devices and you can put a filesystem on top of them. If you want to merge 2 filesystem (or, in your case, discard one and merge the space onto the other), you would need to:

  • Backup the data on each of the filesystems (also safe to backup the block device, whatever it would be, like a logical volume, but ONLY if it is not mounted)
  • Remove one of the logical volumes
  • Extend the remaining logical volume to also include the space of the deleted one
  • Extend the filesystem that sits on top of the remaining logical volume (ext4 and most of the modern filesystems support online growing but they will most likely do a filesystem check at the next mount). If your filesystem is offline, you will be forced to run a filesystem check before running the resize command.

man lvremove man lvextend man fsck man resize2fs


I would strongly disregard of running any Linux without SWAP! It may be small, say, as small as 1/4 of your RAM, but without it your system will most definitely run into SERIOUS problems. It's DESIGNED to have and use a swap space. If you have multiple SWAP volumes and want to downsize swap to use just one, not shown in your outputs, then that should be fine, but I assume you haven't intentionally removed that from your terminal dumps?

  • using LVM works this way: physical volume/device (partition, whole disk...) -> volume group -> logical volume -> filesystem. So to answer your question fully, we'd need to see output of following commands: fdisk -l pvs lvs vgs
    – cepal67
    Jun 12, 2015 at 16:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.