Subject: Re: bug#31111: Partition table wrongly identified as "atari"

From: bouke_1 <[email-masked]>
Date: Wed, 18 Apr 2018 17:07:20 +0200

For the record, let me add to this lonely conversation.

I tried to reproduce the problem in a simple way, by separating the 
sfdisk command from the Clonezilla operation where it first appeared. 
Clonezilla uses parted for information and sfdisk to configure the 
partitions.

Starting with a functional Windows 10 system with three partitions I ran 
some tests from the Clonezilla live distribution (parted says it is 
version 3.2).

1.parted says I have an atari disk (even though it is a functional 
Windows 10 system)
2.Instruct parted to create a new dos partition table
3.parted says I have an msdos disk with no partitions (as expected)
4.Run sfdisk with sda-pt.sf from the Clonezilla image as input
5.sfdisk creates three NTFS partitions on the disk (as expected)
6.parted says I have an atari disk with one partition

See the full log below. This reproduces on a bunch of PC's here (albeit, 
identical ones), so my guess it that it should reproduce elsewere?

Bouke

// log

sudo parted /dev/sda print

Model: ATA WDC WD5000AAKX-6 (scsi)
Disk /dev/sda: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: atari
Disk Flags:

Number  Start   End     Size    Type     File system  Flags
  1      8323MB  14.8GB  6446MB  primary               boot

sudo parted -s /dev/sda mklabel msdos
sudo parted /dev/sda print

Model: ATA WDC WD5000AAKX-6 (scsi)
Disk /dev/sda: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start  End  Size  Type  File system  Flags

sudo LC_ALL=C sfdisk --force /dev/sda

label: dos
label-id: 0x22a777ed
device: /dev/sda
unit: sectors

/dev/sda1 : start=        2048, size=      716800, type=17, bootable
/dev/sda2 : start=      718848, size=   975028224, type=7
/dev/sda3 : start=   975747072, size=     1024000, type=27
Checking that no-one is using this disk right now ... OK

Disk /dev/sda: 465.8 GiB, 500107862016 bytes, 976773168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xcb89b023

Old situation:

>>> Script header accepted.
>>> Script header accepted.
>>> Script header accepted.
>>> Script header accepted.
>>> Created a new DOS disklabel with disk identifier 0x22a777ed.
/dev/sda1: Created a new partition 1 of type 'Hidden HPFS/NTFS' and of 
size 350 MiB.
/dev/sda2: Created a new partition 2 of type 'HPFS/NTFS/exFAT' and of 
size 465 GiB.
/dev/sda3: Created a new partition 3 of type 'Hidden NTFS WinRE' and of 
size 500 MiB.
/dev/sda4: Done.

New situation:

Device     Boot     Start       End   Sectors  Size Id Type
/dev/sda1  *         2048    718847    716800  350M 17 Hidden HPFS/NTFS
/dev/sda2          718848 975747071 975028224  465G  7 HPFS/NTFS/exFAT
/dev/sda3       975747072 976771071   1024000  500M 27 Hidden NTFS WinRE

The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

sudo parted /dev/sda print

Model: ATA WDC WD5000AAKX-6 (scsi)
Disk /dev/sda: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: atari
Disk Flags:

Number  Start   End     Size    Type     File system  Flags
  1      8323MB  14.8GB  6446MB  primary               boot

// end