This one has me stumped and I'm sure I must be missing something trivial. What is is eludes me.
I have a 20G drive that will be replaced with a 160G drive. The /boot partition is just a standard type 83, and the swap is an 82. The system root partition is in a LV, as is the /home partition.
I've upgraded hard drives dozens of times without incident, but never ona system with LVM.
I did this (booted into single-user mode):
1) Create the appropriate partitions on the new drive 2) Created an EXT3 partition and copies over /boot, ran GRUB to make it bootable. 3) did the mkswap on the second partition. 4) did a pvcreate on the third partition on the new drive, then created th VG (vg1) and LV for the two paritions. 5) Mounted the new partitions under /mnt, then used tar to copy the files from the old to the new (excluding tmp mnt sys & proc) 6) Edited grub.conf (on the new drive) to point to VG1 instead of VG0 for sysroot. Edited /mnt/etc/fstab to point to the new locations (I changed the names of the logical volumes slightly.) 6) Disconnected the old drive, then booted.
The system booted, but got only as far as 'Red Hat nash' ... then complained that it couldn't find vg0. (the volume group on the other disk). I can't get into single-user mode when booting this single drive.
I'm trying to do this whole thing non-destructively so that the original drive is a backup, until we confirm that the new drive is behaving well.
Are these steps correct (and they should be without LVM) or is there something much easier and obvious that I'm missing? I could, I suppose, add the new parition into the original volume group, and do the 'pvmove' dance to get things over (as explained briefly in the LVM-HOWTO on Red Hat's site) but it wouldn't leave a bootable system on the original drive.
Any suggestions would be greatly appreciated!
TIA,
Barry
"Barry L. Kline" blkline@attglobal.net wrote:
- Edited grub.conf (on the new drive) to point to VG1
instead of VG0 for sysroot. Edited /mnt/etc/fstab to point to the new locations (I changed the names of the logical volumes slightly.) 6) Disconnected the old drive, then booted.
When did you re-install GRUB (grub-insall)? And when you did, did you have it use the _new_ grub.conf?
The system booted, but got only as far as 'Red Hat nash' ... then complained that it couldn't find vg0. (the volume group on the other disk). I can't get into single-user
mode
when booting this single drive. I'm trying to do this whole thing non-destructively so that the original drive is a backup, until we confirm that the
new
drive is behaving well.
Consider booting the CentOS CD #1 in "rescue" mode. Let it find your root and then chroot and run grub-install.
Are these steps correct (and they should be without LVM) or is there something much easier and obvious that I'm
missing?
I could, I suppose, add the new parition into the original volume group, and do the 'pvmove' dance to get things over
(as
explained briefly in the LVM-HOWTO on Red Hat's site) but
it
wouldn't leave a bootable system on the original drive.
It's best to treat the two sets of discs/volumes as different, and never put them in the same system. Again, use CD #1 to boot into "rescue" mode, chroot and run grub-install with only the new discs/volumes connected.
Bryan J. Smith wrote:
"Barry L. Kline" blkline@attglobal.net wrote:
When did you re-install GRUB (grub-insall)? And when you did, did you have it use the _new_ grub.conf?
Hi Bryan.
To install GRUB, I did:
grub> root (hd1,0) grub> setup (hd1)
And things appears to go fine. Did I miss something?
It's best to treat the two sets of discs/volumes as different, and never put them in the same system. Again, use CD #1 to boot into "rescue" mode, chroot and run grub-install with only the new discs/volumes connected.
I'll give that a try. Thanks!
Barry
"Barry L. Kline" blkline@attglobal.net wrote:
Hi Bryan. To install GRUB, I did: grub> root (hd1,0) grub> setup (hd1) And things appears to go fine. Did I miss something?
The problem is that once you remove hd0, hd1 now becomes hd0. ;->
I'll give that a try. Thanks!
Yes, reboot into rescue mode.
Having your _exact_ disk configuration would help as well.
Bryan J. Smith wrote:
It's best to treat the two sets of discs/volumes as different, and never put them in the same system. Again, use CD #1 to boot into "rescue" mode, chroot and run grub-install with only the new discs/volumes connected.
Hi Bryan.
I gave that a shot, but I get the error:
/dev/mapper/vg1-sysroot does not have any corresponding BIOS drive.
I double-checked the grub.conf file and everything I'd expect is there, so I'm not sure what steps to take next.
Let me ask this: If you were going to upgrade drives from one to another, would you do what I did or is there another procedure that you would use?
Thanks for your help Brian.
Barry
"Barry L. Kline" blkline@attglobal.net wrote:
Hi Bryan. I gave that a shot, but I get the error: /dev/mapper/vg1-sysroot does not have any corresponding BIOS drive.
Okay, now we're getting somewhere.
First off, you did chroot, correct?
Secondly, how was /dev/mapper/vg0-sysroot setup on the old system?
Is the rescue mode creating a /dev/mapper/(whatever)?
In a nutshell, GRUB must understand how to load the root at boot. It would really help if you'd post your old _and_ new /boot/grub/grub.conf and /boot/grub/device.map files as well as _detail_ your _exact_ disk arrangements.
Let me ask this: If you were going to upgrade drives from one to another, would you do what I did or is there another procedure that you would use?
You used the correct procedure AFAICT, but you're having some boot-time issues in mapping the BIOS fixed disk to the Linux device.
Bryan J. Smith wrote:
"Barry L. Kline" blkline@attglobal.net wrote:
Hi Bryan. I gave that a shot, but I get the error: /dev/mapper/vg1-sysroot does not have any corresponding BIOS drive.
Okay, now we're getting somewhere.
First off, you did chroot, correct?
Yes.
Secondly, how was /dev/mapper/vg0-sysroot setup on the old system?
It was /dev/mapper/vg0-lvsysroot -- I renamed it when I created it.
Is the rescue mode creating a /dev/mapper/(whatever)?
Yes
In a nutshell, GRUB must understand how to load the root at boot. It would really help if you'd post your old _and_ new /boot/grub/grub.conf and /boot/grub/device.map files as well as _detail_ your _exact_ disk arrangements.
I needed to put the system back online again. That being the case, things are going to get out of sync with the new drive, so I'm going to start from scratch and try the migration again later tonight.
That being said, here's the procedure I'm going to use:
* Install new hard drive and boot from old hard disk into single user mode. * Duplicate partitioning on the new drive from the old drive 100 Mb boot, 1G swap, remainder LVM (all primary parts) * Format the /boot partition: mkfs.ext3 -L BOOT1 /dev/hdd1 (assuming that's where the drive ends up.) * Activate swap: mkswap /dev/hdd2 * Set up the LVM partition as a physical volume: pvcreate /dev/hdd3 * Create a new volume group: vgcreate vg1 /dev/hdd3 * And activate it: vgchange -ay vg1 * Create and format two partitions in the LV: lvcreate -L10G -n sysroot vg1 ; mkfs.ext3 /dev/mapper/vg1-sysroot lvcreate -L20G -n home vg1 ; mkfs.ext3 /dev/mapper/vg1-home * Create mount points for the new partitions and mount them: mkdir /mnt/sysroot ; mount /dev/mapper/vg1-sysroot /mnt/sysroot mkdir /mnt/sysroot/home ; mount /dev/mapper/vg1-home /mnt/sysroot/home * Now copy of the data: tar -cf- -X EXCLUDE / | (cd /mnt/sysroot ; tar -xf- -p -s) Where EXCLUDE contains: mnt/* proc/* sys/* tmp/* * Shut down the system, disconnect original drive, replace it with the new drive * Boot into rescue mode, chroot /mnt/sysimage * Edit /boot/grub/grub.conf to changes instances of 'vg0' to 'vg1' * Edit /etc/fstab to ensure things are pointing to the right place * Run: grub-install /dev/hda * shut the system down, reboot to HD and pray that things come up.
Does this sound reasonable?
Thanks again Brian!
Barry
"Barry L. Kline" blkline@attglobal.net wrote:
It was /dev/mapper/vg0-lvsysroot -- I renamed it when I created it.
But what are the major/minor numbers on the device file? ;-> I assume it's a block device file, correct?
I needed to put the system back online again.
Actually, stuff like that would have been best to record on paper or in a print-out. But that's all highsight now. ;->
Does this sound reasonable?
Again, if I had a more _exact_ representation of your hard drives, I could help further.
I'd also be interested in seeing what the major/minor numbers of your vg devices are.
Bryan J. Smith wrote:
"Barry L. Kline" blkline@attglobal.net wrote:
Again, if I had a more _exact_ representation of your hard drives, I could help further.
I'd also be interested in seeing what the major/minor numbers of your vg devices are.
Here's the information from the original drive. The new one is now tucked away back in its original packaging awaiting my next attempt.
[root@alexander ~]# fdisk -l /dev/hda
Disk /dev/hda: 30.7 GB, 30750031872 bytes 255 heads, 63 sectors/track, 3738 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 1291 10265535 82 Linux swap /dev/hda3 1292 3738 19655527+ 8e Linux LVM
(Don't ask why the swap is soooo large, I just noticed that. I'll fix it when I move to the new drive.)
[root@alexander ~]# pvs PV VG Fmt Attr PSize PFree /dev/hda3 vg0 lvm2 a- 18.72G 32.00M
[root@alexander ~]# vgs VG #PV #LV #SN Attr VSize VFree vg0 1 2 0 wz--n 18.72G 32.00M
[root@alexander ~]# lvs LV VG Attr LSize Origin Snap% Move Log Copy% lvhome vg0 -wi-ao 10.69G lvsysroot vg0 -wi-ao 8.00G
[root@alexander ~]# ll /dev/mapper total 0 crw------- 1 root root 10, 63 Jan 3 19:23 control brw-rw---- 1 root disk 253, 1 Jan 3 19:23 vg0-lvhome brw-rw---- 1 root disk 253, 0 Jan 3 19:23 vg0-lvsysroot
Is there anything else you'd like to see?
Barry