I need to increase space on my data volgroup in a VM.

The VM is running CentOS 6.6, and it is not the root partition.

Two physical raw disks are currently two physical volumes, that are part of vg_data and lv_data:

/dev/sdb - 10TB
/dev/sdc - 30TB

I've created a third that is visible to the OS as:

/dev/sdd - 5TB

The current 30TB was formated using xfs.

[root@ds ~]# pvs
  PV         VG       Fmt  Attr PSize  PFree  
  /dev/sda2  vg_ds   lvm2 a--  63.51g      0 
  /dev/sdb   vg_data lvm2 a--  17.76t      0 
  /dev/sdc   vg_data lvm2 a--   9.78t 551.66g

[root@ds ~]# lvs
  LV       VG       Attr       LSize  Pool Origin Data%  Meta%  Move 
  lv_data  vg_data -wi-ao----  27.00t                                                    
  lv_root  vg_ds   -wi-ao----  59.63g                                                    
  lv_swap  vg_ds   -wi-ao----   3.88g 

[root@ds ~]# lsblk
sr0                         11:0    1 1024M  0 rom  
sda                          8:0    0   64G  0 disk 
├─sda1                       8:1    0  500M  0 part /boot
└─sda2                       8:2    0 63.5G  0 part 
  ├─vg_ds-lv_root   (dm-0) 253:0    0 59.6G  0 lvm  /
  └─vg_ds-lv_swap   (dm-1) 253:1    0  3.9G  0 lvm  [SWAP]
sdb                          8:16   0 17.8T  0 disk 
└─vg_data-lv_data   (dm-2) 253:2    0   27T  0 lvm  /mnt/data
sdd                          8:48   0  5.6T  0 disk 
sdc                          8:32   0  9.8T  0 disk 
└─vg_data-lv_data   (dm-2) 253:2    0   27T  0 lvm  /mnt/data

How do is add the extra raw disk without harming the current system? My plan:

  1. Use parted to create the physical volume of dev/sdd, with a gpt labeled and set the LVM flag to on.

  2. Unmount the current volgrp

    /dev/mapper/vg_data-lv_data mounted on /data

  3. vgextend vg_data /dev/sdd

  4. lvextend -r /dev/vg_data/lv_data /dev/sdd


  • Should I run resize2fs /dev/vg_data/lv_data instead of using the -r option when doing a lvextend?

  • How long will this resize take?

  • Should I be using xfs_growfs instead? I always thought this was only an option if your not using lvm.

Any help, guidance, thoughts would be very much appreciated.

  • 1
    Could you please share output of vgs and lvs before we advice you something. Sure, if /dev/vg_data/lv_data is the LV you want to extend and it's XFS, forget resize2fs, xfs_growfs is the correct command then. – Jaroslav Kucera Jan 27 '18 at 22:04
  • Thanks for the response @Vlastimil. I've edited the post with output from vgs, pvs, and lsblk – Ronin Jan 29 '18 at 1:47

Your first three steps are fine.

I'd only recommend that you send out a notification that the filesystem is going to be unmounted before doing so.

I'm assuming that you already have, but make sure the the fstype is Linux LVM for /dev/sdd.

Add /dev/sdd as a physical volume with the following command:

pvcreate /dev/sdd

After that you can run vgextend /dev/sdd as you have already planned to do so.

Check your volume group via vgs or vgdisplay to make sure that the space has been added.

If your lv is /dev/vg_data/lv_data, then the correct command to add the space from /dev/sdd is to first remount your lv and then:

lvextend -L +5T /dev/vg_data/lv_data

After that:

xfs_growfs /dev/vg_data/lv_data




will show that the size has increased for /dev/vg_data/lv_data.

If the path to your lv is /dev/mapper/vg_data-lv_data then substitute that for /dev/vg_data/lv_data or else you'll get an error.

  • Thanks for the great directions and extra thanks for adding the commands i need @Nasir. Yes this will be done during a maintenance period. Couple of questions... 1. Do i not need to add the drive dev/sdd to the end of the lvextend command? lvextend -L +5T /dev/vg_data/lv_data /dev/sdd. 2. How long do you think it will take for the xfs_growfs command to finish resizing the the partition. I'm assuming it's not going to take long as this is one of the many benefits of using this command in comparison to resize2fs. I'll keep you posted with the results. – Ronin Jan 29 '18 at 2:17
  • 1) No, you don''t need to add /dev/sdd at the end of the command when adding the space to your lv. You just need to add /dev/sdd as a physical volume which I'll add to my answer. Make sure that you are using the correct path to your lv_data when adding the space to it. 2) I'm assuming that /dev/sdd is a locally attached drive so it shouldn't take very long for xfs_growfs to add the size to your lv. – Nasir Riley Jan 29 '18 at 2:41
  • you are the man my friend. Worked like a charm. Only thing I forgot to add was remounting the lv before the xfs_growfs command. Also, it didn't take anymore than about 3 seconds to complete the final resize. Cant thank you enough for your help. – Ronin Jan 31 '18 at 18:18
  • You are welcome. Glad to help. – Nasir Riley Feb 1 '18 at 0:13

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.