[wplug] Copying a harddrive

Robert E. Coutch robert.coutch at verizon.net
Thu Feb 26 00:28:24 EST 2004


Just for the record - I did NOT want the MBR copied but I have done dd 
if=/dev/hda of=/dev/hdb in the past with no problems either.

On Wednesday 25 February 2004 10:22 pm, Poyner, Brandon wrote:
> As long as you're copying to a drive larger than the drive being replaced
> you could do a
>
> dd if=/dev/hda of=/dev/hdb
>
> The thing you're missing by setting up the partition table and then copying
> hda1 to hdb2 is the master boot record, the first 512 bytes of the hard
> drive.  If you _only_ wanted the MBR you would do something like this
>
> dd if=/dev/hda of=/dev/hdb bs=512 count=1
>
> If you do hda to hdb you get the entire thing, MBR, partition table,
> partitions, and even any blank space at the end of the drive that falls
> outside of the partition table.  The only thing to do at that point is
> expand the partition to fill up the available space using fdisk and then
> grow the file system.  How you grow the file system depends entirely on the
> file system type in question.  There are linux tools for doing that for
> NTFS, ext2 has resize2fs, reiserfs has resize_reiserfs, etc.
>
> Defining the blocksize is a good idea, it defines what chunk size dd should
> use for buffers.  If I understand the man page correctly if you don't
> define the blocksize you end up reading in 1 block at a time, write that
> block, rise and repeat. But technically speaking it's not required, it just
> speeds things up.
>
> -----Original Message-----
> From: Robert E. Coutch [mailto:robert.coutch at verizon.net]
> Sent: Wed 2/25/2004 9:29 PM
> To: wplug at wplug.org
> Cc:
> Subject: [wplug] Copying a harddrive
>
>
>
> 	Maybe you have a better way to do this.
> 	Here's the situation.
>
> 	Someone wants to upgrade from a small sized hard disk to a larger one.
> 	They don't wan't to reinstall their entire system (usually Windows).
>
> 	Normally I do the following:
>
> 	Add the new drive to the current system and boot under Linux from CD-ROM
> 	(Knoppix or Disto rescue CD).
>
> 	Use fdisk to create a new partition on the new hard drive (we'll say its
> 	/dev/hdb).
> 	Set the partition type (Linux, NTFS, etc).
> 	Set the partition active and write the table.
>
> 	Copy the old drive partition (/dev/hda1) to the new one (/dev/hdb1):
> 	dd if=/dev/hda1 of=/dev/hdb1
>
> 	I now have a duplicate of the old drive including the size of the old
> drive on the new drive.
>
> 	I then run Partition Commander to expand the partiton to the full size of
> the drive.
>
> 	I remove the old drive and permantly install the new one.
>
> 	System is good to go.
>
>
> 	My questions are:
> 	Is there a better way of doing this without paying for some custom
> software? Am I using dd correctly?
> 	Do I need to state block size and what happenes when I don't?
>
>
> 	Thanks for you help,
>
> 	Bob
>
> 	_______________________________________________
> 	wplug mailing list
> 	wplug at wplug.org
> 	http://www.wplug.org/mailman/listinfo/wplug




More information about the wplug mailing list