Upgrading to a new Hard Drive

Lennart Sorensen lsorense-1wCw9BSqJbv44Nm34jS7GywD8/FfD2ys at public.gmane.org
Thu Jun 30 16:54:16 UTC 2005


On Wed, Jun 29, 2005 at 04:28:08PM -0400, Jon Thiele wrote:
> 
> I have an old 20MB hard drive running RedHat with 2 partitions.  I'd like to
> move the entire drive and its contents to a new 120MB drive without having
> to re-install all of my apps, databases, files, etc.
> 
> Can I use 'dd' for this - even if the drive parameters are not the same???  

No, that wouldn't be a good idea.  Here is a better method:

Install new hd as hdb or whatever works in the machine, then partition
it as you want it, do mkfs and mkswap as necesary on the new partitions,
then mount new root partition as /mnt or something, and cp -ax / /mnt to
copy all the files over.  Doing this in single user mode has the least
chance of files being open/in use.

Then install boot loader (grub-install --root-directory=/mnt /dev/hdb or
lilo -r /mnt (I guess you have to temporarily change boot= to /dev/hdb
or pass some other argument to override boot=.  I don't use lilo
anymore).  After you unmount and possibly copy any other partitions (if
any) and make sure your new fstab is right (if any partition order was
changed on the new drive) you should be all set to use the drive in
place of the old one.

That's basically how I have done it in the past.

cp -ax means copy recursively with special files and all permissions and
time stamps and exclude other mounted filesystems (like /proc).

Lennart Sorensen
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list