Opened 11 years ago

Closed 5 years ago

Last modified 4 years ago

#9856 closed bug (fixed)

DriveSetup allows "formatting" an extended-partition / wastes the partition table

Reported by: ttcoder Owned by: stippi
Priority: normal Milestone: R1/beta2
Component: Applications/DriveSetup Version: R1/Development
Keywords: Cc:
Blocked By: Blocking:
Platform: All

Description

hrev45824

I might have found a serious bug in DS:

  • if you have a partition you want to get rid of because it's set as "extended" (instead of "primary"), with, say, one sub-partition inside it;
  • and one or more primari'es behind it;
  • and you select the mother (extended) partition at the beginning, rather than the sub-partition inside it and do Format... Be File System, your HDD contents is lost.

More precisely -- the HDD appears normal at fast, but once you reboot, the Haiku boot menu says "no bootable partition".. Using another media (e.g. USB) to boot and opening DriveSetup from there, you see your HDD completely empty of any partition.

I'm guessing an extended partition has some overhead compared to a primary one, a few KB or MB, and if DS formats it again as primary it does not account for the "gained" space and recalculates the offsets of the partitions behind it, even though their physical offset on the disk has not changed, which makes them invisible. That theory would explain the loss of the partitions behind the number one but now why I lost the first one too though.

Anyhow the "format" submenu should probably be grayed out when an extended partition is selected, to hint at the correct way to get rid of it: do a "Delete", then recreate it with "Create" as a primary, and then one may format it to BFS I guess.

Attachments (2)

drivesetup_1_aftermarth.png (65.4 KB ) - added by ttcoder 11 years ago.
Fallout after first reboot: HDD is wiped clean, no partitions recognized (maybe the 0xff everywhere don't help?)
drivesetup_2_hackfixed.png (41.8 KB ) - added by ttcoder 11 years ago.
After a few hours of dumb experiments I finally understood I had to wipe out the partition table and enter the original offsets by hand in diskprobe; then after rebooting I can mount my partitions again (last two, gotta do the first ones now)

Download all attachments as: .zip

Change History (6)

comment:1 by ttcoder, 11 years ago

I'm not anxious to try and reproduce this since this is my dev machine and time is tight... But I collected some data and can answer questions while the sequence of events is fresh in my mind.

I spent the whole evening on this, reading mmlr's article on makebootable that explains the MBR structure ..etc, and finally recovered all my data by hacking offsets in DiskProbe BTW.. one more reason to not go back in the salt mines and leave someone else to investigate this ;-)

by ttcoder, 11 years ago

Attachment: drivesetup_1_aftermarth.png added

Fallout after first reboot: HDD is wiped clean, no partitions recognized (maybe the 0xff everywhere don't help?)

by ttcoder, 11 years ago

Attachment: drivesetup_2_hackfixed.png added

After a few hours of dumb experiments I finally understood I had to wipe out the partition table and enter the original offsets by hand in diskprobe; then after rebooting I can mount my partitions again (last two, gotta do the first ones now)

comment:2 by ttcoder, 5 years ago

Looks like this is resolved by hrev52779, close this ?

comment:3 by diver, 5 years ago

Resolution: fixed
Status: newclosed

Indeed :)

comment:4 by nielx, 4 years ago

Milestone: R1R1/beta2

Assign tickets with status=closed and resolution=fixed within the R1/beta2 development window to the R1/beta2 Milestone

Note: See TracTickets for help on using tickets.