At 17:26 05/07/2005 -0700, Todd Walton wrote:
>I have two hard drives.  One is a 4GB and I'm replacing it with a 40
>GB.  I already have everything I need on the 4GB, but I want the new
>one to be the sole hard drive in the computer.  Right now I have the 4
>as /dev/hda and the 40 as /dev/hdb.  The 4 has three partitions;
>/dev/hda2 is swap, so it doesn't matter.  How can get all the info on
>/dev/hda1 to be on /dev/hdb1 and /dev/hda3 to be on /dev/hdb3?
>
>I was reaching for dd, a command I'm a little unfamiliar with, but
>then I got to wondering about the filesystem underneath.  Would 'dd
>if=/dev/hda1 of=/dev/hdb1' work?  Should I already have a filesystem
>on /dev/hdb1 or no?  The man page doesn't help on this issue.

If you already have the 40GB drive partitioned and formatted the way you
want, then the quickest way to do this is boot the system from either
Knoppix or a rescue CDROM and then just copy everything over. You can use
the rescue CD or Knoppix to do the partitioning and formatting. Be aware
that in Knoppix you must remount the destination as Read/Write as noramlly
it's mounted read-only. Then just copy everything over, something like this:

cp -av /mnt/hda1/* /mnt/hdb1/

This uses the archive mode of the cp (copy) command to preserve all your
ownerships, times, etc.

Once you are done copying everything, you will need to install your
bootloader. You should probably put the hard drives in the order in which
you are going to use them at this point, either remove the 4GB drive, or
swap the two drives. One way to install the bootloader is to boot the
system with the rescue disk or Knoppix and then do a chroot. For example,
assume you have changed your system and now have only a single 40GB hard
drive, hda. Using Knoppix, boot the system off the CDROM. Run "mount". It
will probably tell you that /dev/hda1 and /dev/hda3 are mounted on
/mnt/hda1 and /mnt/hda3 respectively. Since hda1 holds /boot, you will need
to remount it at /mnt/hda3/boot. If you were to look at the filesystem with
respect to /mnt/hda3/ and lower (deeper into the directory tree) you will
realize you have a full system there. Now from a command prompt you can
chroot to that directory and then run the bootloader install command,
something like this:

# umount /dev/hda1
# mount /dev/hda1 /mnt/hda3/boot
# chroot /mnt/hda3
# grub-install /dev/hda

>From there you can reboot the system,  and it should bring you up on the
new hard drive.

Gus


-- 
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-list

Reply via email to