Tags:
create new tag
, view all tags
Other people have started using dd to clone Vector installations -- I have quite a few things to learn about the process.

Update: I've developed at least tentative answers to my own questions and put some notes below. I now want to attempt to develop a script to do all the necessary steps to create either a new /home or a /data (or similar), depending on the free space available. I am developing a script (or a few alternatives) at TWiki:Wikilearn.DdCloningScript) -- when I'm done I'll bring it back here. Major note -- I've now found parted and it looks like it might do the entire job, and, (I just noticed) it is available on the Vector boot and root install floppies.

Contents

dd'ing Procedure and Questions

The first clones done among the people I worked with involved cloning the entire drive, even though there was a lot of free space. (IIUC, Linc was always dd'ing less than a whole drive with a smaller drive: 2gb master to 6gb slave.)

On Saturday, 15 Feb 2003, I intended to clone only the used portion of a drive, but started off wrong because I did a dd if=/dev/hda of=/dev/hdb which, of course copied the entire drive. It turns out that this works even if I copy to a slightly (or significantly) smaller drive (as long as the drive copied to has enough space for all the "real data" on the source drive - i.e., there is no need to copy the unpartitioned free space or even (all) the unused space within a partition). Eventually the dd stops with a "not enough space" message, but if you put that drive in another machine it works fine.

Question 1: What dd command should I have used to dd just the "used" partitions? I'm guessing it would have been something like dd if=/dev/hda1 of=/dev/hdb1, followed by dd if=/dev/hda2 of=/dev/hdb2 but, must I do something to prepare hdb, like use fdisk to create partitions of the appropriate size beforehand?


    • Yes, you would have to create the partitions with fdisk or cfdisk prior to dd if you are not dd'ing the entire drive. You could, I believe, dd if=/dev/hda1 of=/dev/hdb so long as hdb is of equal or greater size to the partition 1 on hda.

    • For cfk purposes, you are only going to have 2 partitions: swap and /. Thus, it makes sense to copy the entire drive which should copy the boot loader. The problem with dd is that it copies everything, without regard for empty space. Consulting the man page reports that dd "copies a file using specific input and output blocksizes." Since everything is treated as a file in *nix (hard drives for instance) dd allows you to copy the file down at the block level. Richard said at our last meeting you could change the block size from 512 (which is the default) to something higher like 1024, 2048, 4096, etc. which should speed up the process. I'm not sure how high you can go and remain reliable.


Seems like a dumb question in retrospect -- haven't tried it but don't see how you could refer to, for example, /dev/hdb1 before it exists -- so yes, I believe you must use fdisk to create hdb1 and hdb2 before using dd to "populate" them. Don't know how much of an advantage it is to dd the swap partition, but it may require just a little less learning for me (won't have to look up how to do a "swapon" or whatever -- although that could be very useful to me because one of the next things I want to do on my Mandrake workstation is increase the swap dramatically (like to 1 or 1.5 GB -- right now I use 0.5 GB) to see if that reduces my Mozilla "crashes".

Question 2: With the approach I did use (cloning the entire disk), I now plan to partition the unused space left on the disk and, in most cases, name it /home thus giving the user a much bigger /home. (In one case today, there was not much leftover space, so we'll probably create a new partition and mount it as /data.) With the help of Joe Simpson, I used fdisk on one of the cloned machines to create a new partition. We didn't get as far as the rest of the steps -- can somebody add them? Here's the start:

  • fdisk /dev/hda then use n to create a new partition, p to confirm the partion layout, then w to write it (or, in case something goes wrong, q to quit without saving)
  • run a command to make an ext3 file system (would that be something like mke2fs -j /dev/hda3
  • hmm, now I need to copy anything in the original /home to the intended new /home, before I mount the new home and I need to use commands that will "preserve" (or recreate) any soft or hard links included in /home
  • then mount the new /home

This will be the main focus of my script -- I think I'll just copy this page to TWiki:Wikilearn.DdCloningScript (faked cross TWiki reference, as the feature is probably not working on the CFK TWiki at this time), cut out the extraneous text, and start working towards a script. Probably won't test before I'm at the next WorkParty for lack of a test machine / hard drive.

Ahh! I think I've got the gist of it -- I'll look again tomorrow to try to get the details worked out (unless somebody fills them in for me before then)

Final question -- I wonder if all the necessary utilities are included in the Vector CFK install?


    • Yes, all the necessary utilities are available on the cfk installation disks, or if you boot from the cdrom: dd, tar, cfdisk, etc.

    • One thing I started looking into was using tar to copy the "used" portions of the drives as such:

      • boot with the vector disks or disc.
      • cfdisk /dev/hdb and create partitions.
      • mount master and slave devices (mount /dev/hda2 /mnt/master; mount /dev/hdb2 /mnt/slave)
      • in /mnt/hda2 issue: tar -pcf - * | tar -pxvf - -C /mnt/hdb2

    • I kept bombing due to bad hard drives.


Compaq (DeskPro 2000) Issues and Potential Proposal

Moved to CompaqDeskPro2000Proposal.

Contributors

  • () RandyKramer - 15 Feb 2003
  • DannWashko - 22 Feb 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.>


Thanks for the comments, Dann. There's a very useful hint above (IIUC) -- if I clone each partition individually I will also have to do something to "clone" the MBR / boot loader -- I suspect not doing that was the cause of my L 99 99 99 problem (documented at TWiki:Wikilearn.DdCloningScript or one of the pages linked from there.

-- RandyKramer - 24 Feb 2003

Topic revision: r1 - 2003-03-17 - 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