2

I believe this is an easy question for people in the know.

I have ~100 GB unallocated hard disk space that I want to use to extend my home partition. What commands do I need to run?

[paul@localhost ~]$ lsblk  
NAME                 MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda                    8:0    0   360G  0 disk
├─sda1                 8:1    0     1.5G  0 part /boot
└─sda2                 8:2    0   254.4G  0 part
  ├─centos-root 253:0    0    10G  0 lvm  /
  ├─centos-swap 253:1    0   1.4G  0 lvm  [SWAP]
  └─centos-home 253:2    0 243G  0 lvm  /home
sr0                   11:0    1  1024M  0 rom

What I want is the centos-home size to increase to the maximum possible (from 243G to about 340G)

Thanks!

More info: This CentOS7 is running as a VM guest on a Windows 10 Host

I've found many guides online, but none were specifically answering my issue. One increased the centos-root partition instead of centos-home, so I reset the whole VM. Another guide was for moving space from root to home, so not what I need. It can't be difficult I'm just a noob. Thanks!

1
  • Ok I will change it. Couldn't copy it from the VM, I tried, will type it manually. Commented May 30, 2020 at 0:55

1 Answer 1

1
  1. Create a partition (I assume that will be sda3)
  2. Prepare it for use with LVM:

    pvcreate /dev/sda3 
    
  3. Add it to the existing volume group:

    vgextend centos /dev/sda3
    
  4. Now vgs should show free space

  5. In order to add all the free space to the logical volume:

    lvresize --extents +100%FREE centos/home
    
  6. Resize the file system (it does not recognize the increased block device automatically), assuming it is ext[34]:

    resize2fs /dev/mapper/centos-home
    
4
  • Ok I tried to create a partition... this was again following some guide where some commands give warnings. Now when I run "$ sudo pvcreate /dev/sda3" it says "Device /dev/sd3 excluded by a filter." Whatever that means. Commented May 30, 2020 at 6:51
  • One site says "You may now see the message 'Device /dev/vdaX not found (or ignored by filtering)'. In that case the partition table needs to be reloaded using the command: partprobe /dev/vda" --- I ran this as well but doesn't change anything, it's still "Device /dev/sda3 excluded by a filter" Commented May 30, 2020 at 6:59
  • Ok after getting quite fed up, I deleted my new partition again, and then got it to work following this guide, replacing vda with sda, and having your steps open alongside which mirrored mostly. transip.eu/knowledgebase/entry/141-how-do-grow-partition-linux Commented May 30, 2020 at 7:22
  • @Paul If this solved your problem then you should accept my answer so that your question is shown as successfully answered. Commented May 30, 2020 at 14:29

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.