Linux - HardwareThis forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices

Welcome to LinuxQuestions.org, a friendly and active Linux Community.

You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!

Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.

If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.

Having a problem logging in? Please visit this page to clear all LQ-related cookies.

Introduction to Linux - A Hands on Guide

This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.

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.

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

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.

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

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.

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.