create new tag
, view all tags
A (manual) script to follow when cloning a Vector for CFK 1.5 hard drive to another hard drive in Linux. (Used on the LVCFK project.)

Developed primarily by Linc Fessenden and Dann Washko (IIUC). Some of Linc's original words are still used in the description of the process, below. (AFAIK, Linc determined that cp was a much better approach than dd in that cp copies only "real data", not empty sectors, and with the -a option preserves links and so forth.)

Among other reasons for rewriting this, I wanted a written procedure that used the correct drive designations (hda, etc.) for the setup I am using. If your setup is different, you may want to copy this procedure somewhere and change the drive letters accordingly to minimize the chance of copying a blank partition over your master partition. (Yes, I managed that. wink

If you want to see some of the development, see DdCloningScript and DdCloningScriptOld, both of which are very "ugly" pages -- not sure there is anything of value.




I might turn this into (at least partially) a "real" bash script. For now it is just a manual procedure.


  • /dev/hdc = source drive, /dev/hdc2 = source partition

  • /dev/hda = destination drive, /dev/hda2 = destination partition

You will want to remember that!

Although the drives could be located differently, having /dev/hda as the destination is particulary convenient because you can reboot and confirm all works, and the chroot ... /sbin/lilo "trick" (see below) is particularly convenient -- if you did it on anything other than hda you would have to do more fiddling with /etc/lilo.conf.

Preparation of the Image

Do a "fresh" install to serve as the master image, with these points:

  • Install XFree 4.2.x (there are times when I'd like to try 3.3.6, not sure how to do that with Vector)
  • Do the LILO configuration, reboot and do the ./cfkscript2 installation, including a second LILO configuration
  • Leave the inittab default runlevel at 2 -- this will be changed after the cloned hard drive is installed, configured, and tested
  • I've installed the knoppix "magic" XF86* configuration files in /etc/X11/knoppix for easy access
  • I may attempt to add the raidtools and md devices to this image to try some RAIDing.

The Cloning Process

Setup: Source on hda, destination on hdc, boot from floppy or CD

I have a machine (almost) dedicated to the cloning process. I switched the IDE cables on the motherboard so the source drive is the master on IDE controller 2, the CD is the slave on IDE controller 1, and, with the case removed, the 2nd connector for the 1st IDE controller extends out the top of the computer. There I can attach a hard drive for cloning jumpered as master and it becomes hda. (I could have set the machine to boot from IDE 1, 2, or 3 instead of 0, but I would still have had a problem setting up LILO with the chroot trick.)

  • With the power off, install the destination drive as master on IDE controller 1
  • Boot the Vector install from CD or floppy
  • During boot, get to the BIOS and get the new drive properly installed (or set the drive for "Auto" in the BIOS)
  • Use #ctrl-c several times, then enter to get to a command line prompt
  • Run cfdisk /dev/hda, and add 200meg swap on hda1, and the remainder of the drive as Linux native on hda2, and make that bootable. For version 1.5 of Vector CFK, you need a practical minimum of 1200 MB on hda2 -- more is better -- if necessary reduce swap to achieve 1200 MB -- we are looking into ways to combine two smaller hard drives to do a CFK installation (Raid 0, LVM, or something similar.
  • mkswap /dev/hda1 # 10 seconds
  • mke2fs /dev/hda2 # 20-30 seconds for 6gb
  • tune2fs -j /dev/hda2 # another 10-15 seconds
  • mount -t ext3 /dev/hdc2 /mnt/linux # the source
  • mount -t ext3 /dev/hda2 /mnt/temp # the destination
  • cd /mnt/linux
  • cp -a * /mnt/temp # copies ALL the cfk stuff in under 15 minutes!!
  • chroot /mnt/temp /sbin/lilo
  • umount /mnt/temp # just to be diligent (??)
  • cd /
  • umount /mnt/linux # just to be diligent (??)
  • halt or reboot and pull out the CD or floppy to confirm the new image boots OK.

You could do some testing here -- if there were no obvious problems, I prefer to test further after installation in the target machine.

When you're happy, halt, turn off the power, install the next drive to be cloned as hda, and start the process over.

Installing a Cloned Drive

_Instead of installing a cloned drive, you could install a cloned drive temporarily and clone from it to the original hard drive. This may be especially appropriate when it is difficult to remove the original hard drive. Just make sure it is at least 1.28 GB or so.

  • With the power off, remove the old drive and install a cloned drive. (Pick a hard drive size that is somehow appropriate to the power of the machine, including considering whether it includes a sound card or CD-Rom drive (might be used to store music files).)

Until you've confirmed the new hard drive and machine will work, you may want to temporarily connect the hard drive without installing it.

  • Power up the machine, configure the BIOS for the hard drive installed, save the configuration and reboot.

  • At the prompt, login as root then run xf4config to configure X, sndconfig for a sound card, and netconfig for a NIC. (We don't fully configure the net card, typically only make sure the module is installed, and we haven't configured any modems so far.)

  • Run startx to test the X configuration, repeat running xf4config to adjust if necessary (or use the "magic" (knoppix) xf4config files (installed in /etc/X11/knoppix on clones I've made -- just delete the old XF86* files in /etc/X11 and copy these.

  • When you are satisfied that X works, run init 5 and do some testing. When you are satisfied, quit X using <ctrl><alt><backspace>.

  • Modify /etc/inittab to start at runlevel 5.

  • Reboot one more time to confirm all is OK.


  • () RandyKramer - 19 Mar 2003
  • <If you edit this page: add your name here; move this to the next line; and include your comment marker (initials), if you have created one, in parenthesis before your WikiName.>

Page Ratings

Edit | Attach | Watch | Print version | History: r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r2 - 2003-03-20 - RandyKramer
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by PerlCopyright 1999-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding WikiLearn? WebBottomBar">Send feedback
See TWiki's New Look