# How to calculate avaliable space in RCM2200 board for SRam FS2 System

**URL:** <https://forums.digi.com/t/how-to-calculate-avaliable-space-in-rcm2200-board-for-sram-fs2-system/12934>\
**Category:** Rabbit Software\
**Tags:** fs2, sram, rcm2200, memory\
**Created:** [May 9, 2014, 9:04am UTC](https://forums.digi.com/t/how-to-calculate-avaliable-space-in-rcm2200-board-for-sram-fs2-system/12934 "2014-05-09T09:04:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![soonki](https://avatars.discourse-cdn.com/v4/letter/s/b5a626/32.png) [@soonki](https://forums.digi.com/u/soonki)\
**Post date:** [May 9, 2014, 9:04am UTC](https://forums.digi.com/t/how-to-calculate-avaliable-space-in-rcm2200-board-for-sram-fs2-system/12934/1 "2014-05-09T09:04:52Z")

</div>

Greetings,

I am using RCM2200 board; DCRabbit ver 9.62  
In my project, I am required to store an Alarm Log and some user settings (3 FS2 files total)  
I want to store as many Alarm Logs as possible.

Question 1: How do I calculate how much SRam space avaliable for me to use?

I configure FS2 filesystem for that purpose as below:

Question 2: Is it the right/best way?

// memconfig.lib: "#define FS2\_RAM\_RESERVE 12 //12x4096=49152 bytes  
// STDBIOS.C: "#define DATAORG 0x9000

#define FX\_MAX\_FILES 3  
#define FS2\_USE\_PROGRAM\_FLASH 0  
#use “FS2.LIB”

void setupFS()  
{ int b, i;  
Hinfo h; // Empty Log Record, value will be overwrite  
FSLXnum Ram;  
File file;  
Ram=fs\_get\_ram\_lx();  
b=fs\_init(0,0);  
b=fs\_format(0,0,0);  
b=fcreate(&file, 1);  
b=fopen\_wr(&file, 1);  
for(i=0;i

---

<div class="post-metadata">

**Author:** ![trooper2](https://avatars.discourse-cdn.com/v4/letter/t/edb3f5/32.png) [@trooper2](https://forums.digi.com/u/trooper2)\
**Post date:** [May 9, 2014, 9:16am UTC](https://forums.digi.com/t/how-to-calculate-avaliable-space-in-rcm2200-board-for-sram-fs2-system/12934/2 "2014-05-09T09:16:08Z")

</div>

See Chapter 10 of the Dynamic C user manual:

The maximum file size for an individual file depends on the total file system size and the number of files  
present. Each file requires at least two sectors: at least one for data and always one for metadata (for information  
used internally). There also needs to be two free sectors per file to allow for moving data around.  
Here is a formula you can use to determine how many bytes to allocate for the total file system (assuming  
all files are the same size):  
Bytes = (Nbr\_of\_files \* file\_size \* 1.14 ) + (Nbr\_of\_files \* 128) +  
(2 \* 128)  
FS2 supports a total of 255 files, but storing a large number of small files is not recommended. It is much  
more efficient to have a few large ones.
