SUMMARY: Copying one HardDisk to another HardDisk

Anwar Saadeh <[email protected]> Fri, 23 Apr 2004 10:58:55 -0700 (PDT)
Newsgroups gmane.linux.admin.managers
Message-ID <[email protected]>
My original message along with the revised steps to fix the problem is at the 
bottom of this e-mail.

First, I would like to thank the following people who helped in solving the 
problem:

Bart Reagan		Venkat Saravanan
Donald B. Altman	Kelwin Wylie
Jon Masters		Brian Coyle
Brett Geer		Steve Sandau
Mike/Szii		Steve Binyon
and
Mark Street

Some of the responses I received actually included the right answer but some how 
things weren't clear until "Mark Street" provided a detailed explanation. I know 
Mark has send his explanation to the list but here it is again:

Mark Street Wrote:

The error is in the bootloader configuration.  The LABEL or volume name on the 
second hard disk's filesystem is probably listed in the kernel line. (I have 
seen this error message before ; ))  You have to UPdate the bootloader 
configuration as well as /etc/fstab if you are going to use device syntax, 
/dev/sdx to boot the machine.
 
The bootloader is looking for the volume name LABEL=/ of the / filesystem in the 
bootloader configuration file.  Change that and it will work.
 
kernel /vmlinuz-2.4.22-1.2188.nptl ro root=LABEL=/
 
kernel /vmlinuz-2.4.22-1.2188.nptl ro root=/dev/sdax
 
But there is an underlying concept going on here you must understand.
 
You have two choices, either edit the grub.conf kernel line to reflect the 
proper device (remove the LABEL entry from the boot loader config) as I have 
done above, or Add a LABEL to your new disk with the tune2fs command as shown 
below.  If you want to use both disks at the same time you have to give them 
different LABEL's.  If you want to boot from them you have to edit your boot 
loader configuration to point to the proper LABEL.  Got it??
 
The LABEL or filesystem volume name is set with the tune2fs command.  It is used 
so you can move SCSI disks around on a ribbon and the bootloader and file system 
table can still detect the proper LABEL and mount the proper filesystem assigned 
to that LABEL.
 
Use the dump2fs to see the volume name;

dumpe2fs /dev/sdaX | less

The first line will be the volume name;

Filesystem volume name:   /

To remove the label you can give tune2fs an empty string like so.

tune2fs -L '' /dev/sdaX


================================================================
============The revised steps and correct answer ===============

What I did to fix the problem was to create a volume lable. But instead of using 
"tune2fs -l / /dev/sdb", I used "mkfs.ext3 -L / /dev/sdx" to create the volume 
labels.

The revised and proper steps to copy one disk to another (and make 2nd Disk 
bootable):


1. sfdisk -d /dev/sda | sfdisk /dev/sdb (partition 2nd Disk based on 1st HD)

2. mkfs.ext3 -L /boot 	/dev/sdb1
   mkfs.ext3 -L / 	/dev/sdb2
   mkfs.ext3 -L /var	/dev/sdb5
   mkswap 		/dev/sdb3
   
3. mount /dev/sdb1 /mnt/sdb1
   mount /dev/sdb2 /mnt/sdb2
   mount /dev/sdb5 /mnt/sdb5
 
4. cd /mnt/sdb1; dump 0f - /dev/sda1 | restore rf -
   cd /mnt/sdb2; dump 0f - /dev/sda2 | restore rf -
   cd /mnt/sdb5; dump 0f - /dev/sda5 | restore rf -
   
   or:
   
   rsync -axvPS /boot/ /mnt/sdb1
   rsync -axvPS //     /mnt/sdb2
   rsync -axvPS /var/  /mnt/sdb5

5. Physically moved 2nd Disk in slot 1 and reboot  

That's it. It works :) 


====================
====================
My original message:

 
Hi,

I have a problem making a 2nd HardDisk bootable after copying it from 1st Disk

- This is done on a RedHat WS release 3, 2.4.21-4.EL
- We do not want to use "dd" to accomplish this task
- The 2nd disk needs to be bootable
- What we need to accomplish is to be able to boot on the 2nd Disk after moving 
it to the first slot.


Here are the steps am taking:

1. partition 2nd Disk
2. mkfs -t ext2 /dev/sdb1
   mkfs -t ext2 /dev/sdb2
   mkfs -t ext2 /dev/sdb5
   mkswap /dev/sdb3
   
3. mount /dev/sdb1 /mnt/sdb1
   mount /dev/sdb2 /mnt/sdb2
   mount /dev/sdb5 /mnt/sdb5
 
4. cd /mnt/sdb1; dump 0f - /dev/sda1 | restore rf -
   cd /mnt/sdb2; dump 0f - /dev/sda2 | restore rf -
   cd /mnt/sdb5; dump 0f - /dev/sda5 | restore rf -
   
   I even tried the following:
   
   rsync -axvPS /boot/ /mnt/sdb1
   rsync -axvPS //     /mnt/sdb2
   rsync -axvPS /var/  /mnt/sdb5
   
5. If I reboot on the 2nd HardDisk at this time, I get this error message:
   mkrootdev: label / not found
   Mounting root filesystem
   mount: error 2 mounting ext3
   pivotroot: pivot_root(/sysroot,/sysroot/initrd) failed: 2
   umount /initrd/proc failed: 2
   Freeing unused kernel memory: 164 freed
   Kernel panic: No init found. Try passing init=option to kernel.
   
   
   
6. I think I have to do something about grub on the 2nd HardDisk:
   #grub
   >root (hd1,0)
   >setup (hd1)
   
   However, I keep getting the same error message as above: Kernel panic
   
What am I doing wrong? Any help is much appreciated.

Thank you all.
_______________________________________________
LinuxManagers mailing list - http://www.linuxmanagers.org
submissions: LinuxManagers-35TzE1X9F6582KRnZfj+bdi2O/[email protected]
subscribe/unsubscribe: http://www.linuxmanagers.org/mailman/listinfo/linuxmanagers