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

Re: cloning hard disk



On Friday 18 February 2005 08:21 am, you wrote:
> On Thu, Feb 17, 2005 at 02:38:07PM -0700, Allasso Travesser wrote:
> > On Monday 14 February 2005 04:56 am, you wrote:
> > > On Sun, Feb 13, 2005 at 09:12:35PM -0700, Allasso Travesser wrote:
> > > > Hello,
> > > >
> > > > I would like to clone my Debian Woody system onto a second larger
> > > > hard disk. It seems to me that it would just be a matter of cleaning
> > > > off the second disk, partioning using fdisk, and then running:
> > > >
> > > > dd if=/dev/hdc of=/dev/hda
> > > >
> > > > where hdc is the drive from which I am copying my current system, and
> > > > hda is the drive I want to put this system on.
> > > >
> > > > current hdc partition table (2 Gb disk):
> > > >
> > > > 	Device Boot	Start	End	Blocks	 Id System
> > > >      /dev/hdc1		    1	 13      52384+    83 Linux
> > > >      /dev/hdc2                   14      449   1757952     83 Linux
> > > >      /dev/hdc3                 450      523     298368     82 Linux
> > > > swap
> > > >
> > > > How I plan to partition hda (30 Gb disk):
> > > >
> > > > 	Device Boot	Start	End	Blocks	 Id System
> > > >      /dev/hda1		    1	 13        52384    83 Linux
> > > >      /dev/hda2                   14    3704   29647957+  83 Linux
> > > >      /dev/hda3                3705     523       298368    82 Linux
> > > > swap
> > > >
> > > > Can anyone see anything wrong with this, or would you tell me
> > > > anything I should watch out for? Anything I should find out about my
> > > > current system first? It seems that this could be fatal if it is not
> > > > done right.
> > > >
> > > > Thank you, Allasso
> > >
> > > Hi Allasso,
> > >
> > > I was in a similar situation (not for cloning but in order to make
> > > backups), and I chose another approach which also should work for you.
> > > First, you 'init 1' to go to single user mode, a thing which I don't
> > > bother with for my backups, and then I do an rsync of all the
> > > partitions I need to backup. I also went through this procedure in
> > > order to clone a system, so it _does_ work. Just make sure to use
> > > 'rsync -ax' ('a' for archive and 'x' to stay within the current file
> > > system.
> > >
> > > Now to the reasons why I chose rsync over dd for this method. First it
> > > allows for an easy re-run (only needed for backup purposes), but more
> > > importantly, you don't have to care about partition sizes, e.g. what
> > > happens if you dd your hdc2 to hda2? I remember doing a dd for
> > > cloning and running into problems because of this.
> > >
> > > Anyway, just my 0.02 Euro
> > >
> > > Andreas
> >
> > Hello, Andreas,
> >
> > I just wanted to let you know I haven't ignored your suggestion. The
> > suggestions I have gotten so far are a bit over my head, and so it will
> > take a little time for me to work through them. I don't really understand
> > rsync, and I'd like to put in as much as I can without burdening you
> > folks with a bunch of tedious questions.
> >
> > Also, I am in the middle of a project right now, and I am loath to do
> > anything that would risk breaking something. Besides that, I am finding
> > other problems that need to be worked out first. eg, I have been booting
> > my 2 Gb disk (hdc) from LILO which is on hda. (I have RedHat 8.0 on hda,
> > and want to replace it with my current debian system). I discovered that
> > when I unplug the RedHat drive, and plug my debian drive into the hda
> > port, I cannot boot up. Right now is not a good time for me to find out I
> > can't boot anything.
> >
> > BTW, Is what you are suggesting going to end up with a stand alone system
> > that I can boot off of? That is what I am trying to do.
> >
> > I am replying to you right now off of the list to not burden it down with
> > non-technical courtesies. I'll reply to the list when I have explored
> > some of the things suggested.
> >
> > Thanks again,
> >
> > Allasso
>
> Hi,
>
> I can understand that cloning your system seems a little bit daunting...
> especially if you have your project at risk!!!
> Let me sum up your setup, just to get the facts right:
>
> /dev/hda:	RedHat
> /dev/hdc	Debian
>
> For swapping disks:
>
> If Lilo is installed from within RedHat, you will have to install the
> Debian package as well, and to use the same lilo.conf setup as from
> within RedHat. Now you should have the same system as before, but with
> lilo having been installed from the Debian system. Now you can swap the
> disks and boot either with the Debian install/rescue disk (don't forget
> to append root=/dev/hda1 (if that's your root partition)), or you can
> boot Knoppix and do a chroot /dev/hda1 after you mount it. At this point
> you need to adjust the /etc/lilo.conf of the debian system to reflect
> the fact that Debian is now /dev/hda and there is no RedHat any more -
> or it is /dev/hdc now... These changes work both with the Rescue CD and
> the Knoppix boot method. Run lilo and you _should_ be set!!! For proper
> functioning all that is left is to adjust your /etc/fstab.
>
> Now to cloning the system:
>
> First off, I'd say that this is the more dangerous approach. With the
> above method of swapping disks, you remove your RedHat system untouched
> and then you do the magic with the Debian system, which is also not
> really dangerous in the sense that you your system will become
> unbootable only temporarily even in the worst case.
>
> Now with cloning, you take a step of overwriting your data on /dev/hda
> with the one on /dev/hdc. If you hose it, RedHat is gone. I personally
> have used the rsync approach to clone a system, but with somewhat
> different parameters - let me explain.
>
> \begin{story}
> I had my system in Uni which I used for daily work. From Uni-scrap, I
> built a second machine which I, the lazy bugger that I am, I wanted to
> clone as the fastest method for setting it up. So I booted the scrap
> machine with knoppix, and set up networking. Then I mounted  the
> root-partition-to-be on scrap machine e.g. /mnt/newroot/, and from scrap
> issued:
>
> rsync -ax root@workstation:/ /mnt/newroot/
>
> This fetches all files from the root partition (with rights of root, for
> all the passwords etc) and puts it on the root partition of the scrap
> machine (which, as it's running from Knoppix is only a data partition
> for the moment). Afterwards, there is some stuff like lilo and fstab
> left, plus networking, as this was a different machine.
> \end{story}
>
> so for you, there should be something like:
>
> rsync -ax /dev/hdc1 /dev/hda1 # to clone the root partition
> rsync -ax /dev/hdc2 /dev/hda2 # to clone the home partition
>
> Again, this should be done from within Knoppix (I don't know if the
> rescue part of the Debian CDs is sufficient to do this, you just need
> the rsync command). Don't forget to install lilo on Debian beforehand
> and to adjust and run it from within a chroot environment, i.e.:
>
> chroot /dev/hda1
>
> from within Knoppix after you have cloned. Also remember to change
> fstab!
>
> And most importantly: go slowly and do backups, read the man pages
> first. Sorry for being a bit lengthy.
>
> Let me know how it worked out!!

quote:

"Sorry for being a bit lengthy"

Nooooooo problem. Thank you for being so verbose.

I won't be able to get to it right away, but, Lord willing, I will let you
know my progress.

I am very appreciative of the willingness and patience of you and others to
help.

Allasso

-------------------------------------------------------



Reply to: