You are on page 1of 3


Red Hat Tips & Tricks: One tip, and one trick

Red Hat Tips & Tricks: One tip, and one trick


Author Team Date of Creation Wipro email id

Selvakumar Jaganathan. MaXXan Team 16th Aug 2004

Wipro Technologies – TIS

Page 1 of 3


Red Hat Tips & Tricks: One tip, and one trick

Every so often you run out of capacity on a given machine, or you have decide to add drives and you need to copy or "ghost" one partition to another. This time I give you some info on futzing with your drives. One tip, one trick. You decide which is which.


How do you 'ghost' or copy a partition to another hard drive?

Depending on the contents of the partitions, various UNIX utilities can be used to copy data between drives. The easiest utility to use is the cp command, which will copy data on the partition to the location you specify. If you need to move additional data (metadata usually not stored on the file system as actual files) then the dd command can be used to perform a bit for bit binary copy of the data on a disk partition to a new location. If you just want to copy the contents of a file system tree to another location, the following command is likely what you need:
cp -ar <source directory> <destination directory>

If you want to move an entire hard drive image (a.k.a. "ghost" a drive) to another driver, the following command is likely to be what you want:
dd if=</dev/[h|s]dX> of=</dev/[h|s]dY>

Note in the dd command, the h or s modifiers normally specify an IDE or SCSI drive respectively. The X and Y should be replaced with the appropriate drive letters (a,b,c, etc.). For example:
dd if=/dev/hda of=/dev/hdb dd if=/dev/sdc of=/dev/sdd

For additional options and usage, please see the man pages for cp and dd, man cp or man dd from the command line.


How can you change the order of devices, like sda and hdb?

Symptom: I have two controllers (SCSI and fiber-channel) and two drives (internal SCSI and external fiber-channel). The drive with linux only attaches to the first controller. I never attached the linux drive to the second controller. I have two SCSI drives in the machine connected to a raid controller setup for mirroring so they are presented as one drive. During the install this was sda.
Wipro Technologies – TIS Page 2 of 3


Red Hat Tips & Tricks: One tip, and one trick
After the install I loaded drivers for the qla2200 (fiber channel host-bus-adapter) that connects to external fiber channel storage. The fiber channel storage has a controller(FasT 500) that presents the disks in the array as one drive. Now that the drivers for the hba are loading, the external fiber channel drive is seen as /dev/sda and the internal scsi drive is seen as /dev/hdb. I did not change how the internal scsi disks attach to the raid controller. Solution: For this particular issue, all that was needed was a reordering in the /etc/modules.conf file and then a rebuild of the initrd image. Change the /etc/modules.conf file form:
alias alias alias alias alias eth0 tg3 eth1 tg3 scsi_hostadapter qla2200 scsi_hostadapter1 ips usb-controller usb-ohci

alias alias alias alias alias eth0 tg3 eth1 tg3 scsi_hostadapter ips scsi_hostadapter99 qla2200 usb-controller usb-ohci

Note: I moved the ips module line up but the most important change was to change the qla2200 line from scsi_hostadapter1 to scsi_hostadapter99. This will force the module to load last in the initrd image. After these changes are saved, then rebuild the initrd image according to the kernel version and reboot the system. WARNING: Make sure you build this against the correct kernel (the kernel you want to run). I recommend that if you are going to replace your existing initrd image with the new one, that you make a back-up copy first. The -f option will force or overwrite the existing initrd image file.
cp /boot/initrd-2.4.9-e.38smp.img /boot/initrd-2.4.9e.38smp.img.bak mkinitrd -f -v /boot/initrd-2.4.9-e.38smp.img 2.4.9-e.38smp

After rebooting the system, the devices were ordered properly.

Wipro Technologies – TIS

Page 3 of 3