fdisk not creating correct partition table

Hi,

I am trying to use fdisk to create a couple of partitions on an external USB disk but it doesn't do correctly what I ask it to. It seems the problem is the difference in what the CHS (cylinder head sector) info says and what the start/size info says. For example for a 160GB disk with two partitions I would like to have it be (disk geometry is 7296/255/63 [117210240 sectors]):

#: id cyl hd sec - cyl hd sec [ start - size]
------------------------------------------------------------------------
1: 12 0 1 1 - 763 254 63 [ 63 - 12273597] Compaq Diag.
*2: 07 764 0 1 - 1023 254 63 [ 12273660 - 104936580] HPFS/QNX/AUX
3: 00 0 0 0 - 0 0 0 [ 0 - 0] unused
4: 00 0 0 0 - 0 0 0 [ 0 - 0] unused

But if I try using fdisk this is what I end up with:

#: id cyl hd sec - cyl hd sec [ start - size]
------------------------------------------------------------------------
1: 12 0 1 1 - 1023 254 63 [ 63 - 12273597] Compaq Diag.
*2: 07 1023 254 63 - 1023 254 63 [ 12273660 - 104936580] HPFS/QNX/AUX
3: 00 0 0 0 - 0 0 0 [ 0 - 0] unused
4: 00 0 0 0 - 0 0 0 [ 0 - 0] unused

So as you can see the start/size info is right, but the CHS numbers are not (the end of partition 1 is not correct and the begining and end of partition 2 is not correct). The commands that I gave to fdisk to do this were:

fdisk:*1> edit 1
Starting Ending
#: id cyl hd sec - cyl hd sec [ start - size]
------------------------------------------------------------------------
1: 12 0 1 1 - 1023 254 63 [ 63 - 12273597] Compaq Diag.
Partition id ('0' to disable) [0 - FF]: [12] (? for help)
Do you wish to edit in CHS mode? [n] y
BIOS Starting cylinder [0 - 7295]: [0]
BIOS Starting head [0 - 254]: [1]
BIOS Starting sector [1 - 63]: [1]
BIOS Ending cylinder [0 - 7295]: [1023] 763
BIOS Ending head [0 - 254]: [254]
BIOS Ending sector [1 - 63]: [63]

and

fdisk:*1> edit 2
Starting Ending
#: id cyl hd sec - cyl hd sec [ start - size]
------------------------------------------------------------------------
*2: 07 1023 254 63 - 1023 254 63 [ 12273660 - 104936580] HPFS/QNX/AUX
Partition id ('0' to disable) [0 - FF]: [7] (? for help)
Do you wish to edit in CHS mode? [n] y
BIOS Starting cylinder [0 - 7295]: [1023] 764
BIOS Starting head [0 - 254]: [254] 0
BIOS Starting sector [1 - 63]: [63] 1
BIOS Ending cylinder [0 - 7295]: [1023] 7295
BIOS Ending head [0 - 254]: [254]
BIOS Ending sector [1 - 63]: [63]

How can I fix this? I have tried both the CHS method and the default (start/size) method when creating the partitions and neither give the completely correct results. I have tried completely erasing the partition table and recreating it, but nothing seems to give me what I would think should be no big deal. I am puzzled as to how one set of info (ie CHS) does not agree with the start/size info??? I think the 1023 value for cylinders is OK for the end of partition 2 due to some funny WIndows bit of trivia, but the CHS for end of part 1 and start of part 2 should be correct since they are less than 1023.

The disk does have an MBR type partition table. I am doing this on a SATA external drive attached to a USB DriveWire if that makes a difference.

What am I doing wrong? Can I get there using fdisk on my MacBook?

Thanks ....

-Bob

MacBook Pro, Mac OS X (10.5.7)

Posted on Jun 2, 2009 9:54 AM

Reply
9 replies

Jun 2, 2009 2:57 PM in response to ReallyDeepYogurt

I haven't had much luck with Leo's fdisk either. It is rather contrary it seems. I suggest using windows
to partition and format windows partitions. If you have a working boot camp volume use windows
disk management tool (device manager).

iPartition is an excellent Mac program for handling your Mac and Windows partitions. If you do
very much partitioning, resizing and formatting, it will save you a lot of hair and time.

Kj

Jun 3, 2009 12:00 AM in response to ReallyDeepYogurt

Well, I have given up on using fdisk and just decided to edit the raw disk with a hex editor and modify the appropriate bytes of the partition table. The first 512 bytes of the disk contain this info in the following format:

446 bytes of boot code and other stuff
64 bytes of partition info (16 bytes for each of four partitions)
2 bytes with special 0x55 0xAA values
-----
512 bytes total

Each partition table entry has the structure:

Boot flag - 1 byte which is either 0x0 or 0x80
CHS Begin - 3 bytes for cylinder, head, sector
Type - 1 byte for what type of filesystem partition 1 is
CHS End - 3 bytes for cylinder, head, sector
LBA Begin - 4 bytes
# of sectors - 4 bytes

I found explanations at http://www.viralpatel.net/taj/tutorial/partition_table.php and http://www.ata-atapi.com/hiwtab.html had a couple of examples to study.

So thanks for everyone's suggestions. I just wish that fdisk really worked like it is supposed to without the funny business!!

-Bob

Jun 3, 2009 12:39 AM in response to William-Boyd-Jr

Disk Utility on Mac OS X is rather limited when it comes to non-Mac partitions like NTFS, etc (without other software like NTFS-3G others), and hasn't the foggiest what to do with really strange partitions like type 12 which is a special Compaq Config partition that seems to be popular on Windows systems that save special "restore factory configuration" type software.

-Bob

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

fdisk not creating correct partition table

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.