Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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!
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:
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....
--- 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
From the above output I can see that PV /dev/hda2 is added to VG VolGroup00. As you said that /dev/hda is a 320G HDD. As I am not aware about the partition table on /dev/hda I would be able to suggest much.
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.
Last edited by T3RM1NVT0R; 09-27-2011 at 02:08 AM.
/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
Command (m for help): n # to create a new partition
Command action
e extended
p primary partition (1-4)
e
Selected partition 4
First cylinder (653-1044, default 653):
Using default value 653
Last cylinder or +size or +sizeM or +sizeK (653-1044, default 1044):
Using default value 1044
Command (m for help): t # to change the PARTITION TYPE
Partition number (1-6): 4
Hex code (type L to list codes): 8e # 8e is the code of LVM
Changed system type of partition 5 to 8e (Linux LVM)
Command (m for help): w # write your changes
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
now you prepered the disk to be working as LVM
next, you need to set the lvm:
now you are done prepering your LVM. from here, you need to build a fstable (mkfs, mke2fs..) and then you'll have a ready partition to use with your exisitng LVM.
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) ?
Disk /dev/hda: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hda1 * 1 13 104391 83 Linux
/dev/hda2 14 3649 29206170 8e Linux LVM
pvdisplay
Code:
--- Physical volume ---
PV Name /dev/hda2
VG Name VolGroup00
PV Size 27.85 GB / not usable 9.65 MB
Allocatable yes
PE Size (KByte) 32768
Total PE 891
Free PE 32
Allocated PE 859
PV UUID MjfZwr-45KZ-u9mz-lMel-lP2L-FU9a-4X3XOB
vgdisplay
Code:
--- Volume group ---
VG Name VolGroup00
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 8
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 1
Max PV 0
Cur PV 1
Act PV 1
VG Size 27.84 GB
PE Size 32.00 MB
Total PE 891
Alloc PE / Size 859 / 26.84 GB
Free PE / Size 32 / 1.00 GB
VG UUID dOKvUM-vv4v-V2OQ-omKn-Zqtl-WX4u-Tj3OfD
lvdisplay
Code:
--- Logical volume ---
LV Name /dev/VolGroup00/LogVol00
VG Name VolGroup00
LV UUID DPIXRN-411Z-O9pW-Ov1I-gJtw-98vp-c0XZiw
LV Write Access read/write
LV Status available
# open 1
LV Size 26.84 GB
Current LE 859
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
[root@serveur ~]# fdisk /dev/hda
The number of cylinders for this disk is set to 38913.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 3
First cylinder (3650-38913, default 3650):
Using default value 3650
Last cylinder or +size or +sizeM or +sizeK (3650-38913, default 38913):
Using default value 38913
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
[root@serveur ~]# reboot
and reboot
now fdisk -l give
Code:
Disk /dev/hda: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hda1 * 1 13 104391 83 Linux
/dev/hda2 14 3649 29206170 8e Linux LVM
/dev/hda3 3650 38913 283258080 83 Linux
now with pvcreate
Code:
pvcreate /dev/hda3
Physical volume "/dev/hda3" successfully created
Code:
[root@serveur ~]# vgextend /dev/VolGroup00 /dev/hda3
Volume group "VolGroup00" successfully extended
now i must load the linux debug from cd to be outside the install, BRB
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
/* Wait!!! This command will depend on the file system in use on your existing lv. If you are using ext4 on your existing lv then run mkfs.ext4 /dev/hda3 instead */
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 ?).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.