[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: cfdisk: "Fatal error: Bad Primary partition"



Nope, I looked at the source and cfdisk won't show you anything about the partition
table if it doesn't make sense to it. However, this perl script will (all one line, my
mailer my break it up):

perl -e 'open(IN,"</dev/hda");sysread(IN,$buf,512);printf("boot ind: %u, start(h %d, s
%d, c %d), type 0x%02x, end(h %d, s %d, c %d), lba %d, lba-len %d\n",
unpack("x446CCCCCCCCLL",$buf));'

This will print out your first primary partition. On my system:

boot ind: 128, start(h 1, s 1, c 0), type 0x83, end(h 63, s 191, c 46), lba 63,
lba-len 2253825

'boot ind' is for boot indication. It's 128 if the partition is bootable, zero
otherwise. There there's your partition start, with head, sector, and cylinder, the
partition type (0x83 is Linux, 0x82 is Linux Swap), the end of the partition and then
the partition start sector and length in sectors (lba, lba-len, respectively). cfdisk
will puke if the numbers aren't consistent (start is before end, etc.) so you can
check these out yourself.  To look at partitions 2, 3, and 4, change
'unpack("x446CCCCCCCCLL"' to 'unpack("x446x16CCCCCCCCLL"',
'unpack("x446x32CCCCCCCCLL"', and 'unpack("x446x48CCCCCCCCLL"', respectively. It goes
without saying you have to be root to run this script.

Nebu John Mathai wrote:

> Has anone got this error?
>
> On installing Debian 2.0 I used cfdisk to partition my 8.4Gig drive. The
> first time I did it, I did not like the partition sizes (after writing the
> partition info and initializing my root partition) and so rebooted the
> machine (by going into the installation option to reboot the machine) to
> do the install once more. However, this time, when I went to partition the
> drive cfdisk stated "fatal error: ban primary partition". So I went to
> fdisk and erased the partition info (fdisk seemed to work) and ran cfdisk
> once more and all was fine. I installed debian and everything worked fine.
>
> Now, a few days later I went to install NT (unfortunately I have to run
> some NT software for school), and NT disabled the "bootability" of Linux.
> So I used a boot disk to get back to Linux, and tried running cfdisk to
> get the partition with linux (the primary partition) bootable, but cfdisk
> now complains: "Fatal error: bad primary partition".
>
> Any ideas on what this error means? Is my hard drive bad? I noticed that
> cfdisk gives me cylinder/head/sector information on my drive that does not
> matchmy hard drive specs ... should I use cfdisk to change that info?
>
> Thanks for any advice!
>
> --
> Unsubscribe?  mail -s unsubscribe debian-user-request@lists.debian.org < /dev/null



--
Jens B. Jorgensen
jjorgens@bdsinc.com



Reply to: