On Sat, Jul 29, 2000 at 02:55:44PM -0700, Dave Lers wrote:
> On Sat, 29 Jul 2000, Charles Curley wrote:
> > On Sat, Jul 29, 2000 at 11:04:03AM -0700, Dave Lers wrote:
> > > A simple 
> > > 
> > > dd if=/dev/hda of=/dev/hdc
> > > 
> > > works great, super backup method, all you need to do is swap drives
> > > (plug hdc in where hda was). You want both drives as master, 1 per
> > > channel. The drive you are writing to needs to be the same size or
> > > bigger. Since my drives are almost identical I haven't played with,
> > > don't know how to, utilize extra space if copying to a noticeably
> > > larger drive. 
> > 
> > This assumes that the two drives have identical sectors per track and
> > tracks per cylinder. Otherwise the drive geometry won't match the values
> > in the MBR's partition table. If the new drive has larger values, you are
> > OK, but you waste a lot of space. If the new drive has samller values, you
> > are hosed.
> 
> I don't know anything about drive geometry, are you saying there is
> more to it than making sure the copied to HD is >= in size? How much
> wasted space are we talking about? Are you talking about the
> leftover at end of the disk?, which I assumed could be formated as
> another partition.

Well, you've just opened up a nice big can of lawyers, so sit back and
read.

There are three elements of a hard drive's geometry: number of sectors per
track, number of tracks per cylinder, and total number of cylinders. I'll
ignore the sector size as almost all hard drives leave the factory
formatted with 512 byte sectors.

OK, suppose the old hard drive has 35 sectors per track. If the new hard
drive has fewer, say, 30, then dd will write the 31st sector of a give
track somewhere else, Murphy only knows where, or it will error out and
refuse to write it. So you are hosed.

If the new drive has more sectors per track than the old one, one of two
things will happen when dd writes to the new one. Either dd will be
"smart" (i.e. copies using the old drive's geometry) and ignore the spare
sectors, in which case you have a working hard drive, and waste those
spare sectors. The spare sectors are spread out on each track all over the
new drive, and so they aren't recoverable in any useful way.

Alternatively, suppose dd is "stupid" (writes the data using the new
drive's geometry). Now, the first track will be copied fine. But the first
N sectors of the second track (where N is the difference in the sectors
per track) will be copied from the second track on the old drive to the
first trackon the new drive. But, given the assumptions built into thte
partition table of the MBR, that ain't where the file system driver is
going to look for them. So you will get a lot of information showing up in
the wrong place.

I have no idea whether dd is "smart" or "stupid". If I were writing it,
I'd make it "stupid" because most of the time one copies other things
besides hard drive to hard drive, so the smarts would be irrelevant.

Now, think the same thing through for the number of tracks per
cylinder. Again for the total number of cylinders.

Also, even if you end up with spare cylinders, you may not be able to use
them. You have to have at least one primary partition available that you
can use to build an extended partition with the new cylinders.

Also, as far as I know dd does not manipulate either the drive partition
table in the MBR or any information in any of the file systems. It is
strictly a raw copy, byte for byte. So your MBR on the new drive will most
likely be incorrect.

Have I gotten you totally confused yet?

-- 

                -- C^2

No windows were crashed in the making of this email.

Looking for fine software and/or web pages?
http://w3.trib.com/~ccurley

PGP signature

Reply via email to