[CentOS] A questiong about replacing my failing drive

Rodrigo Barbosa rodrigob at suespammers.org
Sun Jun 12 01:38:23 UTC 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sat, Jun 11, 2005 at 09:18:56PM -0400, Mark Weaver wrote:
> you've got a point there because I have run into a few where there were 
> definite filesystem problems that I couldn't get around. Which is why in 
> another post I asked if you'd layout your process that you've mentioned. 
> I'm really curious about how you're doing it. Anything Linux I can learn 
> is always a good thing.

Here is the exact step-by-step procedure I follow:

1) Have both disks on the same machine. Lets say:
	- hda (IDE, original data)
	- sda (SCSI, target)

2) Boot the machine with a rescue CD or, if not possible,
   runlevel 1

3) Make sure you have a table (on paper) with the partition->filesystem
   relationship.

4) Use fdisk (cfdisk etc) to partition the new disk (sda)

5) Make sure you have all the /dev entries you need. If you don't,
   create them with mknod (usually not needed)

6.a) Mount the destination partition you want to copy data to
   somewhere. You will repeat this step for each partition.

6.a.1) # mkdir /dest
       # mke2fs /dev/sda1
       # mount /dev/sda1 /dest

6.b) Alternatively, you can copy the partition directly over the
     old one. For that, you don't need to execute the 6.a step.
     You must make sure both partitions are the same size, to
     do this this way. Otherwise (or if you are not sure), use the
     procedure on 6.a.

Note: In both case, if you are doing this on a live system on
      runlevel 1, don't forget to remount the partition readonly
      during this procedure:

      # mount -o remount,ro /

7) Copy the data.

7.a) In case you are following 6.a:

	# dump -0f - / | (cd /dest; restore -xf -)

7.b) In case you are following 6.b:

	# dump -0f - /dev/hda1 | restore -xf /dev/sda1

8) If needed, unmount the /dest partition

9) Repeat the procedure for all partition you want to

10) Turn off the machine, remove the old disk, and boot with
    the rescue disk again.

11) Mount the root partition on the disk somewhere:

	# mkdir /r
	# mount /dev/sda1 /r

12) Chroot for the root partition

	# chroot /r /bin/bash

13) Reconfigure your bootmanager as needed (lilo.conf, grub.conf, menu.lst),
    and reinstall it (lilo, grub-install etc)

14) Reboot the machine using the new system



This procedure is also recomended if you are moving a partition for
a new HD. Of course, you don't need to worry with steps 10+ in that
case. Depending on what you are copying, you can do that during
normal operation (as long as you don't need that partition at
that time). Just remember to remount it readonly.

[]s

- -- 
Rodrigo Barbosa <rodrigob at suespammers.org>
"Quid quid Latine dictum sit, altum viditur"
"Be excellent to each other ..." - Bill & Ted (Wyld Stallyns)

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)

iD8DBQFCq5IPpdyWzQ5b5ckRAmcMAJ0Ro9hy1RsgL7tkL1tIx2EMbR+wmQCggU5/
wtY63OdjWBbdsomwSshDluQ=
=oUqo
-----END PGP SIGNATURE-----



More information about the CentOS mailing list