cancel
Showing results for 
Search instead for 
Did you mean: 
khokha
Flight Engineer
Flight Engineer
  • 6,379 Views

Increase directory size

Jump to solution

Hello everyone,

My home directory is running out of space and i need to expand its size , how can i do that ?

disk-size2.png

Thanks in advance

Labels (1)
2 Solutions

Accepted Solutions
Chetan_Tiwary_
Community Manager
Community Manager
  • 6,347 Views

@khokha SInce your home directory is a LVM , you can extend the /home using "lvextend" command. 

 

lvextend -L +2G /dev/mapper/rhel-home -r

-r   specifies that the filesystem on the logical volume should be resized after the logical volume has been extended.

Refer man lvextend : https://man7.org/linux/man-pages/man8/lvextend.8.html

View solution in original post

Chetan_Tiwary_
Community Manager
Community Manager
  • 6,332 Views

I think the VG has no space : check with "vgs" command and if no space is there then you need to add space in the VG and then do the lvextend. 

To add space to VG you need to create a partition --> then make it PV and then extend the VG using vgextend. 

Once the VG has enough space then you can extend the LV. 

Chetan_Tiwary__1-1697047000292.png

 

 

View solution in original post

8 Replies
Chetan_Tiwary_
Community Manager
Community Manager
  • 6,373 Views

Hello @khokha !

Thanks for reaching out !
Please share the output of fstab file and df -hT and lsblk command. 

 

khokha
Flight Engineer
Flight Engineer
  • 6,370 Views

Hi @Chetan_Tiwary_ 

lsblk&df -ht.png

 

and /etc/fstab

fstab.png

Chetan_Tiwary_
Community Manager
Community Manager
  • 6,348 Views

@khokha SInce your home directory is a LVM , you can extend the /home using "lvextend" command. 

 

lvextend -L +2G /dev/mapper/rhel-home -r

-r   specifies that the filesystem on the logical volume should be resized after the logical volume has been extended.

Refer man lvextend : https://man7.org/linux/man-pages/man8/lvextend.8.html

khokha
Flight Engineer
Flight Engineer
  • 6,340 Views

Thanks for your reply,

I tried lvresize -r -L +2G but gives error and i tried +1G too

resize.png

i've another machine with the following output:

lsblk

lsblk.png

df -hT

df hT.png

/etc/fstab

fstab.png

can i resize the /home directory the same way?

Thanks

Chetan_Tiwary_
Community Manager
Community Manager
  • 6,335 Views

@khokha !

Here in this case you dont have a separate /home mounted as LVM so you need to do differently :

1. Take a backup of the /home

2. Create a new partition of sufficient size  as a LVM with formatted filesystem.

3. Temporarily mount this new disk to a new mount point eg. /mnt

4. rsync the contents from /home to this new mount point 

5. verify the data 

6. remove the contents from /home manually

7. mount the new disk to /home permanently using fstab.

having the /home separately as lvm or a separate partition is useful. 

Otherwise one can use parted or gparted to create/ resize partitions.  

0 Kudos
khokha
Flight Engineer
Flight Engineer
  • 6,334 Views

@Chetan_Tiwary_ 

For the first machine i tried the command I tried lvresize -r -L +2G but gives error and i tried +1G too

resize.png

0 Kudos
Chetan_Tiwary_
Community Manager
Community Manager
  • 6,333 Views

I think the VG has no space : check with "vgs" command and if no space is there then you need to add space in the VG and then do the lvextend. 

To add space to VG you need to create a partition --> then make it PV and then extend the VG using vgextend. 

Once the VG has enough space then you can extend the LV. 

Chetan_Tiwary__1-1697047000292.png

 

 

khokha
Flight Engineer
Flight Engineer
  • 6,321 Views

Thanks @Chetan_Tiwary_ 

Join the discussion
You must log in to join this conversation.