0

I have Fusion ioDrive2 785GB (731.088 GiB) SSD card. The server is running Oracle Enterprise Linux 6.4 (RHEL6.4 compatible). It is low-level formatted as such:

    "80% factory capacity"
    Format Capacity:    627,999,997,952 bytes
    Sector Size:    4,096 bytes

I want to split this drive into 2 partitions: 600,000,000,000 bytes to partition 1 and the rest to partition 2. I used fdisk -cu /dev/fioa command to create partitions:

Command (m for help): p

Disk /dev/fioa: 628.0 GB, 627999997952 bytes
255 heads, 63 sectors/track, 9543 cylinders, total 153320312 sectors
Units = sectors of 1 * 4096 = 4096 bytes
Sector size (logical/physical): 4096 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 32768 bytes
Disk identifier: 0x4b661ac0

    Device Boot      Start         End      Blocks   Id  System
/dev/fioa1             256   146484375   585936480   83  Linux
/dev/fioa2       146484376   153320311    27343744   83  Linux

Please note total sectors count and End sector for partition fioa2.

Now here's output of gdisk /dev/fioa:

GPT fdisk (gdisk) version 0.8.4

Partition table scan:
  MBR: MBR only
  BSD: not present
  APM: not present
  GPT: not present
***************************************************************
Found invalid GPT and valid MBR; converting MBR to GPT format.
THIS OPERATION IS POTENTIALLY DESTRUCTIVE! Exit by typing 'q' if
you don't want to convert your MBR partitions to GPT format!
***************************************************************

Warning! Secondary partition table overlaps the last partition by
5 blocks!
You will need to delete this partition or resize it in another utility.

Command (? for help): p
Disk /dev/fioa: 153320312 sectors, 584.9 GiB
Logical sector size: 4096 bytes
Disk identifier (GUID): 2744FD52-D432-4BDD-8111-0643B70B5C34
Partition table holds up to 128 entries
First usable sector is 6, last usable sector is 153320306
Partitions will be aligned on 8-sector boundaries
Total free space is 250 sectors (1000.0 KiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1             256       146484375   558.8 GiB   8300  Linux filesystem
   2       146484376       153320311   26.1 GiB    8300  Linux filesystem

Here please note overlap warning message, last usable sector number and as it compares to the last sector of partition 2.

Which of these 2 tools shows correct information?

2
  • 1
    They're both correct. What is your real question? May 1 '13 at 20:38
  • @MichaelHampton Isn't it obvious?:/ Why did fdisk create a partition layout that is supposedly according to gdisk outside of allowed boundaries?
    – Mxx
    May 1 '13 at 21:05
0

Gdisk is used to create GPT partitions while the partition you are looking at was created with Fdisk (and uses an MBR partition) GPT uses 64 bit LBA addressing exclusively whereas fdisk uses a combination of CHS and LBA addressing.

The first thing gdisk will do is calculate the conversion from MBR to GPT. I would trust the utility used to create the partition.

2
  • How does that relate to my question?
    – Mxx
    May 1 '13 at 21:07
  • You created a partition with fdisk, and then used another tool which first converts the partition from its original format and then makes calculations based on that. While both pieces are accurate as a rule of thumb i would generally trust the tool used to create the partition. In this case, fdisk.
    – tdk2fe
    May 1 '13 at 21:36
0

I used fdisk -cu /dev/fioa command to create partitions:

255 heads, 63 sectors/track, 9543 cylinders, total 153320312 sectors
...
    Device Boot      Start         End      Blocks   Id  System
/dev/fioa1             256   146484375   585936480   83  Linux
/dev/fioa2       146484376   153320311    27343744   83  Linux

Which means you created two MBR partitions on that disk.

Now here's output of gdisk /dev/fioa:

Number  Start (sector)    End (sector)  Size       Code  Name
   1             256       146484375   558.8 GiB   8300  Linux filesystem
   2       146484376       153320311   26.1 GiB    8300  Linux filesystem

gdisk is used for creating GPT partitions on disk, not for MBR. If GPT layout is not created yet, gdisk first try to convert MBR partitions into GPT. Look at output:

Found invalid GPT and valid MBR; converting MBR to GPT format.
THIS OPERATION IS POTENTIALLY DESTRUCTIVE! Exit by typing 'q' if
you don't want to convert your MBR partitions to GPT format!

MBR layout is stored in first sector only. GPT layout is stored in second sector and backup copy also at the end of disk. Therefore with GPT layout you cannot have partition which will include also last sector of this. And gdisk show you this problem in warning:

Warning! Secondary partition table overlaps the last partition by
5 blocks!
You will need to delete this partition or resize it in another utility.

So look at total number of sectors on disk. That number is same in fdisk and gdisk output.

Disk /dev/fioa: 153320312 sectors, 584.9 GiB

And now if you look at usable sectors, those are smaller in gdisk as in fdisk

First usable sector is 6, last usable sector is 153320306

Usable gdisk sector is sector which can be used for GPT partition. I.e. sector on this are not stored MBR or GPT layouts. As GPT uses some firts sectors and some lasts sectors for its own, they cannot be used for partition data.

So to answer your question:

Which of these 2 tools shows correct information?

Both tools show you correct information. fdisk shows you current MBR layout and gdisk shows you how would partition layout look like if you convert MBR to GPT.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.