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@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@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@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@cow ~]# vgscan Reading all physical volumes. This may take a while... Found volume group "VolGroup00" using metadata type lvm2 [root@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
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 :
- 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@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
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 :
- 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:
- 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