Link to home
Start Free TrialLog in
Avatar of keith_opswat
keith_opswatFlag for United States of America

asked on

How to extend LVM2 Filesystem

I have a Database server that is running Fedora.

Yesterday our SQL service wouldn't start and I found out it had ran out of disk space. Since we couldn't delete files to free up space I decided to take the hard drive and clone it to a 1.5TB drive.

It was originally on a 160GB drive (I just started working here... I'm not the idiot who placed a 160GB hard drive in the main database server). So I used Clonezilla to do a disk-to-disk copy. it worked great however the partition sizes are still the same.

I have a couple hundred MB boot filesystem which is ext3 and I tried to use Gparted and parted magic to resize the other partition and it says its LVM2. It says it doesn't have support for that filesystem.

So that partition is 140GB or around there. It's /dev/mapper/VolGroup00-LogVol00

I tried to use lvextend but I'm not really sure how to do that... The free space is unpartitioned because I'm not sure which way I should partition it.

I'm not a linux expert but I'm not the worst in the world... I know just enough to completely ruin everything. So I'm hoping to get some guidance on this issue.

I probably didn't give enough information so please let me know what info you need & what I do in order to find that. (Chances are I'll know how to do it, but just to save time in case I don't).

Thanks all so much!!!
Avatar of mustaccio
mustaccio
Flag of Canada image

LVM works with the existing disk partition, which was copied by Clonezilla bit by bit and therefore did not increase.

You will need to modify the partition size using fdisk (most likely you'll need to delete the existing partition and create a new, bigger one). You will then resize the physical volume (pvresize), extend the logical volume (lvresize), and grow the file system (resize2fs).

Alternatively, you could create another partition on the disk free space, create a new physical volume, add it to the volume group, then extend the LV etc. However, this will most likely hurt I/O performance.

Google for "LVM how-to".
ASKER CERTIFIED SOLUTION
Avatar of T1750
T1750

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of T1750
T1750

Ignore mustaccio telling you to resize (which means recreate) your partitions with fdisk yes you can do it that way but one screw up and you just lost all your data. Just add another partition, it's a lot safer and makes no difference.
Oh, and where I say "reboot your machine and try again" you just redo the pvcreate command, don't re-do the fdisk stuff that's why it (might) moan in the first place.

Plain english: If you get an error about filtering, reboot and resume at Step 2 not Step 1
mustaccio; Look at the names of his partitions, he has used fedora auto creation of disks and everything I think telling him to go manually recreating his partition table was a bit irresponsible.
Oh and I hope I get a good grading, I'm going to have to undo all that because I did it to my desktop to show you step-by-step and I can only do that by booting from a rescue disk (can't shrink mounted partitions).
Avatar of keith_opswat

ASKER

Thank you so much. I didn't set this server up. I am the sysadmin for opswat Inc and this is our database for our developers wiki. I just started like two months ago so this stuff was all created years ago by someone else. They've never had someone hired as a sysadmin before me. I will try that tomorrow (not fdksk) because the whole reason I cloned the disk was to save the server exactly as it was. I wouldn't need help if all I was gonna do was reset everything up. Once again thanks so much
And it won't hurt your I/O if you do it by making a new partition that's rubbish. LVM knows they're both on the same disk.
You do have to use fdisk to make the extra partition, just don't use it to destroy the old one and make a new bigger one.

If you launch it it sector mode (-u), and make sure the start sector is the same, it "shouldn't" cause any problems to do it that way but why take the risk?

I used to be a sysadmin myself.
I'd have shown you how to do it the "destroy the old one" way too if I could but I created my partition table with dd :) It starts' on sector 1 and fdisk won't allow you to do that.
And I wouldn't worry about needing help, I *constantly* need help that's I'm answering questions on here so I can get free premium service :)

You need to constantly learn in this game. Asking for help is a valid shortcut.
I'd suggest printing off a copy of that whole session I did while you work so you can see where I accepted default answers and where I gave one. It will be obvious.
It appears to work... Seem to be having some issues but I'm gonna give you the grade for it anyways because I'm quite sure it will work. It did once but I accidentally messed something up . So ohwell. Giving it another go!!

Thanks so much for the info though!!
Could you please, post only valid things. Since we believe it is an open experts forum to discuss and solve problems.
Thanks,