[CentOS] SCSI install to IDE install - help

Phil Schaffner Philip.R.Schaffner at nasa.gov
Mon Apr 24 21:43:07 UTC 2006


On Mon, 2006-04-24 at 14:38 -0400, Lamar Owen wrote: 
> On Monday 24 April 2006 13:47, Erick Perez wrote:
> > Hi, a customer has a Centos installation on SCSI disk (aic7xxx), 
> 
> > Can I clone the SCSI disk to a IDE Disk with a clone utility such as
> > Acronis TrueImage and then rebuild the boot loader?

Can  do it with tar (or cpio or cp -aux).

> I've done this.  It is doable, but it is not easy.
> 
> First, the partitioning will have to be exactly alike at first (you can resize 
> the filesystems, but you want to do that later).

It is not necessary to have the partitions the same if you are not using
an image copy tool - they just need to be larger than the space in use
on the corresponding source filesystems.  The process I have used goes
something like this...

Assume you have /, /boot, swap and /home
on /dev/sda2, /dev/sda1, /dev/sda3, and /dev/sda4 respectively - can be
easily extended/modified for other setups - and that you have both disks
installed.  Assume the destination disk is /dev/hda.

Partition the destination disk[s] so that each partition is at least as
large as the space used on the source partitions, plus appropriate
headroom.  Run mke2fs (or whatever if using other filesystems) on each
partition and mkswap on the swap partition, using labels as desired.
[Gets more complicated if using LVM - won't go there.]  For example...

# mke2fs -j -L /boot1 /dev/hda1
# mke2fs -j -L /1 /dev/hda2
# mke2fs -j -L /home1 /dev/hda4
# mkswap -L SWAP-hda3 /dev/hda3

Mount the filesystems:

# mkdir /new
# mount /dev/hda2 /new
# mkdir /new/boot
# mount /dev/hda1 /new/boot
# mkdir /new/home
# mount /dev/hda4 /new/home

Clone the information:

# cd /
# tar clf - . | tar xf - -C new
# tar clf - boot | tar xf - -C new
# tar clf - home | tar xf - -C new

Edit /new/etc/fstab (and if necessary create new initrd - may not be
needed - I'd try it first - many IDE controllers are supported by
default) as described below.  (Used to be required to fix /new/etc/mtab
for the new hardware config and delete everything but the root and proc
entries, but IIRC this is no longer necessary.)
Edit /boot/grub/grub.conf and add entries for the clone.  Copy
to /alt/boot/grub/.  Creating a grub floppy or bootable grub CD would be
a good move at this point.  Can fit vmlinuz and initrd on a CD, so that
is recommended, and can bypass problems with differing kernel version on
a rescue CD.  "info grub" has pretty good instructions.

Reboot and pick the clone OS entry from grub menu.  May run into trouble
with grub device ordering depending on the order the BIOS sees the
controllers.  Can sometimes work around this by changing the order of
controllers in PCI bus slots, or by BIOS settings.  Using the grub
command line "find", "cat", and command completion can help debug.
Removing the old disk/controller can help assure that the new disk shows
up as (hd0) to grub.  [Alternate boot media are necessary if doing
this.]

Assuming success in booting, fix the new /boot/grub/grub.conf to remove
old entries as set appropriate default.  Use "grub-install /dev/hda"  to
rewrite the boot record, or sometimes the interactive approach work
better:

# grub
grub> root (hd0,0)
grub> setup (hd0)
grub> quit
# 

> Next, depending upon the IDE controller, you may have to rebuild the initrd 
> with mkinitrd.  See the /sbin/new-kernel-pkg script for some ideas on doing 
> this and rebuilding the boot loader.  This step, incidentally, is how you can 
> migrate from one kind of SCSI controller to another; I've had to do that, 
> too, migrating from an Adaptec 39160 to an LSI U320 controller on a CentOS 4 
> Intel installation.  
> 
> The rescue CD is your friend in those cases, with mkinitrd a close second.  I 
> also did the same when migrating an Aurora 2.0 boot drive on a Sun Enterprise 
> 6500 from a D1000 shelf hung off a diff SCSI qLogic controller to the 
> single-ended drive tray and the ESP controller.  I also took another boot 
> drive from a Ultra 30 (which uses a PCI NCR 53c875 SCSI controller) to an 
> E5500 with the qLogic diff SCSI and a D1000 (for those who don't know, the 
> D1000 has high voltage differential SCSI inputs, but uses ultra wide LVD/SE 
> drives internally); booted the Aurora 2.0 CD in rescue mode, chrooted to the 
> drive, ran mkinitrd with the proper options, and rebooted.  Came right up.  
> Note that the rescue CD does need to be the same major kernel version as the 
> system. 

and have appropriate version of mkinitrd.

> Now, the part that is most important.  See /etc/fstab and make sure all 
> occurrences of /dev/sdaX are replaced with the matching /dev/hdaX (where X is 
> the partition number).  However, some ATA controllers (particularly SATA 
> controllers) act like SCSI and use /dev/sdaX instead; be careful.  If the 
> filesystems are mounted with labels, you may not have to do this except for 
> the swap partition.

The above apparently assumes you are using the same labels on the source
and destination disks.  If so, you must remove the original disk before
attempting a reboot or problems with duplicate labels will ensue.

> 
> I did this once going the other way, from an IDE disk to a SCSI disk. It 
> worked fine, but was a little tedious.

Have done it both ways, and with/without LVM.  Always a bit tedious but
workable.  Major problems (except for potential errors editing fstab and
grub.conf) tend to be with initrd and grub/BIOS device ordering.

Just reread the original e-mail and found the part about having  just /
and swap that was not included in Lamar's reply.  Should be easy enough
to simplify my overly complex response that has excess descriptions
of  /boot and /home.

Good luck.

Phil





More information about the CentOS mailing list