LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices

Reply
 
Search this Thread
Old 08-28-2005, 08:20 PM   #1
jlinkels
Senior Member
 
Registered: Oct 2003
Location: Bonaire
Distribution: Debian Lenny/Squeeze/Wheezy/Sid
Posts: 4,053

Rep: Reputation: 484Reputation: 484Reputation: 484Reputation: 484Reputation: 484
Problem booting Windoze after disk clone


I have a Compaq Deskpro PII-450 and had to install a bigger hard disk. I don have problems with booting in general, or with GRUB. I have a reasonable understanding of the booting process. I just cannot boot Windows after I copied it from the old disk to the new one.

The old hard disk is a 9.1 GB SCSI. I have Win2k installed on in, and Debian Sarge. Debian was installed after Win2k, and I let Debian install GRUB in the boot sector. Never any problem.

When there is only one SCSI disk in the machine, it is treated as an IDE. That is, in the Win2k boot.ini, it says:
multi(0)disk(0)rdisk(0)partition(1)\WINNT="Microsoft Windows 2000 Professional"
This is perfectly correct.

Debian boot sector is on the 2nd partition, and is stated correctly as /dev/sda2.

I installed a second hard disk, 40 GB IDE. Compaq wants to boot from this disk as it is the first hard disk now. As expected.

Now the original installation is on the second hard disk (/dev/sda) and the clone has to be on the first hard disk (/dev/hda). Because I could not boot anymore as soon as I installed the IDE, I used Knoppix.

This is what I did to copy the old disk to the new one:

Created a partition on /dev/hda using fdisk. The partition was created exactly equal to the partition on /dev/sda using sector numbers.
Copied the first 446 bytes usind dd if=/dev/sda of=/dev/hda bs=446 count=1
Copied the /dev/sda1 partition to /dev/hda1using dd if=/dev/sda of=/dev/hda bs=512
When I booted, the machine hung after displaying GRUB in the upper left corner. OK, this was because the boot loader was not fully installed.

So I installed Debian on this hard disk from the net installer CD. I let Debian find out what else was there in the system.
It found:
- the Linux installation on /dev/sda2
- the Windows installation on /dev/sda1
- the Window installation on /dev/hda1

Now the funny thing is that I can NOT boot into Windows on /dev/hda1!

Grub is pointing to the right disk hd (0,0) This is the whole stanza:
title Microsoft Windows 2000 Professional
root (hd0,0)
savedefault
makeactive
chainloader +1

The machine hangs after displaying "chainloader +1"

Booting in Linux is OK. I can boot into Linux in both the old and new hard disks.

Surprisingly (something half of the world has a problem with) I can boot into the OLD windows installation on /dev/sda1 by using
swap (hd1,0) (hd0,0)
swap (hd0,0) (hd1,0)

Something more I did:
I copied sector 1-62 from the old disk to the now one - no
I copied sector 0 entirely from the old disk to the new one -no (This obviously screw up the partition table, but since Windows partition was still on exactly the same location as on the old disk that did not matter. Later I restored sector 0)
I copied the entire 9 GB disk onto the new one, sector by sector using dd - no
Windows would still hang at "chainloader +1"

I even checked with a hex editor that ntldr starts in sector 63 on both disks. The first 63 sectors are identical, and so is sector 63 where ntldr resides.

Now what in the world witholds this machine from booting? Did Windows write some secret code somewhere which makes it different that it boots from an IDE instead of a SCSI?

I could have installed Windows, but (a) I lost my original (!!) non-copied installation CD in the course of the years and (b) I cannot stand this.

jlinkels
 
Old 09-03-2005, 10:59 AM   #2
aus9
Guru
 
Registered: Oct 2003
Posts: 5,056

Rep: Reputation: Disabled
some cloning questions and comments

1) How did you clone the small drive to the second drive......if you did not do a byte for byte you missed out the hidden sector that windows likes to use?

2) do not change anything on the small drive but recopy the full mbr to the big drive

dd if=/dev/sda of=/dev/hda bs=512 count=1

then you have the wrong mbr on the new drive.....heh heh
now redo the link so grub is linked to the old drive as its currently on drive 2 linked to drive 2 booting files
then reboot and see what happens.

btw the second drive, the old one should boot the big drive MS with your first stuff but you can add a new entry
title MS drive 2
root (hd1,0)
map (hd1,0) (hd0,0)
map (hd0,0) (hd1,0)
makeactive
chainloader +1

using a knoppix cd as per my signature is a lot easier report back if any problems
 
