[CentOS] steps to add a new physical disk to existing LVM setup in new centos box?

Jerry Queirolo jerry at queirolo.com
Fri Oct 9 22:38:44 UTC 2009


>
>> 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.
>
>
>   
I booted off a rescue disk and wiped the old drive first, so had no 
problem getting it into the newer CentOS box and adding it there.  
Unfortunately, it looks like the drive is now suffering errors (5 
currently unreadable (pending) sectors, 3 offline uncorrectable sectors) 
so now I need to undo what I just did, replace the drive (I have a new 
one), and repeat.  This is an older box, using IDE so I only have 4 
(currently) occupied connections and I don't have room to add the new 
drive while the failing one is still in there.  Since I extended the 
filesystem and logical volume to span both drives, but haven't written 
any new significant data, the space I'm guessing is allocated for the 
logical volume, but free.  Does this checklist seem sane :

Original single disk was 80G;  Added 2nd drive of 120G, so to undo I 
should :

# reboot off CentOS-Live CD
# resize2fs /dev/mapper/VolGroup00-LogVol00 65G (ie. less than the 80G 
on the first good drive)
# lvreduce -L 65G /dev/mapper/VolGroup00-LogVol00

(reboot and make sure filesystem is intact and nothing is sitting on 
/dev/hdd1 with pvs )
# vgreduce VolGroup00 /dev/hdd1 (to remove drive from volume group)
# replace failing drive /dev/hdd1
(then I'll be back to where I started this exercise albeit with a new 
good 2nd drive and can add it back in)

Smell sane ?

Thanks in Advance,
Jerry Queirolo



More information about the CentOS mailing list