0

I have a file server VM with the logical volumes as following,

Filesystem            Size  Used Avail Use% Mounted on
/dev/sda3              50G  7.8G   39G  17% /
tmpfs                 748M   72K  748M   1% /dev/shm
/dev/sda1             5.0G  165M  4.6G   4% /boot
/dev/mapper/vg_filesvr2-LogVol00
                      1.4T  1.3T     0 100% /home

I need to extend the size in 'vg_filesvr2-LogVol00' to 0.5T because it's the replication server of another VM, which has its size as 2T. But, when I check the lvdisplay, following is my result, by which I infer that there is no space to extend:

[root@Filesvr2 ~]# lvdisplay
  --- Logical volume ---
  LV Path                /dev/vg_filesvr2/LogVol00
  LV Name                LogVol00
  VG Name                vg_filesvr2
  LV UUID                HCpG63-IEQj-IsHG-4ewl-N8aK-5oIg-o8jAeZ
  LV Write Access        read/write
  LV Creation host, time Filesvr2, 2016-04-01 11:54:47 +0530
  LV Status              available
  # open                 1
  LV Size                1.34 TiB
  Current LE             349999
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0

But, I might be wrong. My requirement here is make the size of the logical volume to 2T as same as the primary server.

0

lvdisplay only tells about things that are already part of the logical volume.

When you are planning to extend a LV, you're going to use the free space in a volume group, and add it to your logical volume. So, you'll need to look at the output of vgdisplay vg_filesvr2, or in a more compact format, vgs.

The output of vgsshould look similar to this:

VG           #PV #LV #SN Attr   VSize            VFree 
vg_filesvr2    1   1   0 wz--n- <VG total size>  <amount of free space in VG>

If the VFree value is not zero, then there is at least some free space in the VG that you can use for extending your LV.

If the VFree is zero, you'll first need to get some more disk space in your VG. You'll generally have two options for that.

1.) Extending the existing physical volume (possible with some hardware RAID set-ups, almost all enterprise-class SAN storage systems and most virtualization environments).

In this case, you'll first need to configure the storage system to give you more disk space in the RAID virtual disk/LUN that holds your existing LVM PV, then make the kernel detect the new size, and finally use pvresize on the extended PV to make the added space available for LVM. Then, the added space will increase the VFree value in vgs listing, and then you can extend your LV.

2.) Adding a new PV to the volume group

Just add a new disk to the system (any disk at all will work, but ideally it should have similar performance as the old PV. Of course, if it's better, it's not a problem).

You can optionally create a partition table on the disk if you want: if there is a risk that the disk might accidentally be presented to a Windows system, it should minimize the risk of Windows "helpfully" formatting it. But you can skip this step.

Then use pvcreate to prepare the new disk (or a partition on it, if you choose to do so) for LVM, and then vgextend to add the new LVM PV you just created to your volume group that needs more space.

| improve this answer | |

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.