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

Re: [debian-user] How to copy a laptop HD?



Javier Vasquez:
> 
> Do you suggest using "dd" instead?  Would it work even if the destine
> partition is bigger (I read somewhere it works perfectly when source
> and destine are the same size, but I never read it works perfectly
> when destine is bigger)...

Yes, it works. You have to resize your filesystems afterwards, but
that's not a biggie.

> What about the HD MBR?  I've tried already using "dd if=/dev/hda
> of=~/full_mbr.bin bs=512 count=1 && dd if=~/full_mbr.bin of=/dev/sda
> bs=446 count=1", but it didn't seem to work...

Why do you only copy 446 Bytes back?

> I wouldn't know if
> using count=2 to include the boot sector would work since the boot
> partition is the 2nd one (the swap is the 1st one)...

It doesn't matter where your boot partition is. You only need the MBR
(the first 512 Bytes, AFAIK, which you already copied.)

> The thing is that as this is a laptop, and changing the HD on the only
> IDE slot is getting less fun each time, I was thinking what would be a
> good recipy to follow.  Maybe using dd for each partition, or for the
> whole HD would work, although I find it hard to believe it would (the
> partition tables at least should be different, since the difference in
> sizes), but I just might be too skeptical, and using dd for the whole
> HD is what works out of the box after partitioning the HD, :).

No, you're right about your skepticism. dd'ing the whole disc will also
copy the partition table which you probably don't want.

You only need to:

- Partition the new disk to your liking.

- dd filesystems from old partitions to the new ones. Make sure to use a
  big number for the block size like bs=1M or more. That will speed up
  the process. While dd is working, you can send the dd process a USR1
  signal (like 'kill -USR1 $pid') to make it print a report about its
  current progress.

- Copy the MBR using 'dd if=/dev/in of=/dev/out bs=512 count=1'.

- Use resize2fs or whatever suits your filesystems to grow them up to
  the capacity of their partition.

- Swap disks and reboot.

At least, that's how it should work in theory. :)

J.
-- 
After the millenium I will shoot to kill.
[Agree]   [Disagree]
                 <http://www.slowlydownward.com/NODATA/data_enter2.html>

Attachment: signature.asc
Description: Digital signature


Reply to: