Hi, a customer has a Centos installation on SCSI disk (aic7xxx), there are some programs that he no longer have the installation media (some accounting stuff). Due to the SCSI disk going bad we must tranfer the installation to some other disks. SCSI disks are very difficult to find here and must be ordered (and wait about 45 days to arrive at the dealer). Can I clone the SCSI disk to a IDE Disk with a clone utility such as Acronis TrueImage and then rebuild the boot loader? The SCSI is 72gb with the bootloader, one swap partition and the second partition is / The customer will maintain the exactly same server, we will only change the storage media.
some other things to consider?
Thanks, --
------------------------------------------- Erick Perez Linux User 376588 http://counter.li.org/ (Get counted!!!) Panama, Republic of Panama
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?
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).
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.
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.
I did this once going the other way, from an IDE disk to a SCSI disk. It worked fine, but was a little tedious.
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
On Monday 24 April 2006 17:43, Phil Schaffner wrote:
Can do it with tar (or cpio or cp -aux).
The OP asked about image copying. In a full image copy, with the assumption that the source disk is removed prior to the reboot with the new disk, one doesn't have to worry about label dupes and such.
I've found a dd of the whole disk to an identical disk works very well, with caveats.
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.
Yes, this is very true.
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.
Removal of the source was assumed; sorry I didn't make that explicit. It vastly simplifies things if you do an image copy and remove the source drive before proceeding.
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.
Your instructions were complete, and have great information. And for cases where you might want to go to a different sized drive or use different filesystem sizes this is a good way to go; I use Paragon Partition Manager for many tasks, but resizing SELinux labeled ext3 filesystems is not one of them. For a straight clone and for NTFS and FAT Paragon works great (and the rescue CD version is a bootable Linux CD with the Partition Manager GUI app running on a 2.4.x kernel).
But it is quite a bit simpler to image the disk (either with imaging hardware or software, although a SCSI-> IDE clone would likely be software-only) and remove the source, once the proper edits have been made using the rescue disk. GNU parted and its frontends can do this as well.