[ltp] How to replace HD Was: Replace HD; T41p

Eben King linux-thinkpad@linux-thinkpad.org
Mon, 30 Aug 2004 15:06:11 -0400 (EDT)


On Mon, 30 Aug 2004, David Sudjiman wrote:

> Now, the question is a bit different. Just say that I have my 7200 RPM 80
> GB HD in hand. What should I do in order of preference to do replace my
> old HD?

You can use dd if:
 the new drive is exactly the same size as the old one AND you have enough 
 room to hold an image of the whole drive (maybe compressed)
OR
 the partitions you've made are exactly the same size as the old ones AND 
 you have enough room to hold an image of your biggest partition (maybe 
 compressed)
If not, you'll need to use cp -r / tar / cpio.

Boot from alternate medium (CD?).

If you're using dd:

ssh -e none remoteuser@remotehost "cat > hda-image" < /dev/hda

If you have to compress it to make it fit, insert "| gzip -1" after "cat"  
and change the filename to reflect compression.  It's CPU-bound; this runs
gzip on the remote end.  Probably its CPU is faster than the laptop's.

If you have to copy one partition at a time, replace "hda" with "hdaX" 
(where X is the partition number).  Don't bother copying the swap 
partition.

If you have to do a filesystem copy,

Mount each partition in turn.  "cd" to its mount point.

tar cvf - . | ssh -e none remoteuser@remotehost "cat > hdaX.tar"

Compression can be enabled as before.

to restore:

Power down; swap hard drives.  Boot from CD.

If you used dd on the whole drive:

ssh -e none remoteuser@remotehost "cat hda-image" | dd of=/dev/hda

If you compressed the image, I'm not sure whether it's better to run "gzip 
-d" locally or remotely.  Assuming remotely, replace "cat" with "gzip -d <".
Change the filename appropriately.

If you used dd on each partition,

ssh -e none remoteuser@remotehost "cat hdaX-image" | dd of=/dev/hdaX

Enable decompression as before.

If you used tar, partition and mkfs the drive.

For each partition,

 Mount it.  "cd" to the mount point.

 ssh -e none remoteuser@remotehost "cat hdaX.tar" | tar xvspf -

 Unmount it.

All this is untested; use at your own risk.  I've actually done the 
dd+gzip thing (backup, didn't have to restore), but what I've written is 
what I think I did.

-- 
-eben    ebQenW1@EtaRmpTabYayU.rIr.OcoPm    home.tampabay.rr.com/hactar
SAGITTARIUS:  All your friends are laughing behind your back... kill
them.  Take down all those naked pictures of Ernest Borgnine you've got
hanging in your den.  -- Weird Al, _Your Horoscope for Today_