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

Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.