-
Notifications
You must be signed in to change notification settings - Fork 3k
SD card FAT format with multipartitions are not compatible with PC #5999
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@JaniSuonpera, are you attempting to access this partitioned micro SD card in Windows? Afaik, the Windows driver does not support viewing partitioned removable media. If you're attempting to view this in Linux, could you provide system information on the machine? |
@geky I have Lenovo desktop Linux (Ubuntu 16.04 LTS) PC. I have tested this with external (https://www.transcend-info.com/Products/No-331) and internal SD card reader. Result is same after formatting with K64F. If I create partitions (FAT32) with Linux program gparted then Linux filemanager is able to mount both partitions from SD card. Same is case also with Windows 10 (Lenovo T460s) laptop with external SD card reader (https://www.transcend-info.com/Products/No-331). Formatting available partitions from SD card with mbed-os makes SD unreadable with PC. Linux shows that partition type is unknown. There seems to be some issue to use MBRBlockDevice. If initialize CD card with PC to FAT32 single partition mode and use only BlockDevice pointer for format then SD card is readable with PC. I use MBRBlockDevice pointer for format then SD card is unreadable with PC. FYI @JanneKiiskila |
Hi @JaniSuonpera, sorry for the delay. It looks like there was a regression in the FAT filesystem regarding extra MBR blocks. Does #6074 fix your issue? |
Hi @geky, I tested #6074. Formatting single partition FAT32 SD card is working fine. For dual partition it depends, which kind partitions exists in SD card. If there are two FAT32 primary partitions then after format there are two FAT16 primary partitions. If there is one FAT32 primary partition and extended partition, which contains one FAT32 logical partition, then after format partition one is FAT16 and partition two is unknown type. If create partitions with MBRBlockDevice::partition and format then both will be FAT16 primary partitions. How I can create FAT32 partitions with MBRBlockDevice::partition? How about logical partitions? It is logical partitions supported? |
Logical partitions are currently not supported. Though it would be a good idea to error rather than allowing the filesystem to overwrite logical partitions. I added a check for logical partitions to #6074. As for why you can't create a FAT32 partition: it's not allowed. After partitioning your block device the number of clusters are small enough that they fit in FAT16, so it must be FAT16. There's actually no other identifier that marks the difference between the filesystems other than the cluster count. Try formatting the FAT filesystem on your PC, it should still show up as FAT16. Fortunately, FAT12/FAT16/FAT32 are all handled the same by host OSs. So you should be able to mount and use the filesystem without worrying about the difference between FAT12/FAT16/FAT32. I wouldn't think of these as three different filesystems, because in order to support the full range of block device sizes you need to support all three. |
I approve #6074. Please release it next mbed-os 5.7.X release. These limitations must document somewhere. |
Noted, I made another pr to mention this: #6095. This patch has already been merged, so you can expect it on 5.7.6. |
Thanks @geky for good & quick support! |
Also thank @cmonr and the maintainers for the quick turnaround on prs : ) |
@geky It's easy when the PRs are small and well documented :) |
Description
Bug
Target
K64F
Toolchain:
GCC_ARM
mbed-os sha:
(
git log -n1 --oneline
)caeaa49 (HEAD, tag: mbed-os-5.7.4, origin/mbed-os-5.7) Merge pull request #5954 from ARMmbed/release-candidate
Expected behavior
Actual behavior
Steps to reproduce
Initialize BlockDevice point to SD e.g. with
BlockDevice *bd = storage_selector();
// Create a partitions
MBRBlockDevice::partition(bd, 1, 0x83, 0, 10241024);
MBRBlockDevice::partition(bd, 2, 0x83, 10241024, 210241024);
// Create the block device that represents the partition
MBRBlockDevice part1(bd, 1);
MBRBlockDevice part2(bd, 2);
// Format the partitions with a FAT filesystem
FATFileSystem::format(&part1);
FATFileSystem::format(&part2);
Check SD card with PC.
The text was updated successfully, but these errors were encountered: