LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 05-23-2004, 12:50 AM   #1
some_cs_student
LQ Newbie
 
Registered: Apr 2004
Posts: 14

Rep: Reputation: 0
Copying a windows or linux install to a new hard disk using linux....


Hi everyone,

I've being searching around but haven't found the kind of simple solution I'm looking for...

Anyway, I'm fairly unix/linux savvy, but I've never worked some things out.

For example, say I have a windows install and want to copy the entire install with programs and everything to a new harddisk, I could format/partition the new hard disk and then copy all the files from the old ahrd disk to it...

But the new hard disk would not have a new MBR which would automatically boot windows, how could I fix this?

I can think of some things but don't know if they'll work, install grub onto the hard disk (and use its chainloader +1 option, will that work?). But then where will the grub files sit? I would need an ext2 partition or something where grub can live....(right?).

Or copy the MBR from the old hard disk to the new harddisk, using say dd...

Or is there a way to copy the entire partition across to the new hard disk and resize it (ie. if the partition table was copied its going to be sized wrong isn't it)?

These questions would be quite identical for a linux based system, I could boot say using knoppix and have both hard disks recognised and do things that way....

I apologise if this has being asked but after 40mins of searching I couldn't find anything.

Please respond if you have some ideas,

Also note: I'm aiming to do this with free software...

Regards,
Gareth
 
Old 05-23-2004, 03:57 AM   #2
phase9
Member
 
Registered: Mar 2004
Location: austria, vienna
Distribution: slackware-10.2
Posts: 89

Rep: Reputation: 15
Hi
copying a linux partition to a new hd should be no problem (when using lilo).

* start your computer from a rescue disk (or a second linux installation, when available)
* mount your partitions to something like /old-part/ and /new-part/
* copy the root directory with:

# cp -r --preserve /old-part/./ /new-part/

* edit /new-part/etc/lilo.conf and /new-part/etc/fstab according to your hd/partition layout
(or /new-part/boot/grub/grub.conf)
* run:

# /new-part/sbin/lilo -r /new-part/
This will write lilo to the mbr of your new hd.


When using grub, copying the first 446 bytes (=the boot loader code of your old hd, not the complete mbr (=512 byte, which contains the partition table) with dd to your new hd may work.

To save the complete mbr of /dev/hdx:

# dd if=/dev/hdx of=/path/mbr-backup bs=512 count=1

To restore the first 446 byte (boot loader code) to hdy:

# dd if=/path/mbr-backup of=/dev/hdy bs=446 count=1

Last edited by phase9; 05-23-2004 at 05:12 AM.
 
Old 05-23-2004, 04:38 AM   #3
some_cs_student
LQ Newbie
 
Registered: Apr 2004
Posts: 14

Original Poster
Rep: Reputation: 0
Thumbs up

Hmm...

Definitely an interesting idea, thanks a lot of that.

Now another question, what if it was a pure windows box (ie. no linux).

Would the copy the first 446 bytes work?

Or would I need to install a bootloader and create a partition for it?

Regards,
Gareth
 
Old 05-23-2004, 05:23 AM   #4
phase9
Member
 
Registered: Mar 2004
Location: austria, vienna
Distribution: slackware-10.2
Posts: 89

Rep: Reputation: 15
Hi

With windows, there is no need for dd,... To write a new (windows) mbr, simply do the following:

Use a DOS Bootfloppy or a Windows 9x/ME Start Disk and type at the prompt:

A:\> fdisk /MBR


Or, use the Windows 2000/XP CD-Rom to start the computer. At the "Welcome to Setup" screen, press <F10> or press <R> to repair, and start the Windows Recovery Console.
Use the fixmbr command to replace the master boot record. This will leave the existing partition table intact.

C:\> fixmbr



Quote:
For example, say I have a windows install and want to copy the entire install with programs and everything to a new harddisk
I can't say, if copying a windows partition to another hd will work. I believe windows (in contrast to linux ) stores some file in raw data (registry,...) on the hd. If this is right, a simple copy will not work. Maybe this can be accomplished with dd, but I can't say for sure.
 
Old 05-23-2004, 11:21 PM   #5
some_cs_student
LQ Newbie
 
Registered: Apr 2004
Posts: 14

Original Poster
Rep: Reputation: 0
Hi,

But if the registry is raw data, wouldn't copy work?

Or does the position of the data mattter?

Regards,
Gareth

Thanks a lot for the help so far.
I know there are a lot of commercial tools for copying windows to a new hard disk, but I'm not quite sure how they work (trying to work out if I can do it simply, without buying software).

Also the linux thing was curiosity, now I know that its possible, thanks!
 
Old 05-24-2004, 11:35 AM   #6
phase9
Member
 
Registered: Mar 2004
Location: austria, vienna
Distribution: slackware-10.2
Posts: 89

Rep: Reputation: 15
Hi

Windows Registry

I have read this in a computer magazine, but I can't say if it is correct. Some of the files, where the position of the data matters, are MSDOS.SYS and IO.SYS.
But, if a simple "copy" would work, what about all those commercial "data rescuing programz"?
And that's another reason for me why to use linux: there is no need for commercial programz.
 
Old 05-24-2004, 01:14 PM   #7
camelrider
Member
 
Registered: Apr 2003
Location: Juneau, Alaska
Posts: 251

Rep: Reputation: 32
I'm not sure if this is what you need but it's probably worth a look.

http://www.partimage.org/
 
Old 05-24-2004, 07:17 PM   #8
some_cs_student
LQ Newbie
 
Registered: Apr 2004
Posts: 14

Original Poster
Rep: Reputation: 0
Hi,

Certainly looks intersting.

Thanks a lot for that, yes I guess copy wouldn't pay attention to the way it writes the data, while something like DD would.

But DD might get messy, I was just checking that there wasn't a really simple solution to this....

(cos often linux does have solution's where it takes commercial programs in windows).

Thanks for the help.

That partimage looks useful.

Regards,
Gareth
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Install Linux on Windows and Partition Hard Disk sgaum Linux - Laptop and Netbook 1 03-02-2005 10:59 PM
More than 32 GB hard disk, should be writable from Linux and readable from windows inditrozen Linux - Hardware 5 08-17-2004 03:42 AM
How do I install Linux on one hard disk and XP on other? andyri Linux - Newbie 1 07-28-2004 05:36 PM
Linux and Windows XP on same Hard Disk Breault Slackware - Installation 5 01-29-2004 01:11 AM
having more than 1 windows version along with linux in one hard disk vijay21gomes Linux - Newbie 0 07-16-2002 03:29 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:11 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration