Extending a volume copied to a new drive?

dgingeri

Distinguished
I have a RHEL 5 test server in my lab that just had a hard drive upgrade. I was told by the tester that she wanted the new 1TB drive to just replace the original 500GB drive. So, I just used Clonezilla to copy the drive. It was supposed to extend the file system for me, but didn't. So now it has 500Gb used on a 1TB drive.

I looked around online for how to extend the volume group and volume to use the whole drive, but all I could come up with were instructions on how to add a drive. I found nothing on how to extend the volume group to use the whole drive. The vgextend manual is, of course, useless on the matter.

I am not a Linux expert by any stretch of the imagination. I was supporting Windows (3.1-XP) for 13 years before I got this job, and I've managed to muddle my way through a lot of Linux, HP-UX, AIX, and Solaris stuff with Google's help. I know networking, hardware, and Windows, but my knowledge of Linux and Unix is pretty low level. My fingers don't do what I tell them much of the time, so typing pretty much sucks, and I hate command line because of that. Many long commands take 5 to 10 tries before I get it right. That's probably the biggest thing holding me back from learning more about Linux, but I don't plan on changing just because of that.

Does anyone here know how to do this?
 

dgingeri

Distinguished
An awesome guy at the CentOS support forum helped me out and gave me exactly what I needed:

So you have a 1TB disk with two partitions on it. These take up the first 500GB. Best thing to do here is to fire up `fdisk /dev/sda` and define a new primary partition that takes up the rest of the space. Use the fdisk 't' command to tag this new partition as type 0x8e, the same as the current /dev/sda2. Write the change to disk and reboot the system to pick up the new partition table.

When it comes back up, use the following commands to create a new PV on the new partition, add that PV to the existing VG and then you can extend the existing LV into the newly available space and, finally, resize the filesystem on that LV.

pvcreate /dev/sda3
vgextend VolGroup00 /dev/sda3
lvextend -L+100G /dev/mapper/VolGroup00-LogVol00
resize2fs /dev/mapper/VolGroup00-LogVol00
 
Good... a little complicated for the average user but if you can understand it well enough to apply it, that's all that counts.

The hidden 500GBs were unallocated so an easy solution was to either create a new partition on it, or to extend the existing partition to cover the whole disk area... either easily and automatically done with a compatible partition manager... several of them found here
 

Latest posts