[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#18984: Enhancement request: Handling of damaged partition tables
From: |
Ulrich Windl |
Subject: |
bug#18984: Enhancement request: Handling of damaged partition tables |
Date: |
Fri, 07 Nov 2014 16:12:22 +0100 |
(This is a re-send of the message (extracted from the mail queue) dated Fri, 07
Nov 2014 14:38:39 +0100, because that message took the wrong mailer and is
stuck in the queue)
Hi!
As the web-based bug reporting is still broken, I'm mailing instead:
I have a system that features a damaged partition table for an 1TB disk
with 4kB sectors. While Windows 7 boot without any complaint, and
diskpart is happy, GNU parted doesn't display the existing partitions,
because it says there are overlapping partitions. This in turn causes
every Linux system I tried to install to overwrite the existing
partitions, because they are not detected by parted!
(I only have the first sector here, but when trying to print the MBR
partition table, I get this with GNU Parted 3.2)
---
/tmp/parted-3.2/parted/parted sect0.0
WARNING: You are not superuser. Watch out for permissions.
GNU Parted 3.2
Using /home/user/Projekte/sect0.0
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted)
print
Error: Can't have a partition outside the disk!
Ignore/Cancel?
i
Error: Can't have a partition outside the disk!
Ignore/Cancel?
i
Error: Can't have a partition outside the disk!
Ignore/Cancel?
i
Error: Can't have a partition outside the disk!
Ignore/Cancel?
i
Error: end of file while reading /home/user/Projekte/sect0.0
Retry/Ignore/Cancel?
i
Error: Invalid partition table on /home/user/Projekte/sect0.0 -- wrong
signature 0.
Ignore/Cancel?
i
Error: Can't have overlapping partitions.
Ignore/Cancel?
i
Error: Can't have a primary partition inside an extended partition.
Ignore/Cancel?
i
Error: Can't have a partition outside the disk!
Ignore/Cancel?
i
Error: Can't have a partition outside the disk!
Ignore/Cancel?
i
Error: Can't have a partition outside the disk!
Ignore/Cancel?
i
Model: (file)
Disk /home/user/Projekte/sect0.0: 4096B
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:=20
Number Start End Size Type File system Flags
1 1049kB 103GB 103GB primary
2 103GB 318GB 215GB primary
3 318GB 1000GB 682GB extended lba
4 855GB 962GB 107GB primary boot
(parted)
version
GNU Parted 3.2
---
I wrote some Perl code to decode the partition table, and I'm presenting
it here for a test case for future enhancements. I suggest the
following:
1) Instead of saying "Can't have a partition outside the disk!" say
_which_ partition you think is outside the disk, and say _why_ you think
so.
2) Despite of the message "Invalid partition table
on /home/wiu09524/Projekte/sect0.0 -- wrong signature 0." the MBR
signature is 0x55, 0xaa as expected
3) Instead of saying "Can't have overlapping partitions." say _which_
partitions you think overlap with which other partitions, and
perferrably give precise data for the overlap. Parted should not just
help secretaries, but technicals also ;-)
4) "Can't have a primary partition inside an extended partition." may be
true, but see 3) for proposed improvements.
So here comes my own decoding of the MBR (cant' decode extended
partitions, because I only have an image of the first 4kB sector here):
First the four partition table entries as byte dump (for the gurus):
partition #1: 80 fe ff ff 07 fe ff ff 00 58 80 63 00 38 80 0c
partition #2: 00 7b cb ff 0f fe ff ff 00 48 00 25 00 b8 6f 4f
partition #3: 00 fe ff ff 07 fe ff ff 00 48 00 0c 00 00 00 19
partition #4: 00 20 21 00 07 fe ff ff 00 08 00 00 00 40 00 0c
Next the table entries decoded (partition type and active flag in hex,
then C/H/S of start, C/H/S of end, LBA of start, LBA of end):
partition #1: 7 80 1023/254/63 1023/254/63 1669355520 209729536
partition #2: f 00 1023/123/11 1023/254/63 620775424 1332721664
partition #3: 7 00 1023/254/63 1023/254/63 201345024 419430400
partition #4: 7 00 0/ 32/33 1023/254/63 2048 201342976
Finally everything converted to LBAs and then to GB (1024^2 kB):
partition #1: 7.875 7.875 796.011 100.007 ( 0.000 / -696.004)
partition #2: 7.871 7.875 296.009 635.491 ( 0.004 / 339.482)
partition #3: 7.875 7.875 96.009 200.000 ( 0.000 / 103.991)
partition #4: 0.001 7.875 0.001 96.008 ( 7.874 / 96.007)
You see that partition #1 (the last entry in the table) features a
negative size!
Here is what Windows 7 diskpart (current updates installed) says about
the partitions (partition number, offset, size):
0, 296 GB, 635 GB
1, 1024 GB, 96 GB
2, 96 GB, 200 GB
3, 796 GB, 100GB
4, 296GB, 296GB * (Boot Partition)
5, 596GB, 200GB
6, 896GB, 35GB
(I have no idea how Microsoft numbers the partitions)
It would be great if parted could not only complain, but also suggest
how to fix the problems detected, just like fsck does for years.
Regards,
Ulrich Windl
- bug#18984: Enhancement request: Handling of damaged partition tables,
Ulrich Windl <=