How to extend /root partition?

Latest response

during the system installation i set the /root partition to 20Gig .
now after more updates and software installation this size become very low.
i have more space in other partitions like /home and other partitions .
now the questions is :
How to extend /root partition?
and how can i change the path for the installation of any new software?
thank you!!

Responses

If its a logical volume and you have unpartitioned space available in the same or other hard drive you can extend the volume.

df -h or lvdisplay

command will help you find if its a logical volume. Below link can help to extend the volume. Make sure to take a backup before you try.

https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Logical_Volume_Manager_Administration/lv_extend.html

thank you for response this is : lvdisplay

open 1

LV Size <18.63 GiB Current LE 4769 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 8192 Block device 253:0

If you don't use LVM there is currently no officially supported way to do this. However you could use a bootmedium with [http://gparted.org/ gparted] to edit your partition table and sizes. Be aware that this could lead to total loss of data. Make sure you have a fresh backup.

thank you for response this is : lvdisplay

open 1

LV Size <18.63 GiB Current LE 4769 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 8192 Block device 253:0

There is a request open on bugzilla to get the resize feature from parted backported to RHEL 7. If you like you could follow it by adding yourself the the CC list of [https://bugzilla.redhat.com/show_bug.cgi?id=1423357 Bug 1423357].

Hi, did you try if the latest parted will work on 7.4 ? as my customer has 7.4 and his / partition need to be extended, though it is lvm I still need to do it from rescue mode I guess if parted online resize option only starts from 7.5. Any comment will be greatly appreciated

thanks

you can already do this without parted. Edit the partition table with your favorite tool and then use partx to reread partition table to kernel. You need to be careful with not messing up the partitions though.

after the partition table is re-read you can grow lvm/filesystems.

Note: this only works if you can create free space after the partition you want to grow or if you have lvm you can create a new pv and attach that.

Thanks Klass, I thought I can not do it without going to rescue mode. But I found a an article which evident we can resize root / partition with its existing PV completely online. I beleive it is possible RHEL 7 onwards.

Hi Mushfiqur,

It is generally not recommended to work on disks, partitions or volumes from within a running system. Even if it
is possible, things may break badly - better boot from a "live medium" like GParted to perform the operations. :)

Regards,
Christian

Noted.. I havent tried Gparted before, so probably need to give it a go on my test machine. Thanks Christian!

You're welcome Mushfiqur,

GParted is a (basic) Linux distribution - focused on disk and partition editing with a GUI front-end for parted,
a terminal and some other useful tools. It is proven to work reliable and to be a safe tool to use for such tasks. :)

Regards,
Christian

Maybe you want expand root partition ? No problem. Its possible you can do that. But need backup. and if you take some problem its your problem.
(You need find some article in google about how to expand partition. ) You need first its new LUN - disk. (which size ? if you have Lun less size 2Tb you need gdisk if more in size 2Tb you need gdisk ) Then fdisk -l /dev/newdisk fdisk -c /dev/newdisk n p t - 8e p you can see new gpart table w. And you can see /dev/newdisk1 pvcreate /dev/newdisk1 vgextend your vg_name /dev/newdisk1 lvextend -l +100%FREE /dev/mapper/vg_name_lv_name if you have ext4 resize2fs -p /dev/mapper/vg_name_lv_name or xfs_growfs /dev/mapper/vg_name_lv_name

during the system installation i set the /root partition to 50Gig . now after more updates and software installation this size become very low. i have 500 Gib "home" partitions . now the questions is : How to extend /root partition ? and how can i change the path for the installation of any new software ? thank you!!

I have a similar situation like above. Any help would be highly appreciated. Thank you!!

lvdisplay no any output

mount bind a directory using allot of space to a mount point with allot of available space, this will free up the space used by root.

I am also facing this problem...plz help me

https://access.redhat.com/solutions/543593 this might help you.

Hello All I Was setup Redhat 7.6 On server But after sometime My root Volume is Full, Root Volume size is default 50 GB So I need to Add More volume into Root. In My server is 4 TB Storage, Is Their Any way to add volume into Root from Home Volume. It's Good If i will found any pro pare steps. Thank You.

Hello Pandit Ravi,

Yes, possible if the root file system is on a lvm. If so, please refer the steps of this knowledge base article https://access.redhat.com/solutions/4009.

If the root file system is on a standard disk partition then task would become technically risky.

From a technical point of view, resizing file systems and their underlying partitions (making changes to the existing partition table) could be dangerous. In addition, it is only possible to resize partitions from their end position on the disk. It is not possible to move partitions on the disk or resize them from their beginning. Such operations can result in a corrupted partition table, which will render all data on the disk device inaccessible, leading to data loss.

Provided the root partition is the last partition and there is enough un-allocated disk space available on the same disk then size could be increased and underlying file system could be altered as well (keeping other disk constraints in mind). This article may help you https://access.redhat.com/solutions/199573. But, you would need to take necessary steps to revert in case of any failures. The other step that you would need to be performed is the 'xfs_growfs' on the required disk partition. Again, all these steps needs to be performed by one with good technical knowledge, not a novice.

I hope this helps!