LVM2 resize problems
I post this in the newbie section because I now feels like a total noob on this.
I got a little internal server with a lamp+svn for webdev and bind to permit the use of domains name inside our organisation.. It was time to upgrade the HDD because it was too small (80G) and we took a 1To HDD from another system to upgrade the small server. i've never upgraded a linux in this maner, but as for any other os normaly you clone, than expand the partition. Problem is, our little Centos 5.6 (basic, basic install) created a /Boot and a LVM2 partition (I presume it contain the swap and main) I could not, in 3 days work, extend the partition... GParted is useless, any liveCD we have (Ubuntu, fedora, centos6!) wont work properly withg LVM2.... how... how???? I'm still pounding my head on the floor for this... the system works... but with 80 Go out of 1To of the drive!!!!!! if you search "grow lvm2 centos" on google it's useless... there is about 30 differents ppl in the first page saying about 30 different way to do this... NONE OF WITCH say how to grow YOUR OWN LVM2 when in use (because no LiveCD work with this) and as for the doc on centos site, they say : - dont grow your partition when mounted (hard to do with our own) - please use LVM partition manager (WITCH IS NOT ON THE LIVE CD!!!!!) I even tried installing a new centos on another hard drive, loading the new drive as slave... you know what it did? NOTHING... it said that there is already a VolGroup01 LVM2 and cannot load or touch the other... and how many manual explain the process of this ? none in the first 35 pages of the google search i've done... sorry if I sound frustrated... but I am a little! I want my HDD witch run fine, to extend it's LVM2 partition to the rest of the disk... and BTW, lvextend -L +900G /dev/VolGroup00 say I can't... but... maybe I do not understand how it work, but any website that does only explains it in the scientific method! |
@ Reply
Hi there,
Welcome to LQ!!! Here is the brief idea how LVM works: 1. You create a physical volume. A physical volume can be a device or a partition. 2. You create LV group. 3. Create logical volumes in LV group. In your case as I can understand you want to add the physical volume or device to this existing group. Once done you want to increase your existing lv over to new device. This can be done: Running e2fsck and then lvresize. If could let us know the output of the following commands then it will be easier for us to guide you on this: 1. df -h 2. fdisk -l 3. pvdisplay 4. vgdisplay 5. ldvdisplay |
Another LVM resize question. No help in the "Similar threads" below ?.
As I suggested in the other thread, there is a good howto on tldp.org. If you can fit both disks in the box, that would be best - simply add the new disk to LVM, and grow your filesystem(s). It's what LVM was designed to do. In your case you'll need to delete that image you put on the new disk first. Because of the issue you've already noted - same named entities. Can occur outside of LVM as well, but you really have to try hard. With standard Redhat (CentOS) installs, happens all the time. To work on LVM, it's usually easiest to use the appropriate install disk in rescue mode. That way you'll get the LVM toolset and entity names (like lv's) known. here is the Redhat doco - note that it is linked from the CentOS site. From there you should be able to do all you need. |
I think I maybe out of my league here or something is wrong
when running pvdisplay i get : --- Physical volume --- PV Name /dev/hda2 VG Name VolGroup00 PV Size 27.85 GB / not usable 9.65 MB Allocatable yes (but full) PE Size (KByte) 32768 Total PE 891 Free PE 0 Allocated PE 891 PV UUID MjfZwr-45KZ-u9mz-lMel-lP2L-FU9a-4X3XOB /dev/hda is a 320 G HDD, how to get the PV to see the rest of this hard drive so I can just lvextend -L290G /dev/VolGroup00/LogVol00 ? because it will always say there is no more space.... |
@ Reply
Quote:
However, the procedure will be to: 1. Create a new partition lets say of 50G on your device. 2. Using pvcreate make that partition available as physical volume. 3. Using vgextend add that pv to this VG (VolGroup00) 4. Run e2fsck on this lv. 5. Using lvresize extend your lv. Remember you have make the PV first available to VolGroup00 using vgextend and then only you will be able extend the size of lv. |
Well if you have 320GB of HD space in /dev/hda then you can easily extend your logical volume size.
Just use this command: #lvresize -L 290GB /dev/VolGrp00/LogVol00 check your file system if you can see the changed size of you new logical volume #df -h If you don't see any changes then #resize2fs -f -p /dev/VolGrp00/LogVol00 then check #df -h BEST OF LUCK :-) |
/dev/hda is your HD, /dev/hda2 is a PARTITION. it makes sense that this partition will be smaller than the size of the whole HD.
post here the output of; fdisk -cul now when you plug in a new drive, see if you recognize it with fdisk -cul if you do, do the following: Code:
fdisk /dev/your-new-hd next, you need to set the lvm: Code:
pvcreate /dev/your-hd |
The more I try, i feel stupider!
I worked with Centos for the last 4 years and never got that kind of problems... And BTW, i do not want to extend the lvm to the new hd i want to transfert the install to the new hd and take the old 40G hd to his death (it sound like a screeching buzzsaw) I already DD'ed to the 320G, and UNFORTUNETLY we has to work with it for the past week, so backing down now is not an option. i tried: creating new PV and extended : failed I deleted all and reduced the lv back tried Chenchu's solution blocked at the change of partition type (said i cannot change extended to primary and vice-versa) but already made it in extended (type e) ? here more infos... if you have any ideas... df -h Code:
Filesystem Size Used Avail Use% Mounted on Code:
Disk /dev/hda: 320.0 GB, 320072933376 bytes Code:
--- Physical volume --- Code:
--- Volume group --- Code:
--- Logical volume --- |
Quote:
What part of the suggestion in post #5 didn't work ?. In detail ... |
Ok, let's retry
at first, I fdisk a new partition
Code:
[root@serveur ~]# fdisk /dev/hda now fdisk -l give Code:
Disk /dev/hda: 320.0 GB, 320072933376 bytes Code:
pvcreate /dev/hda3 Code:
[root@serveur ~]# vgextend /dev/VolGroup00 /dev/hda3 |
when running
"e2fsck /dev/hda3" got the "can't find the superblock" error |
Well as far as I understand the problem
Quote:
After creating the partition you should have run this command Code:
#mke2fs -j /dev/hda3 This will assign the inode no. and will mark the entry in superblock This is the reason when you are trying to do fsck it shows a superblock error. and I don't have much idea on LVM but you will have to run this command after deleting the physical volume you created so that changes can take affect |
@ Reply
You do not have to run e2fsck on physical partition but on lvm which is /dev/VolGrp00/LogVol00.
The reason you get that error message because there is no file system defined for /dev/hda3. It is just a partition without any file system. This is how you have to proceed: Code:
mkfs.ext3 /dev/hda3 Once done with the above command run e2fsck on your existing LVM which is /dev/VolGrp00/LogVol00 then run, resize2fs in order to expand your existing lv to this newly created partition. I hope this helps. Note: It is always advisable to have good backup without performing any file system changes |
Nope, nope, nope ...
That just doesn't make sense to mkfs on the new pv, so I decided to test (as I'm not a user of LVM in general). Do the pvcreate, then add it to the vg (vgextend), then resize the lv (lvextend). Then simply resize2fs (for ext[234]) the lv name - that will cause the filesystem on that lv to grow to the full extent of the lv. Use parms for particular size if that is what you want (but why ?). |
ok,
i've change the partition type to 8e done. i've resize the lv (lvextend -L +271.12G /dev/VolGroup00/LogVol00) reseize successfully ;) now executing resize2fs /dev/VolGroup00/LogVol00 and it seams to be working :)))) |
@ Reply
@ syg00,
Yup, you are right there is no need to mkfs on new PV. @ XRayden, Glad that you got it sorted. Could you please mark this thread as solved. |
it works now,
thanks to every body, hope this tread will be on google for reference! |
All times are GMT -5. The time now is 07:13 PM. |