Solved

Lilo doesn't recognize Win98 partition

Posted on 2002-06-05
16
374 Views
Last Modified: 2013-12-15
Hello:
I just went from having two hard drives to having one. My second hard drive was where win98 system was, but I've copied all the files and transferred the system to the windows partition on the first drive and now lilo doesn't recognize (and I can get it to) the windows partition. (Or rather, it won't let me boot from it.)
Here is my lilo.conf file:

boot=/dev/hda
map=/boot/map
install=/boot/boot.b
vga=normal
default=linux
keytable=/boot/us.klt
lba32
prompt
nowarn
timeout=100
message=/boot/message
menu-scheme=wb:bw:wb:bw
image=/boot/vmlinuz
     label=linux
     root=/dev/hda1
     initrd=/boot/initrd.img
     append="quiet devfs=mount hdd=ide-scsi"
     vga=788
     read-only
image=/boot/vmlinuz
     label=linux-nonfb
     root=/dev/hda1
     initrd=/boot/initrd.img
     append="devfs=mount hdd=ide-scsi"
     read-only
image=/boot/vmlinuz
     label=failsafe
     root=/dev/hda1
     initrd=/boot/initrd.img
     append="failsafe devfs=nomount hdd=ide-scsi"
     read-only
other=/dev/hda6
     label=windows
     table=/dev/hda
     map-drive=
        to=0x80
other=/dev/fd0
     label=floppy
     unsafe

My win partition is (obviously) /dev/hda6. When I type "lilo" I get the following:
Added linux *
Added linux-nonfb
Added failsafe
Invalid drive specificateion "to" at or or above line 36 in file /etc/lilo.conf

Can someone help?
Thanks!
0
Comment
Question by:haldrik
  • 6
  • 4
  • 3
  • +1
16 Comments
 
LVL 51

Expert Comment

by:ahoffmann
ID: 7058729
> .. I've copied all the files and transferred the system to the windows partition ..

does this windoze boot itself, without lilo?
AFAIK this cannot work 'cause Windoze knows about the physical drive/partition where it is installed.
0
 

Author Comment

by:haldrik
ID: 7060288
So is my only option to reinstall windows? (assuming I can even do that...)
0
 

Author Comment

by:haldrik
ID: 7060889
OK, I fixed the obvious error in line 36. (changed to : map-drive=0x80  to=0x81; map-drive=0x81   to=0x80.
The error I get is: "Fatal: Partition entry not found"

The terrible thing is that booting to dos floppy results in NO HARD DRIVE at all being found. Linux can access the drive, but can't boot to it.

Someone please help!
(reinstalling win98 really isn't an option, since I have the upgrde cd, which requires win98 to be able to find windows inthe first place!)

0
 

Expert Comment

by:0xDEADBEEF
ID: 7061651
Wait a second, as far as I know Windows 98 only installs to /dev/hda1 - how'd you get it on /dev/hda6?
In case you just copied the files, there's a boot sector missing, so windows naturally can't boot.

Usually, when installing linux and windows for multi-boot, you first install linux, but leave /dev/hda1 (and any other partition you want to use w/ windows) blank, then install windows. Windows will install to /dev/hda1 and overwrite the MBR, so you have to boot linux from CD and install lilo to the MBR.
After that, everything should work fine.

Hope this helps.
0
 

Expert Comment

by:0xDEADBEEF
ID: 7061656
The upgrade CD makes things more complicated...Do you have an old DOS you can upgrade from?
0
 

Expert Comment

by:0xDEADBEEF
ID: 7061670
The upgrade CD makes things more complicated...Do you have an old DOS you can upgrade from?
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 7061892
the map-drive keywords in lilo.conf tweak lilo to find the disk (which is connected somehow).
But it won't boot Windoze 'cause you copied it (see my very first comment)
0
 
LVL 1

Expert Comment

by:jsnorman
ID: 7063332
You have "map-drive=0x80  to=0x81; map-drive=0x81   to=0x80"

That is cute, but won't work.  You have outsmarted yourself.  You have basically instructed LILO to reverse the first and second hard drive mappings.  But now you only have one drive!!!  The map-drive command will not solve the problem of mapping PARTITIONS among drives which is what you really are trying to do.

You have two problems:  LILO and Windows.

First, LILO.

Your lilo.conf file should be simple.  It should look like this for the windows boot section (forget the table and map entries, they do nothing for windows and LILO certainly doesn't need them):

[clip]
other=/dev/hda6
    label=windows
[clip]

Second, Windows.  You have two problems here -- the windows chainloader, and the windows system drive mappings.  

(a) the windows chainloader may not have been correctly moved over when you copied your partition from one drive to another (the chainloader resides on the beginning of the partition where windows was previously installed).  If you used dd, you are probably okay; if you used a windows drive copy program, probably not okay.  The only way to know if this was preserved is to try installing lilo using the simple lilo.conf, and see what happens.  If lilo boots, but you get something like "boot sector not found" when you select windows, that is your problem.  Go ahead and try this and see what happens and report back.  If you need to repair the chainloader, you are in for a bit of work so I won't go into how to do it here just yet until we know if you have that problem.

(b) if an when you get windows to boot, you will definitely get a new error -- something like invalid system disk.  You may just get the infamous blue screen of death.  This is because windows is looking for its system files on the second drive, in a different partition.  

You will need to force windows to regenerate its hardware tree.  This may not be possible with such a radical drive change (partition and physical drive).  The only way I know of is to somehow access the registry and delete the following keys and reboot to force windows to reenumerate your hardware:
HKEY_LOCAL_MACHINE\enum
HKEY_CURRENT_CONFIG\enum

IF you can boot to safe mode, you can do this (using regedit).  Again, the only way to know if you can even boot to safe mode is to try it.  If you cannot even boot to safe mode, you will have two options: (i) find a third party program that is bootable from a diskette that will allow you to modify the windows registry without booting windows (I do not know if such a thing exists, but it is worth looking for if you are at this point), or (ii) reinstalling windows OVER your existing windows install (without reformatting), which should at least preserve your applications.  

Finally, you will likely still have a drive letter problem, and I think you may also have a problem with Windows being in a logical partition -- I cannot remember for sure, but I was pretty certain that windows requires itself to be in a primary partition (hda1 - hda4). I know there are third party programs that fool windows into putting itself into another partition -- are you using such a program?  If so which one?  If not, you must move windows to a primary partition.  If you are "fooling" windows using a partition mapping program, you will need to make sure that you have that program setup properly so that windows gives itself teh SAME drive letter (presumably, C:) as it had when it was on your second disk.

Given all of the above, and I would agree with others in the thread that, unless you end up being lucky (able to boot windows and reenumerate the hardware, and able to easily move windows to a primary partition) you are probably better off reinstalling.

After trying (a) and if (a) works, then (b), let me know what happens and we can follow up.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:haldrik
ID: 7063548
Thanks for the extremely well thought-out and time consuming response! (Let's hope this doesn't turn out to be a waste of your time!)

Well, I tried option "a" (simple lilo.conf entry) with no real success. When I type lilo, it seems to set up fine, but when I try to boot windows from the lilo screen, I get a black screen saying "Loading windows 98" (or similar) at the top, the harddrive spins for 5 or 6 seconds, then stops and nothing ever happens. Like I said, I am able to boot to a win98 floppy, but I can't access C, or any other letter for that matter): ("invalid drive specification").  If "dos" doesn't even recognize the C drive, I doubt trying to reinstall windows from the CD-Rom would work anyway. Also, even if I found a third party program that would let me do "regedit", wouldn't I need access to the windows partition to edit the file?
(One more thing: If I need to create a new primary partition for win98, will that screw up my linux setup? If that's the choice, I'll forego windows or just buy a new harddrive!)
0
 
LVL 1

Expert Comment

by:jsnorman
ID: 7063913
this resp is abbreviated cause i am typing from my thumbpad on my sharp sl-5000d wireless  ... if you need more det on ony step below, let me know


okay, i am pretty sure that you need to move your windoze to a primary partition first, and then we can work from there

you will not mess up linux if you are careful to modify fstab and lilo.conf to ref your new root at hda6!


basically, you use dd, partitionmagic or a like prog to move your windows part to hda1, linux root part to hda6 and modify fstab and lilo.conf to ref the new linux root at hda6, rerun lilo and viola.  

note that depending on avail space you may need to hook up your second drive temporarily

there are many ways to do this --- safest is:

copy hda6 to a temp part maybe on second disk
copy hda1 to hda6
boot linux from hda1 as usual
mkdir /mnt/troot
mount /dev/hda6 /mnt/troot
modify /mnt/troot/etc/fstab by changing /dev/hda1 to /dev/hda6
modify /etc/lilo.conf and /mnt/troot/etc/fstab by adding a new section to boot /dev/hda6 as root -- this will just be a copy of the current hda1 boot statement with hda6 instead; delete the hda1 boot statement for now
/sbin/lilo
copy your windows part to hda1
boot into linux (now hda6)
now add the simple windows boot section to lilo.conf using hda1 in the other boot statement.
/sbin/lilo again and try it out



boot to your emergency linux boot disk, mount your root part to /mnt/xxx, modify xxx//etc/fstab
0
 

Author Comment

by:haldrik
ID: 7064363
One quick question before I proceed: (I don't have partition magic--I tried downloading a demo, but it's only for windows--So I have to use the dd function you were talking about, or maybe that "Parted -GNu" program?)
If I copy hda1 (ext2) to hda6 (fat32), won't I have to change to parition type? Or am I just copying files? I guess the same question goes for copying hda6 to hda1.
Also, the partitions are not the same size: hda1 is 15 gb (27% full), hda5 (/home) is 7.3 GB 14% full, hda6 (win) is 9.8 GB 37% full  and swap is 5 gb.  Do the partitions have to be the same size? (to copy an ext2 parition w/ Parted-GNU, aparently the two partitions have to be the same size, according to their website).
Also, I've looked up the dd command, and I'm not too confident in the syntax--there are so many options! Could you give an example for the copying back and forth?
Thanks for your help! I've raised the points (which im sure don't mean all that much to you) to 200 anyway.
0
 
LVL 1

Accepted Solution

by:
jsnorman earned 200 total points
ID: 7064612
Yes, you will need to change the partition type.  Personally, I would buy PM as it is a great and useful program for many many reasons (fixes a lot of partition table errors too).

I have never used parted before, so I cannot tell you much -- it may work and it is worth a try if you don't still have your second hard disk laying around.  Parted may be easier and safer than dd -- I found the following which describes copying and resizing partitions:

http://www.gnu.org/manual/parted-1.6.1/html_mono/parted.html#SEC25

But dd will work if you have extra space (maybe a second disk) to temporarily use.

Generally, the partitions should be the same size or else you risk data loss.  I have successfully used dd with mismatched sizes, but it is very very risky (basically, you have to be confident that there is NO data on the last sectors if you are copying a larger to a smaller partition).  Also, I used Partition Magic to fix the CHS values after doing to.

Back to dd.

format is really pretty simple for raw data copyin which is what you want.  

Lets say that you have set up new partitions, /dev/hdb1 and /dev/hdb2, on your second temporary drive (or if you have extra space, anywhere on your first drive) -- for safety, make these partitions exactly the same size as your partitions /dev/hda1 and /dev/hda6 respectively.  

Using the p comamnd under fdisk in linux, determine the number of 512 byte "units" to be transferred.  

NOTE and WARNING:  you will get output like this:

   Device Boot  Start    End    Blocks   Id  System
/dev/hda1   *       1    446   3582463+  83  Linux
/dev/hda2         447   1466   8193150   c   FAT32 (LBA)
/dev/hda3        1467   1594   1028160   82  Linux swap

The "Blocks" reported are most likely 1024 byte blocks (double check this in your system to make sure:  divide the "Blocks" by 1024, and you should get the number of Megs that your partition actually is -- if not we will have to determine exactly how many bytes your partition is in another manner;in that case post the output from fdisk here.  

Also, note taht the "+" above means 512bytes (so, one "block" is 1024, but 1+ block is 1024+512).

Okay, now calculate how many 512byte units are in /dev/hda1 and /dev/hda6 by multiplying the reported blocksize by 2, and adding 1 if there is a +.  Let x=# of 512 byte units in /dev/hda1, and y=# of 512 byte units in /dev/hda6.

your dd commands are:

dd bs=512 if=/dev/hda1 of=/dev/hdb1 count=x
dd bs=512 if=/dev/hda6 of=/dev/hdb2 count=y

Assuming you get no error (it will take a while!!!), then you can proceed to repartition using parted or fdisk.

You need to resize /dev/hda1 and /dev/hda6 so that the respective partition sizes are reversed.  Basically, you will take the larger partition and make it smaller, and then move the free space over to be adjacent to the smaller partition, and then resize the smaller partition to add the new freespace.  I think that parted can actually do this, but again I have never used it so I am not sure.

After you have effectively swapped the sizes of /dev/hda1 and /dev/hda6, you just reverse the dd commands:

dd bs=512 if=/dev/hdb1 of=/dev/hda6 count=x
dd bs=512 if=/dev/hdb2 of=/dev/hda1 count=y

Oh yeah -- it matters not at all what partition type /dev/hdb1 and hdb2 are -- they are just temporary storage and dd works on any partition type.

Finally, as you correctly noted, you will use fdisk to change the partition types on /dev/hda6 and /dev/hda1.  You can then finally discard /dev/hdb

Also, if you decide to buy Partition Magic, it is unfortanately a windows program -- so it will not help you this time.  Once you buy it and get it running though, you can create a boot disk and run it from floppies under dos.  It recognizes and correctly messes with ext2 partitions.


Let me know how it works.
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 7064676
huge explanation of my very first comment (also the first comment in this thread), thanks jsnorman for explaining in detail.
haldrik, did you answer (at least to yourself) jsnorman's questions about copying Windoze?
As long as you cannot boot w98 itself on your disk, any effort with lilo is wasting time.
0
 

Author Comment

by:haldrik
ID: 7064810
ahoffmann:
I copied the files from my original windows hd by dropping and dragging all the files using KDE. Then I booted into windows and did a "sys: d" or something like that to copy the system stuff. I never booted to the drive. I knew that might be a problem, but I assumed I would be able to re-install win98 (upgrade) on the partition and let it recognize all the stuff that's already on the disk. Won't that work after I switch the partitions that the 2 OS's are on?
(Incidentally, I still HAVE the other harddisk--it's just not in this computer).
0
 

Author Comment

by:haldrik
ID: 7064944
Well, I finally got it!
Here's how it finally worked out:
I resized the hda1 partition to about half, and created a new PRIMARY partition in the space left over, because you said it had to be a primary partition. Then using your techniques, I copied the windows partition from hda6 to hda3 (which was the new primary partition). The next time I loaded windows from the floppy, it went through some hard drive recognition for about 5-10 seconds, then suddenly windows loads! (Of course, now there's a C AND a D drive, both identical, but I'll delete D once I'm sure everything is working fine).
Fortunately, I didn't have to move my primary linux partition after all, because it was big enough that I could just shrink it down instead to make room for the new partition.
Thanks a million, you guys are the best!  
0
 
LVL 1

Expert Comment

by:jsnorman
ID: 7065016
Very happy to hear that!  Was worried you might need to regenerate the enum tree in windoze, but looks like you got lucky.

JSN
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now