[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference nlfdc::linux-users

Title:Linux, the Free Operating System
Notice:New here? Sign in on topic 2
Moderator:EST::DEEGAN
Created:Fri Feb 11 1994
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:609
Total number of notes:2862

604.0. "Repairing a partition table." by DECWET::LOWE (Bruce Lowe, DECwest Eng., DTN 548-8910) Sat May 24 1997 00:16

I used to have a 590 running Slakware (Aug 95 distribution, with a 1.3.98
kernel). I lost the machine, but kept the hard disk.

Now I have an old 466d2lp, with an Adaptec 1542, and put in the old disk. I
can boot a aha1542.s floppy, and "mount root=/dev/sda2", and get at my files
OK  (sda1 is a DOS partition, with sda3 = linux swap.

I downloaded the 2.0.28 kernel kit, and built it for my 486, scsi adapter,
net card, etc. But liloconfig would let me install LILO, with "bad partition"
errors.

When I run fdisk, I see this:


Using /dev/sda as default device!

Command (m for help):
Expert command (m for help):
Disk /dev/sda: 64 heads, 32 sectors, 1001 cylinders

Nr AF  Hd Sec  Cyl  Hd Sec  Cyl   Start    Size ID
 1 00   1   1    0  63  32  508      32 1042400 06
 2 80   0   1  509  32  61  997 1024617  984357 83
Partition 2 has different physical/logical beginnings (non-Linux?):
     phys=(509, 0, 1) logical=(500, 19, 10)
Partition 2 has different physical/logical endings:
     phys=(997, 32, 61) logical=(980, 60, 14)
Partition 2 does not end on cylinder boundary:
     phys=(997, 32, 61) should be (997, 63, 32)
 3 00   0   1  998  32  61 1017 2008974   40260 82
Partition 3 has different physical/logical beginnings (non-Linux?):
     phys=(998, 0, 1) logical=(980, 60, 15)
Partition 3 has different physical/logical endings:
     phys=(1017, 32, 61) logical=(1000, 38, 18)
Partition 3 does not end on cylinder boundary:
     phys=(1017, 32, 61) should be (1017, 63, 32)
 4 00   0   0    0   0   0    0       0       0 00

The fdisk expert mode has options for altering these entries - is it possible
to salvage this installation?
T.RTitleUserPersonal
Name
DateLines
604.1QuestionsNEWVAX::PAVLICEKLinux: the Truly Open O/SMon May 26 1997 05:2012
    A few random thoughts...
    
    What version of Linux is the floppy that you're booting from?  Is it
    1.3.98 or something else?
    
    Now that you've gotten the error from LILO, can you still boot from the
    floppy as you did originally?
    
    Instead of running LILO, can you create a floppy image or the new
    kernel, copy it to a new diskette, and try to boot it?
    
    -- Russ
604.2SCSI geometriesMOVIES::TWEEDIETue May 27 1997 12:2739
re .0:

It's almost certainly a problem with your drive geometries.  From your
partition table listing, we can see

  Disk /dev/sda: 64 heads, 32 sectors, 1001 cylinders
  Nr AF  Hd Sec  Cyl  Hd Sec  Cyl   Start    Size ID
   1 00   1   1    0  63  32  508      32 1042400 06
   2 80   0   1  509  32  61  997 1024617  984357 83
  Partition 2 has different physical/logical beginnings (non-Linux?):
       phys=(509, 0, 1) logical=(500, 19, 10)
  Partition 2 has different physical/logical endings:
       phys=(997, 32, 61) logical=(980, 60, 14)

The physical end of partition two is at head 32, sector 61, indicating
that the disk was originally formatted with 33 heads and 61 sectors per
cylinder (heads are counted from zero, sectors from one).  33*61 equals
2013 sectors per cylinder, and 509*2013 = 1024617, the correct start of
partition two.  So, the partition looks perfectly all right if only you
assume the different geometry.

So you should be just fine as long as you don't trip up on the geometry.
For fdisk, that involves going into the (x) expert menu and using the 
(h) change number of heads and (s) change number of sectors commands.  This
won't touch anything on the disk---it just tells fdisk that you really know
what the geometry should be.  (On SCSI disks, geometry is just an illusion
anyway.)  For LILO, you should be fine as long as you have the keyword
"linear" in the global part of the config file.  "linear" tells LILO to use
the absolute sector number to lookup all disk blocks, rather than the usual
cylinder/head/sector physical address.  Linear addressing sidesteps the issue
of geometry altogether.

If you ever want to completely repartition the disk, you can do so in fdisk 
without resetting the geometry and it will default to the geometry being 
presented by your newer SCSI controller card.  Until then, just override or
avoid the geometry and things should be fine.

Cheers,
 Stephen.
604.3DECWET::LOWEBruce Lowe, DECwest Eng., DTN 548-8910Tue May 27 1997 23:3727
.1:
>  What version of Linux is the floppy that you're booting from?  Is it
>  1.3.98 or something else?

On boot it says 2.0.0.

> Now that you've gotten the error from LILO, can you still boot from the
> floppy as you did originally?

Yes. I just tell it "mount root=/dev/sda2".

> Instead of running LILO, can you create a floppy image or the new
> kernel, copy it to a new diskette, and try to boot it?

Haven't tried that - how do you do that - since I'm not in DOS, rawrite
isn't available - would I just copy /vmlinuz to /dev/fd<x>?

.2:

Thanks for the reply. I tried using fdisk "X" mode to set my #heads = 33 and
my #sectors = 61, and I added "linear" to the lilo.conf file. When I try to 
rerun LILO, it still tells me:

Device 0x08000: Invalid partition entry, 2nd entry
   3D address:      1/0/509   (1042432)
   Linear address:  10/19/500 (1024617)
604.4NEWVAX::PAVLICEKhttp://www.boardwatch.com/borgtee2.jpgWed May 28 1997 01:5717
    re: .3
    
    If you built the kernel, you should have a file called zImage somewhere
    in the build tree.  On Red Hat 3.0.3, it is located in
    /usr/src/linux/arch/i386/boot .
    
    Format a new floppy using the command:
    
    	fdformat /dev/fd0H1440
    
    Copy zImage to the formatted floppy with the command:
    
    	cp zImage /dev/fd0
    or
    	dd if=zImage of=/dev/fd0
    
    -- Russ
604.5Fixing up LILO geometryMOVIES::TWEEDIEWed May 28 1997 12:0218
re .3:

If "linear" in LILO is still confused about the geometry, then you'll have
to dive in and tell LILO explicitly what the partition table's geometry
really is.  Use a section like:

	disk=/dev/sda
	  heads=33
	  sectors=61

in lilo.conf and things should work better.

This geometry confusion is a common problem when changing your disks from
one controller to another.  Often the easiest way out is just to repartition
and restore the data to the new configuration.

Cheers,
 Stephen.
604.6DECWET::LOWEBruce Lowe, DECwest Eng., DTN 548-8910Wed May 28 1997 21:4140
re: .4
Russ,

Interesting - the "fdformat /dev/fd0H1440" works fine, but both the "cp" and
"dd" operations hang - rge "dd" reports "771 + 1" records in, and out, but in 
either case, the system then goes into a hard-disk banging mode, with 
occasional floppy access clicks, and it seems infinite. I stopped it, and 
tried booting the "dd" disk, and it appeared to load, but on "Uncompressing",
it gave up immediately with a "ran out of input data".

re: .5

Stephen,

Putting in the:
   disk=/dev/sda2
   heads=33
   sectors=61
allowed lilo to go thru installation - it reported installing the three boot
options I specified, but on attempting a boot from teh hard disk, it still
tells me "missing operating  system". Yes, the Linux partition is set active.
Lilo is installed in the partition header, NOT the MBR (every time I have
put in in the MBR, I have regretted it later). 

> Often the easiest way out is just to repartition and restore the data to 
> the new configuration.

This is looking more and more attractive. Can I just save the entire partition,
as in "dd if=/dev/sda2 of=/dosc/saveit.dump"?

- I usually prefer tar, but will that work on an entire bootable partition?
  Tar can be a problem, if the msdos partitions are mounted, especially if I 
  am sending the tar file to that partition, recursive backup etc. Does dd 
  have that problem?

- Would I then use fdisk (under Linux) to delete the Linux partitions, then
  recreate them? Format them? Then use dd to restore? Can I do all this
  without shutting down/rebooting? Once the partition is nuked and recreated
  and/or initialized, how would I get at the saved file? Use tape instead?
604.7Hmmm...NEWVAX::PAVLICEKStop rebooting! Use LinuxWed May 28 1997 22:5645
    re: .6
    
    Dang, Bruce, make it hard for us why don'cha?  8^}
    
    You said 'dd' finished normally, but you cut off 'cp' because it was slow,
    yes?  Is your floppy on the SCSI controller?  I ask this because I know
    of at least one tape drive (under DOS) that crawls like a worm when
    connected to a floppy chain hosted by certain SCSI cards.  This could be
    similar (I am conjecturing) -- if the SCSI driver for your card is not
    efficient at handling I/O between the hard drive and the floppy chain.
    
    Do you have access to another DOS PC?  If so, maybe try this:
    
    	o  Format a floppy under DOS
    
    	o  Mount it on /dev/fd0.  Something like:
    
    		mount -t msdos /dev/fd0 /mnt/floppy
    
    		or wherever your mount point is for the device.
    
    	o  Try to copy zImage to the formatted DOS diskette, like:
    
    		cp zImage /mnt/floppy
    
    	o  Dismount the floppy, like:
    
    		umount /mnt/floppy
    
    	o  Carry it to the DOS machine, copy it to the hard drive, and
    		cut a new floppy using RAWRITE.
    
    	o  Carry it back to the target machine and see if it boots.
    
    Another way to handle it:
    
    	o  If you have dial out capabilities from the Linux box, try
    		kermitting (or whatever) the zImage file to an OpenVMS or
    		Unix box, dial in from a DOS box, grab the zImage file,
    		and use RAWRITE as above.
    
    BTW, are you sure that your CMOS has the floppy set for 1.44M?  You
    could get funny results if it isn't set correctly.
    
    -- Russ
604.8DECWET::LOWEBruce Lowe, DECwest Eng., DTN 548-8910Thu May 29 1997 01:2317
-1

Russ,

> You said 'dd' finished normally, but you cut off 'cp' because it was slow,
> yes?  Is your floppy on the SCSI controller?  I ask this because I know

No, the "dd" reported records in/out, but hung there after that.

The floppy is not a SCSI converted unit - it is connected via a floppy
controller cable, like any other.

This is a LP 466dx2 box, btw.

Unless there is a way to live with this funky partition table, reinitializing
is looking more likely.
604.9MOVIES::TWEEDIEThu May 29 1997 14:5726
re .6:

Hmm.  Does even DOS boot from the MBR?  If you're getting persistant
"missing operating system" messages then LILO is not even getting a chance
to start running.

By the way, it should have been "disk=/dev/sda", not "disk=/dev/sda2".  I'm
not sure whether LILO will cope properly with the latter: what you want to do
by this command is to tell LILO the geometry of the entire disk, not just the
one partition.  Using /dev/sda here shouldn't be enough to let LILO stomp on
your MBR.

Is the LILO partition the _only_ active one?  Some boot loaders don't do the
Right Thing if there are multiple active partitions.

If you do want to save the entire partition, then dump/restore is probably the
best bet.  I'd advise against just copying the entire partition raw, since
after repartitioning the filesystem is likely to be slightly smaller or 
larger than before.  Definitely use tape if you can: doing major surgery on 
disks is always safer with a good backup at hand. :)

However, I'd actually recommend just putting LILO on the MBR.  I've never had
any trouble with it there, and it's easy to remove later.

Cheers,
 Stephen.
604.10NEWVAX::PAVLICEKLinux: the PC O/S that isn&#039;t PCThu May 29 1997 15:2425
    re: .8
    
    I wasn't clear -- sorry.
    
    I've seen the ultra-slow problem under DOS with a floppy controller
    that resides on a SCSI card.  In other words, which card handles the
    floppy controller function: the SCSI card (which would have a SCSI
    chain connector and a separate floppy chain connector) or some other
    card?
    
    My thinking is that perhaps the kernel you're using is the issue here.
    That's why I was trying to get you to the point of booting from your
    newly-built kernel instead of the generic one.
    
    When I installed my IDE CD on my system (had a SoundBlaster CD before
    that), I was getting pig-slow response from it.  Turns out I was using
    an old kernel (1.1.x) with a very early version of the IDE CD driver.
    I built a new kernel and the CD problem disappeared.  The newer driver
    was gobs better than its predecessor.  I'm wondering if getting you to
    a proper kernel might not clean things up.
    
    That's why I've putting my efforts into getting you a new boot floppy,
    to see if you can address your disk with the new kernel.
    
    -- Russ
604.11DECWET::LOWEBruce Lowe, DECwest Eng., DTN 548-8910Thu May 29 1997 20:139
<---
 > By the way, it should have been "disk=/dev/sda", not "disk=/dev/sda2".  I'm

Yes, /dev/sda is what I put in the lilo.conf, I just mistyped it in the
note.

Thanks all for the help, but it looks like its time to reinstall. Since I can
get in with a boot floppy, I have been able to tar my user files (and selected
system files) off on the other partition.