Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

FDS Remaining Size

Hi guys,

I've written a wrapper around the FDS (SD) on SDK 15.0.0 and am trying to calculate remaining space as a combination of my reserved records and written records (in word sizes).

My understanding is this:

  • Page Size = 1024
  • Tag Size = 2 (resulting in an effective page size of 1022)
  • Per Record Header = 3

From this I understand the largest record data size should be 1019, with each full record consuming 1022 (header + data). However in reality I can only store up to 1018 of data and fds_stat() reports a words_used change of 1019 when I would have expected to see a change of either 1022 (3 header + 1019 data) or in the event I'm missing something about the overheads 1021 (3 header + 1018 data).

I'm quite confused over how the filesystem is actually working and how space is consumed, would it be possible to provide some clarity?

On a side-note, when GC is ran on a corrupted filesystem, should I expect the corruption flag set by fds_stat to clear next time it's called? As I've also observed from time-to-time after successful GC that this flag doesn't clear.

Many thanks

Related