[haiku-development] Re: Available spaces on partitions

  • From: Ingo Weinhold <ingo_weinhold@xxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Sun, 03 Feb 2008 00:37:38 +0100

On 2008-02-02 at 15:09:47 [+0100], Stephan Assmus <superstippi@xxxxxx> wrote:
> 
> Bruno Albuquerque wrote (2008-02-02, 14:53:39 [+0100]):
> > Stephan Assmus escreveu:
> > 
> > > I would like to get some feedback on a question regarding available
> > > spaces on partitions that are smaller than a certain "threshold". I
> > > think these spaces appear because of positioning restrictions for
> > > partitions with certain hard drive layouts and properties. I don't know
> > > enough about it, but I have encountered these "unavailable for
> > > partitions" spaces anytime I have dealt with partitioning tools,
> > > especially when installing Windows. For example, I would create one big
> > > partition to cover the entire drive, and after doing so, there would be
> > > 8 MB of empty space left besides the new partition -> Huh? My questions
> > > are, I guess, 1) wether this is really unavoidable because of some
> > > placement restrictions. 2) wether to show these to the user at all (I
> > > guess not). And 3) if there is any more reliable way to detect a "bogus
> > > space" other than looking at it's size and, say, ignore anything below
> > > or at 8 MByte. Maybe with even bigger drives, these spaces could be
> > > more than 8 MByte. Like I said, I don't know enough about the subject,
> > > any feedback appreciated.
> > 
> > There is no way to avoid this wasted space. I am not really sure why but
> > I guess it is related to rounding to cilinders. I guess for the usual
> > user not showing this space is better but an option to show it could be
> > usefull for an advanced user. And I am not sure what is the best way to
> > detect when the space is unusable. I know that if you try to create a
> > partition there, it fails.
> 
> The rounding to cylinders could certainly be it.

It most likely is. Although it's kind of a legacy thing. I'm not sure, if 
the real physical geometry is known anyway -- AFAIK the one reported to the 
BIOS is dictated by the size of the involved limited structure fields. To 
avoid compatibility problems (that probably don't even exist with any 
existing software that is actually still in use) we force that alignment 
too, when creating partitions, I suppose. Neither the kernel nor the 
userland add-on do that ATM, though.

> Sounds very convincing. In
> that case, we could ignore spaces below the "cylinder size". At quick
> glance, I have not seen a way to retrieve that, but maybe it is already
> supported, or else I could try to add it.

It would be the userland add-on's responsibility to report only actually 
partitionable spaces (not that of API users, like e.g. DriveSetup). It 
doesn't do that yet, though. In fact the device geometry is not available 
through the disk device API yet. The kernel class KDiskDevice knows it, but 
it's not part of the user_disk_device_data structure and thus not passed to 
BDiskDevice.

CU, Ingo

Other related posts: