Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Message from discussion copying entire dual-boot hard drive
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Douglas Mayne  
View profile  
 More options Feb 17 2006, 10:36 am
Newsgroups: comp.os.linux.misc
From: Douglas Mayne <d...@localhost.localnet>
Date: Fri, 17 Feb 2006 08:36:01 -0700
Local: Fri, Feb 17 2006 10:36 am
Subject: Re: copying entire dual-boot hard drive

On Fri, 17 Feb 2006 03:31:49 -0800, nmdc69 wrote:
> Hi folks,
> I have a hard drive (200Gb 7200rpm  Maxtor) that I'd like to copy onto
> another drive (200Gb 7200rpm WD). The Maxtor hard drive has several
> partitions, with Windows XP and Linux installed, and GRUB. I have a lot
> of programs installed and I want to maintain everything exactly as is.

> Is there an easy way to copy everything?

> thanks.

This is quite easily done (if you know what you're doing.)  You could also
review this HOWTO: http://www.tldp.org/HOWTO/Hard-Disk-Upgrade/

The method below isn't the only way, but this is what I'd do.

DISCLAIMER: Verify all commands are appropriate for your system
before proceeding. You are responsible for any command you issue on your
system. All commands require root user access (where great damage can be
done.) BE CAREFUL! Any improper commands could destroy your existing
system!

Substitute values appropriate for you system in the examples shown
below. I will assume that your existing disc is hda, and your new disc is
hdb.

Steps:
0. Build a table on paper showing the layout of the first disc.  That
is how the second disc should look when you are done.  Fix the table below
according to match your system.

Partition       Used for       Filesystem  Size or %       Comments
---------       -----------    ----------  ----------      --------
MBR             boot loader                512 bytes
1               XP             NTFS        ?
2               root           ext2        ?
3               extended                   ?
5               swap           swap        ?
6               ?                          ?
7               ?                          ?
:               :                          :

1. Use fdisk to create matching partitions on the target disc.
You can match the partition sizes exactly because the discs are
exactly the same size.

2. Format the linux partitions using the filesytem of your choice. Ignore
Windows partition for now.  Create any swap partition with mkswap.

3. Make mount points for all target partitions and mount. You can omit
mount points for any NTFS paritions.

example:
mkdir /mnt/hdb1
mount /dev/hdb1 /mnt/hdb1

4. Prepare to copy each linux partitions.  Assuming you are working
directly with the system to be copied (i.e. it is mounted as the root
filesystem) this requires a little more work. If you were to boot into
a live CD, then this is even more straight-forward (and a little
more accurate), but assuming you don't have a live CD and you are
satisfied that this method will be accurate enough you can proceed.

4.a. Select which top level directories will be backed up.

Begin with a total listing of all directories at the root:
(cd / && find . -type d -maxdepth 1) >~/dirs

This list is too big, so edit it manually to omit directories which you
don't want (/mnt, /proc, /sys, /lost+found, and anything else you know
which conflicts).  Known conflicts are paritions which are
mounted as directories (some candidates: /boot, /home, /usr). Check fstab
to see how disc is mounted. Save list with entries deleted.

4.b. Use the cut-down list (~/dirs) to start building a copy of the
existing root.

SOURCE=/
DEST=/mnt/hdb2
(cd $SOURCE && tar -cpf - -T ~/dirs) | (cd $DEST && tar -xvf -)

4.c. Recreate omitted entries.

example:
DEST=/mnt/hdb2
(cd $DEST && for i in mnt proc sys;do
mkdir $i
done)

The for-list would also include /home, /usr or anything else you omitted
(except lost+found).

4.d. Copy any partitions mounted as a directories

example:
SOURCE=/home
DEST=/mnt/hdb6
(cd $SOURCE && tar -cpf - .) | (cd $DEST && tar -xvf -)

4.e. Copy windows partitions.  FAT32 partitions can be copies using the
method in 4.d.  NTFS partitions can be copied using ntfsclone.  You can
get the source code for ntfsclone here:
http://prdownloads.sourceforge.net/linux-ntfs/ntfsprogs-1.12.1.tar.gz

You would copy _each_ NTFS partition to the target partition using
something like this:

SOURCE=/dev/hda1
DEST=/dev/hdb1
ntfsclone -O $DEST $SOURCE

5. Fix grub loader.  Assuming grub is installed at the MBR and all of
your partitions have been copied, it's easiest to use the grub shell.
Again, assuming your grub is on your root partition (hda2) and was
copied to (hdb2), then proceed as follows:

# grub
grub>root (hd1,1)
grub>setup (hd1)
grub>quit

If no errors were reported on "setup" you should be alright.

6. All done. Reward yourself with a nice beverage.

--
Douglas Mayne


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google