hard drive replacement

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: George Toft
Date:  
Subject: hard drive replacement
Michael Havens wrote:
>
> My hd is old (5-7 years) and I am thinking that I should replace it soon.
> After I install the new hd and then put the operating system on it, should I
> sudo cp /dev/hda1 new device?


Sounds like a pretty good way to destroy the data on your new drive :)

I have migrated drives before (this workstation has migrated 3 times
without a rebuild).  I simply perform a minimal install on the new
drive, then boot in rescue mode, mount comparable file systems from each
drive and cp -pR the contents.  For example, assume new drive is hda,
old is hdc.  / is on hda1 and hdc1.  Do this:
mkdir /mnt/oldroot
mkdir /mnt/newroot
mount -t ext3 /dev/hda1 /mnt/newroot
mount -t ext3 /dev/hdc1 /mnt/oldroot
cd /mnt/newroot
for I in home var bin etc lib mnt root  tmp dev floppy opt sbin usr; do
    cp -pR ../oldroot/$I .
done
mkdir boot proc


*NOTE: I may have missed something as it has been a couple years since I
did this last.

Granted, this blows away your new RPM database, binaries, etc, but it
replaces it with all the old stuff from the old disk.

Make sure you edit /etc/fstab, if necessary. You may have to run lilo.
If so:
chroot /mnt/newroot
lilo
exit


--
George Toft
Computer Security
AGD,llc
www.agdllc.com
623-203-1760