LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   error running "cfdisk" vs. "fdisk" (https://www.linuxquestions.org/questions/linux-hardware-18/error-running-cfdisk-vs-fdisk-835972/)

SaintDanBert 10-03-2010 03:48 PM

error running "cfdisk" vs. "fdisk"
 
I can run fdisk without any troubles
Code:

prompt$ sudo fdisk -l /dev/sda

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xe11595f6

  Device Boot      Start        End      Blocks  Id  System
/dev/sda1  *          1      15298  122881153+  7  HPFS/NTFS
/dev/sda2          15299      16700    11261565  12  Compaq diagnostics
/dev/sda3          16701      60801  354241282+  5  Extended
/dev/sda5          52516      60801    66557295    7  HPFS/NTFS
/dev/sda6          16701      24602    63472752  83  Linux
/dev/sda7          24603      24845    1951866  83  Linux
/dev/sda8          24846      26061    9767488+  83  Linux
/dev/sda9          44613      52514    63472783+  83  Linux
/dev/sda10          26062      38809  102398278+  83  Linux
/dev/sda11          38810      39307    4000153+  82  Linux swap / Solaris

Partition table entries are not in disk order
prompt$

However, I get a fatal error when I try "cfdisk".
Code:

prompt$ sudo cfdisk /dev/sda
FATAL ERROR: Bad logical partition 6: enlarged logical partitions overlap
Press any key to exit cfdisk
prompt$

An alternate way of looking at the fdisk report might be:
(I edited the report by hand)
Code:


  Device Boot      Start        End      Blocks  Id  System
/dev/sda1  *          1      15298  122881153+  7  HPFS/NTFS
/dev/sda2          15299      16700    11261565  12  Compaq diagnostics
/dev/sda3          16701      60801  354241282+  5  Extended
/dev/sda6          16701      24602    63472752  83  Linux
/dev/sda7          24603      24845    1951866  83  Linux
/dev/sda8          24846      26061    9767488+  83  Linux

/dev/sda10          26062      38809  102398278+  83  Linux
/dev/sda11          38810      39307    4000153+  82  Linux swap 
39308 -- 44612 not listed

/dev/sda9          44613      52514    63472783+  83  Linux Solaris

/dev/sda5          52516      60801    66557295    7  HPFS/NTFS

prompt$

The various colors highlight groups of cylinders that were created together, out of order with their respective partitions numbers.
I don't see the problem that cfdisk complains about.

Help, please,
~~~ 0;-Dan

Soadyheid 10-04-2010 07:19 PM

Code:

/dev/sda3          16701      60801  354241282+  5  Extended
/dev/sda6          16701      24602    63472752  83  Linux

sda3 and sda6 have start cylinders which are the same, in fact, sda6 is within sda3 which, er... you could say is the overlap seen by cfdisk. Maybe fdisk doesn't care as much? :D

However... I notice that sda9 is tagged as Linux/Solaris. A clue perhaps? Has this disk been partitioned on a Sun box? For reasons best known to Sun, disks partitioned and formatted on their systems have this strange third partition which is effectively "the whole disk" OK, so you've got a Compaq diagnostic partition hidden on the front which infers it belongs in a Compaq box and is not part of "The whole disk"...

Just a thought :twocents:

Play Bonny! :hattip:

TobiSGD 10-04-2010 07:47 PM

Quote:

Originally Posted by Soadyheid (Post 4117748)
Code:

/dev/sda3          16701      60801  354241282+  5  Extended
/dev/sda6          16701      24602    63472752  83  Linux

sda3 and sda6 have start cylinders which are the same, in fact, sda6 is within sda3 which, er... you could say is the overlap seen by cfdisk.

Of course they overlap, because they have to! sda3 is an extended partition which contains of course other logical partitions, in this case all partitions from sda5 to sda11. This is not an error.
Quote:

However... I notice that sda9 is tagged as Linux/Solaris. A clue perhaps? Has this disk been partitioned on a Sun box?
First, it is sda11 that is tagged as Linux swap/Solaris. Second, I think this is normal.

In fact, I don't see any error in this partition table.
Have you tried other partitioning tools like GParted?

Soadyheid 10-05-2010 06:50 PM

Rats! I read SaintDanBert's hand sorted partition list:

Quote:

/dev/sda9 44613 52514 63472783+ 83 Linux Solaris
which may have caused the confusion, I should have noted the partition ID; 83 = Linux, bf = Solaris. :doh:

So, is the extended partition normal on X86 systems? I've just checked my system and I don't have one. My Sun Ultra 2 DOES with the disk formatted under Solaris. Could it be that cfdisk doesn't like extended partitions?

Extract from "man cfdisk"
Quote:

cfdisk tries to read the current partition table from the disk
drive. If it is unable to figure out the partition table, an error is
displayed and the program will exit. This might also be caused by
incorrect geometry information, and can be overridden on the command
line. Another way around this problem is with the -z option. This
will ignore the partition table on the disk.
Nope. I couldn't find any references to extended partitions. Any Ideas?

Play Bonny! :hattip:

mothergoose729 10-06-2010 01:09 AM

This probably won't be all the helpful, but I used to get a similar error when I tried to use Cfdisk in a gentoo install as well. I ended up being forced to use fdisk instead. If the option is available, using a gparted live CD to cut up your drives instead is much easier.

cheers :)