Old 09-03-2005, 08:30 PM   #3
jlinkels
Senior Member
 
Registered: Oct 2003
Location: Bonaire
Distribution: Debian Lenny/Squeeze/Wheezy/Sid
Posts: 4,053

Original Poster
Rep: Reputation: 484Reputation: 484Reputation: 484Reputation: 484Reputation: 484
Quote:
1) How did you clone the small drive to the second drive......if you did not do a byte for byte you missed out the hidden sector that windows likes to use?
I used
dd if=/dev/sda of=/dev/hda bs=4096
and
dd if=/dev/sda of=/dev/hda bs=512
(not at the same time obviously, these were to different attempts)

I might missed the hidden sector, I did not know about it, perhaps that is why it is called "hidden".
I DID copy ALL first 63 sectors though. If the hidden sector is not there and not on the first partition, I missed it.

Quote:
2) do not change anything on the small drive but recopy the full mbr to the big drive dd if=/dev/sda of=/dev/hda bs=512 count=1
Linux boots correctly from the old (smaller) drive.

Quote:
btw the second drive, the old one should boot the big drive MS with your first stuff but you can add a new entry title MS drive 2 root (hd1,0) map (hd1,0) (hd0,0) map (hd0,0) (hd1,0) makeactive chainloader +1
I tried that, and Windows booted from the old drive. But I don't want to keep the old drive, since it is very noisy.

Quote:
using a knoppix cd as per my signature is a lot easier report back if any problems
I know, this is what I used to do the copy the first time when I hadn't yet installed Linux on the bigger drive. The system does not boot with both drives in whithout Linux installed on the new drive. It is a great program.

UPDATE:
While fdisk did not complain about disk geometry, sfdisk did. It said that the small disk was partititioned using x/255/63 geometry and the large one y/16/63 geometry. I though this could be a clue. So I nuked the partition table, and created a new one with sfdisk, this time with the correct geometry. Then I did all the copying again, mbr and windows. Didn't work.
Needless to say Linux survived the wiping and recreation of the partition table without problems.
 
Old 09-04-2005, 12:19 AM   #4
aus9
Guru
 
Registered: Oct 2003
Posts: 5,056

Rep: Reputation: Disabled
according to my maths you have cloned 4 Kb of the old drive onto the new.
bs=4096 divide by 1024 = 4 Kb

9.1G is a rounded number you need to find its bs or ks
but as a rough guide telling you how to suck eggs
9.1 x 1024 x 1024 x 1024 = bytes

man dd gives some info
Hard drive manufacturers cheat so a 80G drive is actually 80 x 1000 x 1000 x 1000 bytes

and normally if you are still talking to me heh heh you set the size of blocks such as 4Kb then give a count of how many blocks to copy so it may be more like

dd if=/dev/sda of=/dev/hda bs=4096 count=2385510 ignoring my poor maths as well
 
Old 09-04-2005, 12:43 AM   #5
aus9
Guru
 
Registered: Oct 2003
Posts: 5,056

Rep: Reputation: Disabled
Now to be nicer, I should suggest an easier way to clone? I am guessing you have a burner?
if you have 1G of ram you can load knoppix toram and to use knoppix k3b otherwise you reload deb to burn images

1) load knoppix and create one partition on big virgin drive using qtparted then format it as reiserfs
if you like commands its
mkfs -t reiserfs /dev/hda1

2) use knoppix partimage to save images of your old partitions and images are saved to new drive like this
su
mkdir /new
mount -t reiserfs /dev/hda1 /new
partimage.........
files to be saved as
/new/msp1 /new/msp2 etc /new/debp1 /new/debp2 etc
3) boot into deb or use knoppix k3b to burn images to cdr or dvd
with the split feature if image too big for cdr if thats all you got.
4) in knoppix redo qtparted with bigger partitions on the new drive with one a bigggg spare for shared data
5) load from the cdr/dvd images to that new shared data AFTER mounting it eg
mkdir /images
mount -t reiserfs /dev/hda12 /images
6) run partimage to restore images and put them into the new partitions
7) run qtparted again if you want to format eg hda12 as a fat etc
8) run knoppix su grub commands to put grub into mbr and link it to the new partitons

if you are tight for space the images can be saved to an existing partition that has free space.
tell me if I am missed something
 
Old 09-04-2005, 11:26 AM   #6
jlinkels
Senior Member
 
Registered: Oct 2003
Location: Bonaire
Distribution: Debian Lenny/Squeeze/Wheezy/Sid
Posts: 4,053

