Opened 6 years ago

Closed 7 months 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
Component: Applications/DriveSetup Version: R1/Development
Keywords: Cc:
Blocked By: Blocking:
Has a Patch: no 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 6 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 6 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 (5)

comment:1 Changed 6 years ago by ttcoder

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 ;-)

Changed 6 years ago by ttcoder

Attachment: drivesetup_1_aftermarth.png added

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

Changed 6 years ago by ttcoder

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 Changed 7 months ago by ttcoder

Looks like this is resolved by hrev52779, close this ?

comment:3 Changed 7 months ago by diver

Resolution: fixed
Status: newclosed

Indeed :)

Note: See TracTickets for help on using tickets.