+FAT multiple partitions. Readable on Windows?

Hi. I’m currently using the ELM-FAT library on my embedded system to create two partitions on an SD card, and format them both as FAT32. The problem is that when I then pop that SD card into my PC, I can only access the first partition from Windows. This is a known limitation of that system. If I do this using the FreeRTOS +FAT system instead, will I be able to access all partitions from Windows? Thanks. -Spike

+FAT multiple partitions. Readable on Windows?

If I do this using the FreeRTOS +FAT system instead, will I be able to access all partitions from Windows?
Provided they are formatted in accordance with the Windows requirements, then yes.

+FAT multiple partitions. Readable on Windows?

Thanks for your response. I’m confused though: If I use your FFPartition and FFFormat functions, why wouldn’t they be in accordance with the Windows requirements? Is it just a matter of using the right parameters?

+FAT multiple partitions. Readable on Windows?

Is it just a matter of using the right parameters?
Yes. The official FAT spec has requirements for the minimum size, etc. If you create a disk that does not fall into that spec then +FAT might be happy to use it, but Windows won’t.

+FAT multiple partitions. Readable on Windows?

Hi Michael, in the FreeRTOS+FAT demo projects, in ff_sddisk.c, you will see that :
BaseType_t xPartitionNumber = 0;
Just because 99% percent of the memory cards have a single partition. But there may be good reasons to use 2 partitions and +FAT will indeed recognise them: both primary as well as extended/logical partitions. If you are using SD-cards, be aware that only the first partition will have it’s FAT table in a FAT-optimised area ( the second 4MB erase block ). So you might notice that subsequent partitions are slower, and maybe even less reliable. Within ff_ioman.c you see how partitions are being discovered, with the function FF_PartitionSearch(): ~~~ xPartitionCount = FFPartitionSearch( pxIOManager, &partsFound ); if( FFisERR( xPartitionCount ) ) { xError = xPartitionCount; break; } ~~~

+FAT multiple partitions. Readable on Windows?

Forgot to tell how the two ( or more ) partitions will be represented in the file system. Normally there is an SD-card with a single partition, which will be found in the root ("/"). As an example, the following files are located in the first partition mounted on "/": ~~~ /readme.txt /etc/config.ini /firmware/bootloader.hex ~~~ The modules ff_sys.c and ff_stdio.c allow you to combine several volumes into a single file system. For instance, if you create a RAM disk, you can mount its root on e.g. "/ram" : ~~~ /ram /ram/files/picture1.jpg /ram/tmp/_WM68C7.tmp ~~~ When the first partition of the SD-card is mounted as "/", you can mount the second partition as follows: ~~~ FFFSAdd( “/part2”, pxDisk_2 ); ~~~ The user interface of FreeRTOS+TCP has two layers: 1) Lower level functions that work on a single volume. FF_Open(), FF_Read(), FF_Write(). These functions will not recognise your "/part2". 2) STDIO-compatible functions that do recognise mounted volumes, such as "/ram" and "/part2", These functions have a prefix "ff_", such as ff_fopen(), ff_fread()/ff_fwrite(), and ff_fclose(). It sounds all more complicated than it actually is. It works very much like mounting in Linux, except that the mount-points are always located in the root directory. There have recently been some essential changes to a few +FAT source files, I’m attaching these changes here below in ff_sys.zip.

+FAT multiple partitions. Readable on Windows?

So, in order to use this system to format an SD card with two partitions, do I need to create two FFDiskt objects with two different calls to FF_SDDiskInit?

+FAT multiple partitions. Readable on Windows?

That is correct, you will need everything double. Two partitions are being treated as different disks. And it is only in ffsys.c and ffstdio.c where the two drives come together in a single “file system” But the first thing to do is call FF_PartitionSearch(), as described here above.

+FAT multiple partitions. Readable on Windows?

Edit: deleted. Better questions to follow…

+FAT multiple partitions. Readable on Windows?

Hi Machael, your original question in the email was:
Why would the two drives come together in a single file system? Shouldn’t each partition have its own file system?
I will answer it for the other people following this thread: you are right, each partition is a file system on its own. But ff_sys.c and ff_stdio.c will map one of the partitions onto a symbolic directory. All files under e.g."/part2" will refer to the second partition. Other files and directories within the root directory are all located on the first partition.
Better questions to follow…
I’m all curious 🙂

+FAT multiple partitions. Readable on Windows?

Another way to look at it is that there are several ways to express a multi-volume/partition file system. In windows we are used to ‘Drive Letters’ where the main hard drive is C:, and other drivers are given a distinct letter. This has a fundamental limit of 26 volumes/partitions. A second method, also used in windows is the \servershare prefix. A third method, used on *nix like systems is that / is the root of all systems and some directory (like /part2) is mapped to point to the other volumes/partitions.