Bug#896171: MS DOS partition table recognized as Atari AHDI

2018-08-28 Thread John Paul Adrian Glaubitz
On 8/28/18 6:29 PM, Emmanuel Kasper wrote:
> 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

Could be that CloneZilla is writing a corrupted partition table. I have
only ever seen this issue in cases where people were using CloneZilla.

> 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 ?

You can just backport this patch that upstream has to workaround this
problem [1]. Basically, they just changed the order in which partitions
are probed and thus, parted probes for MS-DOS first, then later for
Atari.

I hope I'll find some time in the near future to properly investigate
this issue though. The idea is to have a look at how the kernel does
the Atari partition probing, the code there seems more reliable.

Thanks,
Adrian

> [1] 
> http://git.savannah.gnu.org/cgit/parted.git/commit/?id=395f8aabfecb28820006d37ec37e9ffe1d2eb1e3

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaub...@debian.org
`. `'   Freie Universitaet Berlin - glaub...@physik.fu-berlin.de
  `-GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913



Bug#896171: MS DOS partition table recognized as Atari AHDI

2018-08-28 Thread Emmanuel Kasper
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  * 2048718847716800  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 SizeType 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 ?