RE: http://defect.opensolaris.org/bz/show_bug.cgi?id=6854
Automated Installer can provide FAT formatting
We want to offer automatic formatting of new DOS partitions created through AI.
The current solution relies upon mkfs_pcfs(1M), which requires either a logical
drive letter ('c'-based) or number (zero-based).
AI has all information for the new fdisk format table, yet none of that
information seems to lead to an absolute correlation of the
drive letter for a given DOS partition, the consequence of which can be that
the wrong partition is formatted.
This becomes evident when different DOS partition types are mixed. For
example, I have been testing with partitions (in this order):
1 FAT32 <2G, /dev/rdsk/cxtxdxp1
1 DOS16. /dev/rdsk/cxtxdxp2
1 FAT32 extended, /dev/rdsk/cxtxdxp3
1 Solaris, /dev/rdsk/cxtxdxp4
From the man page, it might be assumed that the logical drive letter
assignments would be as follows:
C: FAT32 <2G
D: DOS16
E: FAT32 extended
So that to format the third partition, the following command might be issued:
mkfs -F pcfs -o fat=32 /dev/rdsk/cxtxdxp0:e
--where 'e' is selected because it is the 3rd DOS partition in the table (or
alternatively, '2')
But there appears to be nothing that guarantees that this drive letter matches
the second DOS partition. I have seen several
examples where the ordering was not followed. Furthermore, I looked at the
sector number ordering and found no reliable correlation
between logical drive letter and the sector ordering, either.
The actual logical drive letter assignment is:
C: FAT32 <2G
E: DOS16
D: FAT32 extended
Assignment of the logical drive letters appears to be internally consistent and
reliable, but that does not help with finding the
logical drive letter based on the fdisk format table information.
It appears that, since the logical drive assignment does not occur as
documented, this is a bug in the code that performs the
assignment.
Possible workarounds:
- AI looks at the raw partition data and determines the type, whether it is
formatted, and determines the logical drive letter from
the raw partition data before using mkfs_pcfs to format
- AI uses the same library calls as mount(1m) and mkfs(1m) to determine the
logical drive letter
Does anyone have any ideas on the best approach to this for the Automated
Installer?
William Schumann