Copying one hard drive to another with almost no pain

Replies:

  • None.

Parents:

  • None.

--=-7GG65rf694WkPChvpifN
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

Hello,

Symptoms suggest that my current laptop hard drive is on
the way out. It might be other hardware in my laptop, but
for the moment I'm going to suppose it's a dying drive.

I was able to copy data from one drive to a new one as
follows. I'm assuming you have access to both drives simultaneously
(although strictly speaking I don't think that's required).
In my case, I have an external hard drive housing that holds 2.5"
drives; I left the old drive inside the laptop. An advantage to
the approach below is that the drives can be of different sizes.
[There are probably tools to do this, but this was fairly satisfying.]

1) Boot in Knoppix [1]. I chose knoppix 3.4 (most recent as of
  this posting), put it on a CD, etc.

  Note: I booted up into the 2.6 kernel by typing "knoppix26"
  at the boot prompt. I don't know whether using this kernel
  was critical to the success of the transfer.

2) Partition the new drive using sizes proportional to the old
  drive. I used cfdisk. In my case, the drives were both 40G.

3) For each partition on the old drive, mount the corresponding =20
  partition on the new drive. Use rsync (-av) to copy data=20
  from old to new. I do not think "dd" is a good idea since
  I did not want the process to be sensitive to absolute =20
  addresses. I'm sure something besides rsync (cpio?) would=20
  work as well.

  I did have some problems here copying my one windows NTFS=20
  partition. I have not yet tested whether I can boot into=20
  Windows XP using the new drive. This part requires more study.

4) The next bit was a stumbling block due to lvm2. I was
  getting error messages related to "/dev/mapper/control" as
  soon as I tried to run lilo on the new disk. The lvm2 FAQ [2]
  suggested a solution that involved loading a module that=20
  didn't seem to be loaded in Knoppix 3.4 automatically. So,
  by hand a ran "/etc/init.d/libdevmapper1.00 start" and the
  rest of the steps worked fine. Without it, lilo would not
  complete properly.

5) Make the (mounted) root partition on the new drive the=20
  active root with chroot. In my case: "chroot /mnt/hda2".

6) Run lilo using that root.

After that I was able to remove the knoppix CD and reboot
using the new harddrive. I didn't see any irregularities
and I'm writing to you know using the new drive.

I'll probably keep the old one around, or I might ask for
a refund since I bought the disk is flaking out in March of
this year [3]. The fact that it's only lasted a bit more
than three months makes me a bit suspicious that this is
not a hard drive problem.=20

- Ian


[1] http://www.knoppix.net/
[2] http://tldp.org/HOWTO/LVM-HOWTO/lvm2faq.html#AEN241
[3]
http://impressive.net/archives/fogo/1078859157.3263.21.camel@seabright
--=20
Ian Jacobs ([email protected])   http://www.w3.org/People/Jacobs
Tel:                     +1 718 260-9447

--=-7GG65rf694WkPChvpifN
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part

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

iD8DBQBA5j0u3Vu9UJRDGtARAqoUAJ0SrO4e2k04SSwE9slUqjsh0TDXIwCdG15K
mcrDh0RXKh8RFKjdiUbCz4k=
=eDJI
-----END PGP SIGNATURE-----

--=-7GG65rf694WkPChvpifN--

HURL: fogo mailing list archives, maintained by Gerald Oskoboiny