[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Copying Debian to another drive

jb701@uku.co.uk wrote:
> I have Debian sarge loaded and running fine on a Thinkpad (laptop).  I now 
> want to copy my setup onto another hard drive, so I can try some things out 
> without ruining this setup (which took a lot of effort to get running).  
> How do I go about doing that?  The laptop can only run one hard drive at a 
> time. I can connect to another Debian machine (running woody).  The laptop 
> started with woody (same CDs used as the other machine) and I think I kept 
> all the downloaded deb files used to upgrade.  Is there any way to copy the 
> setup rather than setting up a new hard drive from scratch? 

I do that all of the time.  It is my preferred install method.  I boot
a live cd image.  The only real requirement is to get both machines on
a network at the same time.  Use either Knoppix or DFS or whatever to
boot the new machine.

Partition the drives as you wish them to be partitioned.  Then mount
them.  Here is a quick synopsis.  You will need to customize for your
purposes.  But this should be enough to get the idea.

  mkfs -t reiserfs /dev/hda5
  mkdir /target
  mount /dev/hda5 /target

Then rsync the entire system from the original laptop to the new
laptop.  A command like this:

  rsync -av --numeric-ids --exclude /proc --exclude /sys root@orig:/ /target/

That will use 'ssh' to connect and copy the entire other system to the
new system.  We excluded /proc and /sys in the copy.  Make sure to
create those directories.  When that is done you can reboot into the
new system.  The trick is to get the new system booted.  You can do
this many ways.  I prefer grub.  This is where the DFS bootable live
image is nice.  It has a grub loader.  Tell grub to boot the other
disk.  Then install grub from the running system on the main disk.
Assuming DFS and grub, use the DFS disk to boot from cdrom and then
use it to boot to the system on the hard drive that you just copied
over there.  Example:

  root (hd0,4)
  kernel /boot/vmlinuz-2.6.8-10-686 root=/dev/hda5 ro
  initrd /boot/initrd.img-2.6.8-10-686

Of course the version numbers and partition numbers must match your
systems.  After booting run 'grub-install /dev/hda' and you should be
set.  I have done this many times and it works quite well.  Of course
this is all from memory and I fear I may have forgotten something in
recalling it here.


Attachment: signature.asc
Description: Digital signature

Reply to: