Jerry Queirolo
2009-Sep-23 22:12 UTC
[CentOS] steps to add a new physical disk to existing LVM setup in new centos box?
Not a centos specific question here, but if anyone can save me from shooting myself in the foot would appreciate any pointers.... I have an older centos 4.7 box that I recently replaced with a newer one running centos 5.3. I'd like to add the hard disk from the older one to the newer one before I scrap it for good. I don't care about the data on it, would just like the extra drive on the newer one for my home lan usage. The disk layout on the older one is a 2 partition (/boot and /) with / being a logical volume. Laying out what I think I need to do looks like this : 1. yank old drive and cable up to newer system, expecting this 2nd drive to now be /dev/sdb on the new box 2. pvcreate /dev/sdb1 3. vgextend VolGroup00 /dev/sdb1 (VolGroup00 is the volume group name on both system, pretty much default installs in both cases) 3. lvextend -l+100% /dev/VolGroup00 4. resize2fs / The disk in the old system looks like : [root at cow ~]# fdisk -l /dev/hda Disk /dev/hda: 122.9 GB, 122942324736 bytes 255 heads, 63 sectors/track, 14946 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 14946 119949322+ 8e Linux LVM [root at cow ~]# fdisk -l -u /dev/hda Disk /dev/hda: 122.9 GB, 122942324736 bytes 255 heads, 63 sectors/track, 14946 cylinders, total 240121728 sectors Units = sectors of 1 * 512 = 512 bytes Device Boot Start End Blocks Id System /dev/hda1 * 63 208844 104391 83 Linux /dev/hda2 208845 240107489 119949322+ 8e Linux LVM [root at cow ~]# pvscan PV /dev/hda2 VG VolGroup00 lvm2 [114.38 GB / 32.00 MB free] Total: 1 [114.38 GB] / in use: 1 [114.38 GB] / in no VG: 0 [0 ] [root at cow ~]# vgscan Reading all physical volumes. This may take a while... Found volume group "VolGroup00" using metadata type lvm2 [root at cow ~]# lvscan ACTIVE '/dev/VolGroup00/LogVol00' [113.84 GB] inherit ACTIVE '/dev/VolGroup00/LogVol01' [512.00 MB] inherit I'm curious if my 1-4 seem sane, or if I'll need to cfdisk and nuke the existing partitions on the disk once in the newer system, or if pvcreate will do what I need. If there is a preferred method to my madness, and you can save me from shooting a hole in my foot, appeciate any comments. Thanks in Advance, Jerry Queirolo
Jim Wildman
2009-Sep-24 02:07 UTC
[CentOS] steps to add a new physical disk to existing LVM setup in new centos box?
On Wed, 23 Sep 2009, Jerry Queirolo wrote:> The disk layout on the older one is a 2 partition (/boot and /) with / > being a logical volume. Laying out what I think I need to do looks like > this : > > 1. yank old drive and cable up to newer system, expecting this 2nd drive > to now be /dev/sdb on the new box > 2. pvcreate /dev/sdb1 > 3. vgextend VolGroup00 /dev/sdb1 (VolGroup00 is the volume group name on > both system, pretty much default installs in both cases) > 3. lvextend -l+100% /dev/VolGroup00 > 4. resize2fs /The biggest problems that I've had in similar situations are: 1) An entry in /etc/fstab that looks like LABEL=/boot boot ext3 defaults 1 2 If the 'old' drive has a "/boot" lable, there may be issues. Either blow the old drive away or switch to a /dev/sda1 based fstab for the new machine 2) vg names the same on the 2 drives. Either rename them before moving the drive, or blow them away first. ---------------------------------------------------------------------- Jim Wildman, CISSP, RHCE jim at rossberry.com http://www.rossberry.com "Society in every state is a blessing, but Government, even in its best state, is a necessary evil; in its worst state, an intolerable one." Thomas Paine