Original Poster
Rep: Reputation: 484Reputation: 484Reputation: 484Reputation: 484Reputation: 484
Quote:
according to my maths you have cloned 4 Kb of the old drive onto the new. bs=4096 divide by 1024 = 4 Kb
If you don't give a count, dd continues to copy until it copied the entire input file DUH!

Of course I made sure that all 4.398.798.897 bytes of Windoze partition were cloned.

But...

Thanks for still being with me. I did not try the partimage solution yet. It might help, since partimage maybe operates on a higher level than dd.

It'll take a few days before I have time to do it, but I'll do, and let you know the results. It is an interesting problem, isn't it?



jlinkels
 
Old 09-25-2005, 01:15 PM   #7
elh
LQ Newbie
 
Registered: Sep 2005
Location: Piotrkow, Poland
Posts: 1

Rep: Reputation: 0
Hasn't all this got sth to do with windows anti-piracy protection, activation and stuff?
I know it's win2k but in XP I've had tons of problems with it.
I remember having WinXP Pro and it would ask me to re-activate all the time (I upgraded a lot at that time), so I patched it, which I suppose wasn't very righteous, but it solved the problem and I had the license anyway.
Then came the time to upgrade the hard disk, I used Norton ghost to copy the entire disk from 80GB to 160GB (same manufacturer and series - WD pATA 8MB cache etc), I believe there even is a tutorial for just that. Copying went fine, so I unplugged the old disk and placed the new one as primary master. Windows started booting but at some point it would present some blueish background with logo and stopped there.
So I checked the boot.ini to see if ghost didn't change anything, it was all right. I tried some more trick like copying only the partition etc, but finally I gave up and reinstalled Windows on the drive from scratch.
One reason I gave up was that I could expect support for an illegally patched version, I also blamed it for the malfunction, but browsing the web lately, I am inclined to think that it wouldn't work anyway.
I've read about problems cloning pata->sata etc so this might be the same with moving SCSI->ide, parhaps you have to force the ata driver installation before the cloning?
I honestly can't give better advice than to avoid windows and perhaps only run it in a vmware environment.

elh
 
Old 09-25-2005, 06:13 PM   #8
jlinkels
Senior Member
 
Registered: Oct 2003
Location: Bonaire
Distribution: Debian Lenny/Squeeze/Wheezy/Sid
Posts: 4,053

Original Poster
Rep: Reputation: 484Reputation: 484Reputation: 484Reputation: 484Reputation: 484
elh,

Of course I am not *sure* but I don think it has something to do with copy protection, but it is unlikely. Windoze has not booted yet at that moment, and I don expect that MS checks these signatures before booting. I expect them at least to boot and tell you what is wrong. I also have read that you need to change multiple hardware components before XP needs to be re-registered.

All the experience that I have is with W2k, and I was pretty good at it a few years ago. Never saw any trace of copy protection. I never worked with XP, when that was released, I swore that I would never use it, and so I didn't. I am not even able to start a program in XP, I cannot find where the crap is.

The only reason that I want this machine to mulit-boot is because someone else, a real Windoze addict has to use this computer a number of times a year, and I don want to take the effort to try to make him interested in Linux, and then explain why he cannot install Kazaa.

Hey.. my son's name is Grep... I don't have to move away from Windoze anymore

Back to the problem:

The ATA driver was loaded at the time of loading, because at least during one attempt I booted Linux from the ATA disk.

Aus9: I have been using partimage to do what you suggested. I did not use exactly the drives and DVD's you suggested, but I did the partitioning and used partimage to put the partition image exactly where I wanted to have it. I used grub-install to install the boot loader. With and without the --force-lba option.

The result is exactly NIL.

I give up. Although I hate it, I'll use the W2k disk to re-install Windoze, and then Linux.

Thanks for all the advise. I someone else has such a similair problem, would you please post it here? Just because I am interested.

jlinkels
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Best Laptop for dual booting Linux w/ Windoze Alasis Linux - Hardware 8 12-24-2008 02:10 PM
Disk Partitioning in Windoze or Linux? Kramer Linux - General 8 11-03-2005 09:19 AM
K3B Disk Copy types: Normal vs. Clone? Bob P Linux - Software 3 10-15-2004 05:40 PM
dual booting SuSe and windoze xp col.kowalski Linux - General 6 09-30-2004 10:19 AM
RedHat 7.2 Booting Problem on new disk jeanetteh Linux - Distributions 1 08-26-2002 03:36 PM


All times are GMT -5. The time now is 08:14 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration