# uBlaze: Cannot make ram disk smaller than 3 mb

**URL:** <https://forums.freertos.org/t/ublaze-cannot-make-ram-disk-smaller-than-3-mb/6079>\
**Category:** Kernel\
**Created:** [July 25, 2016, 7:55am UTC](https://forums.freertos.org/t/ublaze-cannot-make-ram-disk-smaller-than-3-mb/6079 "2016-07-25T07:55:45Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [July 25, 2016, 7:55am UTC](https://forums.freertos.org/t/ublaze-cannot-make-ram-disk-smaller-than-3-mb/6079/1 "2016-07-25T07:55:45Z")

</div>

**[rasty1](https://sourceforge.net/u/rasty1/)** wrote on [Monday, July 25, 2016](https://sourceforge.net/p/freertos/discussion/382005/thread/f744d5f3/#fceb):

Hi,  
I’m trying to optimize a footprint and reduce size of Ram disk, but get error if I define it smaller than 3 mb.  
Image contains backtrace, place where it fails and some local variables.  
I’d appreciate any idea.  
[https://rslutsker-gmail.tinytake.com/sf/ODUzNjA5XzM3MTEwMTE](https://rslutsker-gmail.tinytake.com/sf/ODUzNjA5XzM3MTEwMTE)

Thanks  
Rasty

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [July 25, 2016, 7:58am UTC](https://forums.freertos.org/t/ublaze-cannot-make-ram-disk-smaller-than-3-mb/6079/2 "2016-07-25T07:58:21Z")

</div>

**[rasty1](https://sourceforge.net/u/rasty1/)** wrote on [Monday, July 25, 2016](https://sourceforge.net/p/freertos/discussion/382005/thread/f744d5f3/#459c):

Backtrace and variables

---

<div class="post-metadata">

**Author:** ![rtel](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/rtel/32/31_2.png) [@rtel](https://forums.freertos.org/u/rtel)\
**Post date:** [July 25, 2016, 10:16am UTC](https://forums.freertos.org/t/ublaze-cannot-make-ram-disk-smaller-than-3-mb/6079/3 "2016-07-25T10:16:59Z")

</div>

**[rtel](https://sourceforge.net/u/rtel/)** wrote on [Monday, July 25, 2016](https://sourceforge.net/p/freertos/discussion/382005/thread/f744d5f3/#459c/bab8):

FAT imposes some minimum volume sizes. For example see the following  
thread: [http://superuser.com/questions/74392/minimum-volume-size-for-fat16](http://superuser.com/questions/74392/minimum-volume-size-for-fat16)

The minimum size for FAT12 is smaller.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [July 25, 2016, 11:28am UTC](https://forums.freertos.org/t/ublaze-cannot-make-ram-disk-smaller-than-3-mb/6079/4 "2016-07-25T11:28:15Z")

</div>

**[rasty1](https://sourceforge.net/u/rasty1/)** wrote on [Monday, July 25, 2016](https://sourceforge.net/p/freertos/discussion/382005/thread/f744d5f3/#cb43):

How can I force it to use FAT12?

---

<div class="post-metadata">

**Author:** ![htibosch](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/htibosch/32/62_2.png) [@htibosch](https://forums.freertos.org/u/htibosch)\
**Post date:** [July 25, 2016, 8:19pm UTC](https://forums.freertos.org/t/ublaze-cannot-make-ram-disk-smaller-than-3-mb/6079/5 "2016-07-25T20:19:26Z")

</div>

**[heinbali01](https://sourceforge.net/u/heinbali01/)** wrote on [Monday, July 25, 2016](https://sourceforge.net/p/freertos/discussion/382005/thread/f744d5f3/#1f17):

Unfortunately, the `FF_Format()` routine does not (yet) support FAT12, only FAT16 and FAT32.

Two parameters indicate your preference:

`xPreferFAT16`: try to use FAT16, if not possible, try FAT32  
`xSmallClusters`: try small clusters first, if not possibly, try larger clusters.

Larger clusters are more efficient in terms of speed, small clusters have less waste of space.

Microsoft states that:

```auto
    if( CountofClusters < 4085 )
    {
        /* Volume is FAT12 */
    }
    else if( CountofClusters < 65525 )
    {
        /* Volume is FAT16 */
    }
    else
    {
        /* Volume is FAT32 */
    }

```

+FAT is following Microsoft’s guidelines to get a maximum compatibility. However, you are not going to exchange your RAM disk with another system.

You could try the following in `ff_format.c` :

```auto
#ifdef ffconfigMIN_CLUSTERS_FAT16
    #define MIN_CLUSTERS_FAT16 ffconfigMIN_CLUSTERS_FAT16
#else
    #define MIN_CLUSTERS_FAT16 ( 4085 + 1 )
#endif

```

And define `ffconfigMIN_CLUSTERS_FAT16` in your `FreeRTOSFATConfig.h` with a smaller value of e.g. :

```auto
    #define ffconfigMIN_CLUSTERS_FAT16 1800

```

Regards.

---

<div class="post-metadata">

**Author:** ![htibosch](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/htibosch/32/62_2.png) [@htibosch](https://forums.freertos.org/u/htibosch)\
**Post date:** [July 25, 2016, 10:00pm UTC](https://forums.freertos.org/t/ublaze-cannot-make-ram-disk-smaller-than-3-mb/6079/6 "2016-07-25T22:00:40Z")

</div>

**[heinbali01](https://sourceforge.net/u/heinbali01/)** wrote on [Monday, July 25, 2016](https://sourceforge.net/p/freertos/discussion/382005/thread/f744d5f3/#5a8d):

Just tested in the WIN32 demo project and it works as expected.

A 2MB RAM-disk will get **4023** clusters, a 1MB disk gets **1991** clusters. In these cases, each cluster will contain a single sector of 512 bytes.
