What's the easiest way to transition to a larger HD when using LVM2? I'm running Centos 4.4. I'm going from a 20gb HD to a 40gb HD. I've already DD'd it to the 40gb HD. So now I have 20gb of unused space. Ideally, I'd like to make it one big physical space for the logical space instead of making another physical partition to expand the logical. Here is what I have now with the system on hda, and with another HD of hdb for moving data if i need to: # fdisk -l Disk /dev/hda: 41.1 GB, 41174138880 bytes 255 heads, 63 sectors/track, 5005 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 2501 19984860 8e Linux LVM Disk /dev/hdb: 15.3 GB, 15361597440 bytes 255 heads, 63 sectors/track, 1867 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/hdb1 1 1867 14996646 83 Linux
Dear If u have two harddisk or partition then u have to create physical volume then u can add multiple PV in to single VG. so there is no way to combine two hard drive or two parttion into single PV , as i know . thanks Paul <unix at bikesn4x4s.com> wrote: What's the easiest way to transition to a larger HD when using LVM2? I'm running Centos 4.4. I'm going from a 20gb HD to a 40gb HD. I've already DD'd it to the 40gb HD. So now I have 20gb of unused space. Ideally, I'd like to make it one big physical space for the logical space instead of making another physical partition to expand the logical. Here is what I have now with the system on hda, and with another HD of hdb for moving data if i need to: # fdisk -l Disk /dev/hda: 41.1 GB, 41174138880 bytes 255 heads, 63 sectors/track, 5005 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 2501 19984860 8e Linux LVM Disk /dev/hdb: 15.3 GB, 15361597440 bytes 255 heads, 63 sectors/track, 1867 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/hdb1 1 1867 14996646 83 Linux _______________________________________________ CentOS mailing list CentOS at centos.org http://lists.centos.org/mailman/listinfo/centos Abhishek Kr. Singh System Administrator DSC. LTD. Mob.No. +91-9871563248 Send free SMS to your Friends on Mobile from your Yahoo! Messenger. Download Now! http://messenger.yahoo.com/download.php -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.centos.org/pipermail/centos/attachments/20061221/e56460a7/attachment.html>
Paul wrote:> What's the easiest way to transition to a larger HD when using LVM2? I'm > running Centos 4.4. I'm going from a 20gb HD to a 40gb HD. I've already > DD'd it to the 40gb HD. So now I have 20gb of unused space. Ideally, I'd > like to make it one big physical space for the logical space instead of > making another physical partition to expand the logical. Here is what I > have now with the system on hda, and with another HD of hdb for moving > data if i need to:You should let LVM do the move, not dd. The last paragraph has some advice what you might try to do since you already did dd thingie. First how you should have done it: What you wanted to do is to leave first drive as is in the system. Add second drive, create new physical volume on it, and add it to the volume group. See manual pages for pvcreate and vgextend. Than migrate all extents from physical volume on the first drive to physical volume on the second drive. See manual page for pvmove command. Once all extents are migrated, you can remove physical volume that was on the first drive (since all extents on it are free now), and after that remove first drive from the system. See manual page for pvremove command. Other than physical addition and/or removal of drives from the system, the rest can be done while the system is up and all services on it running. Once data is migrated, you can either create new logical volumes using free space that you have (lvcreate). Or you could expand existing logical volumes (either lvextend or lvresize will do the job) and resize filesystems (ext2online). You are enlarging file systems, so you want to do it in exactly this order, first extend logical volume, than extend file system. Since you are extending file system, this can be done while the system is up and running and file system(s) mounted and in use. No need for downtime. If you had anything outside of LVM on the old hard drive (for example /boot partition was there), you'd have to move that separately by hand. The easiest way would be to simply create new partition for it on new drive, than dump/restore /boot onto it. You'd also need to handle boot loader (LILO or Grub) separately if it was present on the drive you want to remove. Since you already did that dd thingie, you might also try simply enlarging the partition used for physical volume, than use pvresize to make physical volume use all the space on the partition. Do note that pvresize wasn't available in original CentOS 4, it was added in one of the updates (to be more precise, command was there, but it would only print out that it is not functional and than exit). So if it is an old system without updates, you'd need to update at least lvm2 related packages and kernel to the latest versions before you could use pvresize. If it's CentOS 4.4 box you should be fine. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 187 bytes Desc: OpenPGP digital signature URL: <http://lists.centos.org/pipermail/centos/attachments/20061220/f3e406fc/attachment.sig>
On Thu, December 21, 2006 12:21 am, Aleksandar Milivojevic wrote:> Since you already did that dd thingie, you might also try simply > enlarging the partition used for physical volume, than use pvresize to > make physical volume use all the space on the partition. Do note that > pvresize wasn't available in original CentOS 4, it was added in one of > the updates (to be more precise, command was there, but it would only > print out that it is not functional and than exit). So if it is an old > system without updates, you'd need to update at least lvm2 related > packages and kernel to the latest versions before you could use > pvresize. If it's CentOS 4.4 box you should be fine.I could dd it back and start from scratch. I see that fdisk must be run to resize the partition, then run pvresize. I was under the impression that changing the partition with fdisk will lose any data on it? Here's what I have. Yes, I am running LVM2, latest updates on Centos4.4: # fdisk -l Disk /dev/hda: 41.1 GB, 41174138880 bytes 255 heads, 63 sectors/track, 5005 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 2501 19984860 8e Linux LVM # pvresize --test /dev/hda2 Test mode: Metadata will NOT be updated. Physical volume "/dev/hda2" changed 1 physical volume(s) resized / 0 physical volume(s) not resized # fdisk /dev/hda2 Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel Building a new DOS disklabel. Changes will remain in memory only, until you decide to write them. After that, of course, the previous content won't be recoverable. The number of cylinders for this disk is set to 2488. 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) Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)