[cAos-devel] Cinch partition_scan (was Re: System Imager)
Greg Kurtzer
gmkurtzer at gmail.com
Wed Feb 28 18:07:16 GMT 2007
On Feb 28, 2007, at 12:28 AM, Martyn wrote:
> Greg Kurtzer wrote:
>> Dang, I wrote that code eons ago!
> I know that feeling!
>> I think what happened was that I was originally also grabbing the
>> partition type which you can't get from /proc/partitions. Then I
>> removed that logic for something else and didn't rewrite the
>> function to use /proc/partitions.
> That's not really what it looks like, here's what I think it's doing :
>
> scan_partitions seems to read /proc/partitions, then to check that
> the partition is really accessible you run fdisk on the *partition*
> and if it outputs an error, assume it's a valid partition.
Yea, I think you read the code correctly. As I mentioned, eons. hehe
> Unfortunately, there appear to be a few situations (partition used
> to be an extended, is now a primary is common) where fdisk will
> output a partition table /from inside/ a partition.
Thats weird. Who would do such a dastardly deed?
> I know I had a hard time getting this info through to Michael on
> irc (too many opportunities for misunderstanding), so I'll repeat
> and rephrase : scan_partitions looks at /proc/partitions and sees
> for example hda1-4, so you run fdisk /dev/hda1 and check for error
> to see if it's a valid partition; rinse and repeat. If for example
> hda4 used to be an extended partition, there's no error output, so
> cinch ignores it. That seems to be the same for some XP NTFS
> partitions too as fdisk somehow interprets some data at the start
> of the partition (I'd assume a backup of the partition table within
> the fs, but not certain).
Michael probably didn't get what you were saying because it seems,
uhm,... rather wacked out. Well, I guess now we know who would do
such a thing. ;)
Extended partitions shouldn't show up here, so this is expected
output. partitions_display will contain a list of all partitions that
can be formatted and mounted/installed to.
Now, why a NTFS partition wouldn't error out on a fdisk -l is wacky.
Being that I can't test on any systems directly, I am open for
suggestions.
> As I say, the workround is to obliterate the start of all the valid
> partitions, then cinch will get an error from them, but I don't
> think that's a "solution" by any means.
Well, that definitely fixes the *Windows* being installed issue,
don't it? hehe
> Hopefully I've explained well enough, but ask for more
> clarification and I'll try and explain differently. If you think
> there's a possibility of the kernel not catching up with the
> partitions or something, I'd suggest using dd to verify we can read
> from the partition instead of fdisk (If that's why it's doing it!).
I think I am getting it, but just unable to reproduce locally so
kinda hard to debug and test other workarounds.
As I mentioned, I am open to suggestions. :)
Thanks,
Greg
--
Greg Kurtzer
I believe the world would be a better place if people didn't
believe in their beliefs. -- gmk
More information about the cAos-devel
mailing list