7
[[email protected] ~]# pvdisplay -s
  Device "/dev/sda2" has a capacity of 0
[[email protected] ~]# vgdisplay -s                                                                                                                                                               "vg_vpsny23" 1.36 TiB  [1.36 TiB  used / 0    free]
[[email protected] ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_vpsny23-lv_root
                       50G  4.0G   43G   9% /
tmpfs                  16G     0   16G   0% /dev/shm
/dev/sda1             485M   65M  395M  15% /boot
/dev/mapper/vg_vpsny23-lv_home
                      1.3T  300M  1.3T   1% /home
[[email protected] ~]# umount /home                                                                                                               
[[email protected] ~]# vgdisplay
  --- Volume group ---
  VG Name               vg_vpsny23
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  4
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                3
  Open LV               2
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               1.36 TiB
  PE Size               4.00 MiB
  Total PE              357314
  Alloc PE / Size       357314 / 1.36 TiB
  Free  PE / Size       0 / 0

I ran umount /home now do I destroy the /home and then merge all the space to the / point?

3 Answers 3

16

Yes when you do the lvremove (warning: this kills the data) on the vg_vpsny23-lv_home volume, the space will become available in the volume group again which will let you do a lvextend on the vg_vpsny23-lv_root volume. In other words:

# lvremove /dev/mapper/vg_vpsny23-lv_home
# lvextend -l +100%FREE -r /dev/mapper/vg_vpsny23-lv_root
# systemctl daemon-reload (if using systemd)

This should extend the root volume online. Remember that you can grow a filesystem online but you have to unmount a filesystem to shrink it.

For the root filesystem, taking it offline means booting into rescue mode. So if you may want to use some of this space elsewhere you may want to modify the argument to the -l option that I gave you up there.

Make sure to remove the /home entry from /etc/fstab and reload systemd (or reboot) as other services may be relying on the removed LV's device/mount unit file (Ex. ssh server)

5
  • 1
    I had to remove my home from /etc/fstab file too
    – WoodyDRN
    Dec 11, 2018 at 12:53
  • Won't this delete everything in home?
    – jgmjgm
    Jun 4, 2019 at 16:57
  • @jgmjgm it will but the question is explicitly about deleting the /home LV and reclaiming the space. Meaning you would presumably have saved whatever you wanted beforehand.
    – Bratchley
    Jun 7, 2019 at 0:23
  • It still feels there needs to be a clarification somewhere. A lot of people will just want to merge home with root into one FS. The question isn't clear on what it means until post the title. Someone skimming through might make a critical mistake.
    – jgmjgm
    Jun 7, 2019 at 13:35
  • @jgmjgm There's going to be an opportunity to add an infinite amount of detail to virtually anything that gets said. But the OP explicitly says "destroy" so I don't know if there's much opportunity for confusion. Either way just to set your mind at ease I updated the answer to include a warning early on.
    – Bratchley
    Jun 7, 2019 at 18:40
5

Do not forget to comment out or remove the line from /etc/fstab that refers to /home. If you leave this in then Linux gets confused shutting down and restarting.

2

Also worth noting that if you receive the message:

Logical volume vg_somedisk/lv_home contains a filesystem in use.

do a umount -a to un-mount the volume, perform the resize, edit /ect/fstab then a mount -a.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .