[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: OT: (a bit) copying WINDOZE (or any other disks)



On Thu, 2004-12-23 at 13:41 -0600, Aleksandar Milivojevic wrote:
> Laurence Orchard wrote:
> >>What's the recommended process to create an exact duplicate (boot sector
> >>and all) of a hard drive?  Is it really as simple as:
> >>    cat /dev/hda > /dev/hdb
> > 
> > In answer to the question, I would partition the new drive, 
> > then use
> > 
> > dd if=/dev/<old-drive> of=/dev/<new-drive>
> 
> Which would overwrite the partition table, so why bother to partition 
> the drive in the first place?
> 

ok perhaps to clarify!

dd if=/dev/hda1 of=/dev/hdb1

Copy partition at a time if there is more than one.

> Anyhow, using dd is better solution than using cat.  One dd option to 
> check (which might speed up things) is bs=n.  By default it is 512 (one 
> disk block), so dd will read 512 bytes at a time.  Using bs=8192 should 
> make things faster (this way dd will read/write 16 disk blocks in single 
> system call).  Just make sure size of the disk is multiple of whatever 
> you use for bs (otherwise you might get error on last read), and that 
> argument for bs is multiple of 512 bytes (disk blocks are 512 bytes long).
> 
> I'm not sure how happy the system will be if disk geometries are not the 
> same (if you simply copy partition table using dd).  Try something along 
> the lines "dd if=/dev/hda of=/dev/hdb count=1" (this will copy just the 
> MBR, which contains partition table), and than "fdisk /dev/hdb".  See if 
> it will complain, and if partition sizes look right.
> 
> If not, partition the drive manually, and use dd to copy individual 
> partitions instead (dd if=/dev/hda1 of=/dev/hdb1 bs=n)...
> 
err, this is what I meant! sorry if I confused

> Warning: when you copy over MBR (effectively repartitioning the disk), 
> the kernel will not be aware of the new partition table.  This is 
> because kernel will read it at startup and will chache it.  Quick 
> workaround is to do "fdisk /dev/hdb", and exit from it using "w" 
> command.  fdisk reads partition table from the disk (not from the 
> kernel), and when it writes it out, it calls ioctl that instructs the 
> kernel to reread it.  After that, you should be able to test-mount new disk.
> 
> -- 
> Aleksandar Milivojevic <amilivojevic pbl ca>    Pollard Banknote Limited
> Systems Administrator                           1499 Buffalo Place
> Tel: (204) 474-2323 ext 276                     Winnipeg, MB  R3T 1L7

-- 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]