Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Bug#896171: parted wrongly identifies an msdos partition table as 'atari'

86 views
Skip to first unread message

bouke_1

unread,
Apr 20, 2018, 9:10:08 AM4/20/18
to
Package: parted
Version: 3.2-17


I have a valid & pretty standard Windows 10 system on a hard disk with
three NTFS partitions: a small boot partition, a 465 GB main partition
and a small restore partition. The structure is created by fsdisk from a
Clonezilla live distribution. After the partitions are created, parted
identifies my partition table as "atari" with a single partition. Any
other tool I throw at it correctly sees an msdos partition table and I
can boot windows 10 from the disk, so it appears there is nothing wrong
with the disk. Also, it reproduces on 7 different PC's (albeit with
pretty identical hardware).

I don't have a complete Debian system so my options are limited (no
inernet access / reportbug), but this is the test I ran to reproduce the
problem:

1.Run parted; it 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.Run parted; it 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.Run parted; it says I have an atari disk with one partition

See the full log at the end of this mail.

My understanding of the problem is that the code that makes parted
recognize atari disks in isolated cases falsely indentifies a disk as
Atari if the first blocks incidentally contain data that make (some)
sense when interpreted as an Atari partition table. The chance of this
happening is not high but also not zero (and apparently I got unlucky).
See the parted list (Bug #31111
http://lists.gnu.org/archive/html/bug-parted/2018-04/msg00003.html) for
a more detailed analysis.

The chance of this happening should be zero because If I would use
parted to change anything on this disk it would probably destroy all
data on it (i.e., pretty critical).

FUN FACT: If I change the size of sda2 from 975028224 to (e.g.)
975028222, the disk is no longer recognized as Atari & the problem
vanishes.

Some info about my system:

I used the Clonezilla-live distribution alternate stable
(clonezilla-live-2.5.2-31-i686)

> uname -a
Linux zesty 4.10.0-33-generic #37-Ubuntu SMP Fri Aug 11 10:53:59 UTC
2017 i686 i686 i686 GNU/Linux

> dpkg --status parted
Package: parted
Status: install ok installed
Priority: optional
Section: admin
Installed-Size: 156
Maintainer: Ubuntu Developers <ubuntu-dev...@lists.ubuntu.com>
Architecture: i386
Version: 3.2-17
Replaces: fsresize, parted1.6
Depends: libc6 (>= 2.11), libparted2 (= 3.2-17), libreadline7 (>= 6.0),
libtinfo5 (>= 6)
Suggests: parted-doc
Conflicts: fsresize, parted1.6
Description: disk partition manipulator
[snip]
Original-Maintainer: Parted Maintainer Team
<parted-ma...@lists.alioth.debian.org>
Homepage: http://www.gnu.org/software/parted

sfdisk from util-linux 2.29

> dpkg --list util-linux
Desired=Unknown/Install/Remove/Purge/Hold
|
Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-==============-===============-============-=================================
ii util-linux 2.29-1ubuntu2.1 i386 miscellaneous system
utilities

NOTE:
I ran the same test from the GParted live distribution
(gparted-live-0.31.0-1-i686), with the same results.
uname -a --> Linux Debian 4.15.0-1-686 #1 SMP Debian 4.15.4-1
(2018-02-18) i686 GNU/Linux
/etc/debian_version: buster/sid
dpkg -- status parted: version 3.2-20.drbl1


/// LOG OF TEST PROCEDURE OUTLINED ABOVE ///
> 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 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

bouke_1

unread,
Apr 24, 2018, 8:50:02 AM4/24/18
to
I tested version 3.2-21 (unstable testing) from the Clonezilla Live
distribution (2.5.5-40), with the same results.

Emmanuel Kasper

unread,
Jul 22, 2018, 6:50:03 PM7/22/18
to
Hi bouke

I am a not GNU parted maintainer, but I am a both a Debian Developper
and Atari 16/32 bits user so I can help digging the Atari specific
problems here.

Could you please share the sfdisk sda-pt.sf you used to create the
partition table or the MBR of the disk having the problem ?

There is also one tool available in the debian archive, disktype, which
also knows both the Atari ST partitioning scheme, AHDI and MSDOS.
It would be interesting to see what disktypes output in your case ( and
which logic it uses for the detection)

Franz Simader

unread,
Aug 28, 2018, 9:00:03 AM8/28/18
to
Hello,

I have the same problem as described in the Bug #896171.

A valid msdos partition table with 3 partitions is shown with parted (3.2-17) as 'atari' and only the first partition is visible.

Is there a solution for this known problem ?


With best regards.

Franz Simader

Emmanuel Kasper

unread,
Aug 28, 2018, 12:50:04 PM8/28/18
to
Ok i can reproduce the issue using the pc6.mbr posted by bouke:

cp pc6.mbr disk.img
# otherwise parted complains "Can't have a partition outside the disk"
truncate -s 600GB disk.img

# fdisk correctly detects the msdos partition table
fdisk -l disk.img
Disk disk.img: 600 GiB, 644245094400 bytes, 1258291200 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: 0x44a777ed

Device Boot Start End Sectors Size Id Type
disk.img1 * 2048 718847 716800 350M 17 Hidd
disk.img2 718848 975747071 975028224 465G 7 HPFS
disk.img3 975747072 976771071 1024000 500M 27 Hidd

# parted fails

parted disk.img print

Disk /home/manu/Téléchargements/disk.img: 644GB
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


Also using the disktype utility (which knows both msdos and ahdi) the
msdos partition table is properly recognized.

CCing John as he is the original atari patch author

@john: I am heavily suspecting here the disk signature, but maybe you
have a better idea ?
0 new messages