gdejonge 10-06-2010 03:52 AM

Yes, extended partitions are normal on PC's. It's the only way to get more than 4 partitions on a disk.
There can only be 4 primary partitions on a disk (sdx1-4). One of these primary partitions can be flagged as extended partition.
There can be only 1 partition flagged as extended. The extended partition then can be divided in logical partitions (sdx5-sdx..).
Logical partitions will always start at sdx5 no matter how many primary partitions there are.

For the problems with cfdisk. I suspect that the strange order of logical partitions confuses cfdisk enough, so it will quit rather then hose the disk.
Quote:

If it is unable to figure out the partition table, an error is
displayed and the program will exit.
The only other possible problem I see is with the extended partition flag
5 Extended
instead of the more modern use of
f W95 Ext'd (LBA)

You could try parted to see if that also gives errors.

_________________________
Gerrard

SaintDanBert 10-07-2010 04:17 PM

Quote:

Originally Posted by Soadyheid (Post 4117748)
...
sda3 and sda6 have start cylinders which are the same, in fact, sda6 is within sda3 which, er... you could say is the overlap seen by cfdisk. Maybe fdisk doesn't care as much? :D

SDA6 is a "logical partition". they must exist inside an "extended partition". SDA3 provides that extended partition. Does this mean that cfdisk cannot display drives with "extended" partitions or is it expecting some other partition type that what is going on here?

Quote:

Originally Posted by Soadyheid (Post 4117748)
However... I notice that sda9 is tagged as Linux/Solaris. A clue perhaps? Has this disk been partitioned on a Sun box?

That is how "swap space" gets reported. I don't know why.

Quote:

Originally Posted by Soadyheid (Post 4117748)
...
OK, so you've got a Compaq diagnostic partition hidden on the front which infers it belongs in a Compaq box and is not part of "The whole disk"...

Actually, the partition is loaded by Lenovo rather than Compaq. Yes it is their diags and recovery utils. It must be the second partition on the first drive or else it will not boot. It must be fat32 and is very VERY win-doze oriented.

~~~ 0;-Dan

SaintDanBert 10-07-2010 04:25 PM

CAUTION Olde dog trying new tricks!!

I completely forgot (continuously forget) about parted and gparted in this brave wonderful world of linux.

Code:

prompt$ sudo parted /dev/sda

(parted) print                                                           
Model: ATA ST9320325AS (scsi)
Disk /dev/sda: 320GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start  End    Size    Type      File system    Flags
 1      32.3kB  62.9GB  62.9GB  primary  ntfs            boot
 2      62.9GB  69.0GB  6108MB  primary  fat32
 4      69.0GB  257GB  188GB  extended                  lba
 5      69.0GB  132GB  62.9GB  logical  ntfs
 6      132GB  163GB  31.5GB  logical  ext3
 8      163GB  253GB  89.4GB  logical  ext3
 7      253GB  257GB  4296MB  logical  linux-swap(v1)
 3      257GB  320GB  62.9GB  primary  ext4

(parted)

Notice how the partitions are ordered? I suspect it is that situation that confuses cfdisk.

Thanks to all,
~~~ 0;-Dan


All times are GMT -5. The time now is 05:09 AM.