after using cfdisk to format a mac disk, parted still uses the mac partition table

Bug #909424 reported by rduke15
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
util-linux (Ubuntu)
Triaged
Medium
Unassigned

Bug Description

parted reports a disk as having an hfs+ partition, when in fact it has a single ext3 partition.

fdisk, sfdisk, cfdisk and gdisk all report the disk with an ext3 partition as expected, and fsck reports that partition as clean.

I tried both my standard parted 2.2 (2.2-5ubuntu5 in "Ubuntu 10.04.3 LTS") and a freshly compiled parted 3.0 with the same result.

=========================

    # parted /dev/sdb print

    Model: ATA WDC WD5000AAVS-0 (scsi)
    Disk /dev/sdb: 500GB
    Sector size (logical/physical): 512B/512B
    Partition Table: mac

    Number Start End Size File system Name Flags
     1 512B 32.8kB 32.3kB Apple
     3 134MB 500GB 500GB hfs+ Apple_HFS_Untitled_1

=========================

    # fdisk -l /dev/sdb

    Disk /dev/sdb: 500.1 GB, 500107862016 bytes
    255 heads, 63 sectors/track, 60801 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00000000

       Device Boot Start End Blocks Id System
    /dev/sdb1 1 60801 488384001 83 Linux

=========================

    # gdisk -l /dev/sdb

    GPT fdisk (gdisk) version 0.5.1

    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 OPERATON IS POTENTIALLY DESTRUCTIVE! Exit by typing 'q' if
    you don't want to convert your MBR partitions to GPT format!
    ***************************************************************

    Disk /dev/sdb: 976773168 sectors, 465.8 GiB
    Disk identifier (GUID): A44C39DC-F029-04AD-746D-F75D6FB0250B
    Partition table holds up to 128 entries
    First usable sector is 34, last usable sector is 976773134
    Total free space is 5099 sectors (2.5 MiB)

    Number Start (sector) End (sector) Size Code Name
       1 63 976768064 465.8 GiB 0700 Linux/Windows data

=========================

Revision history for this message
Phillip Susi (psusi) wrote :

Can you please run the following command, and attach the resulting file:

sudo dd if=/dev/sdb bs=512 count=32 | gzip -c > data.gz

Changed in parted (Ubuntu):
status: New → Incomplete
Revision history for this message
rduke15 (rduke15) wrote :
Revision history for this message
Phillip Susi (psusi) wrote :

Interesting. It looks like you had a mac partition table on this disk with a valid hfs partition and somehow you have overwrote the MBR in such a way that it looks both like an MSDOS partition table, and still looks like the first sector of the mac partition table. What tool did you use to create the msdos partition table?

Revision history for this message
rduke15 (rduke15) wrote :

Thank you for looking into this.

Unfortunately, I cannot remember 100% how I prepared this disk a few years ago. But most probably, it would have been with cfdisk in Debian 4.

Maybe this WD external disk was originally delivered with a Mac partition? The disk was at a client's site, where they have many Macs. So it is also possible someone once connected it to a Mac. But they certainly didn't "initialize" or "erase" it (to use Macs terminology), because the disk still has all it's data and works as expected as an ext3 partition.

So apparently, parted gets mislead in it's partition identification code, in some special case. Hopefully my sample will help correct this glitch. I rely a lot on parted since it seems to be the only tool that allows me to entirely script a partitioning of new disks, and I started to need to do that a lot.

In the meantime, maybe it is safer to first zero out the first block(s)? I sometimes do it for the first 512 bytes. Should I do it for all the first 16K?

Revision history for this message
Phillip Susi (psusi) wrote :

It looks like cfdisk does not zap the mac boot sector, so parted still thinks it is valid. You should be able to zero the first 32 or 64k of the disk and recreate the partitions to resolve the issue.

Changed in parted (Ubuntu):
importance: Undecided → Medium
status: Incomplete → Triaged
Changed in util-linux (Ubuntu):
status: New → Triaged
importance: Undecided → Medium
summary: - Parted reports ext3 partition as hfs+
+ after using cfdisk to format a mac disk, parted still uses the mac
+ partition table
Revision history for this message
Phillip Susi (psusi) wrote :

Make that just the first 32k, since your partition starts after that.

Phillip Susi (psusi)
no longer affects: parted (Ubuntu)
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.