News:

  • November 23, 2026, 11:22:08 AM

Login with username, password and session length

Author Topic: SD Card File Limit?  (Read 17897 times)

ATU

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 2126
  • YKPAIHA
    • ATU, Inc.
SD Card File Limit?
« on: February 20, 2024, 11:57:31 AM »
Ran into an issue where I was logging data using the FILELOG instruction to a directory on the SD Card.  Sorry, I should have recorded more information but under the gun to get it working again.  When I got there, the directory had exactly 599 files, but the card had plenty of space. I had to delete files to get it working. I ended up upgrading the firmware.  Is there a file limit for a directory or a limit the instruction can deal with finding the file to log?

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6180
  • Yes Pinky, Do-more will control the world!
Re: SD Card File Limit?
« Reply #1 on: February 20, 2024, 02:03:19 PM »
Ran into an issue where I was logging data using the FILELOG instruction to a directory on the SD Card.  Sorry, I should have recorded more information but under the gun to get it working again.  When I got there, the directory had exactly 599 files, but the card had plenty of space. I had to delete files to get it working. I ended up upgrading the firmware.  Is there a file limit for a directory or a limit the instruction can deal with finding the file to log?

Yes. I was thinking it was 1000, but it might be 600 (599?)...per directory. The issue is performance. It becomes slower and slower. The limit is in the file system itself.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

ATU

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 2126
  • YKPAIHA
    • ATU, Inc.
Re: SD Card File Limit?
« Reply #2 on: February 20, 2024, 02:33:06 PM »
Is the 600 limit in the documentation?  I don't recall seeing that.

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6180
  • Yes Pinky, Do-more will control the world!
Re: SD Card File Limit?
« Reply #3 on: February 20, 2024, 02:37:32 PM »
Is the 600 limit in the documentation?  I don't recall seeing that.

Probably not. It's not really a FILELOG limitation, it's a file system limitation, so it may not have been mentioned in the FILELOG text. I'll mention it to the right people.

"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6180
  • Yes Pinky, Do-more will control the world!
Re: SD Card File Limit?
« Reply #4 on: February 20, 2024, 02:40:10 PM »
Well...wait.

I just looked through the code. The original limit was 65535. I have a comment in the code that says 1000, but the value being compared is 3000. Not sure what 599 would be.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

ATU

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 2126
  • YKPAIHA
    • ATU, Inc.
Re: SD Card File Limit?
« Reply #5 on: February 20, 2024, 03:58:32 PM »
Definitely had 599 files in the directory and the FILELOG faulted. Was it always 3000?   I had firmware that was at least 1 or 2 years old

« Last Edit: February 20, 2024, 04:07:00 PM by ATU »

franji1

  • Bit Weenie
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 3858
    • Host Engineering
Re: SD Card File Limit?
« Reply #6 on: February 20, 2024, 04:39:01 PM »
Have you run any file system diagnostics from your PC on your SD card (e.g. CHKDSK, no switches)?  Is it FAT or FAT32 or some other FAT?

Eliminate all that "other" possible stuff.

FAT has its limitations.  Tiny Allocation Sizes vs. File Sizes vs. number of other files (e.g. a tons of tiny files in another folder with HUGE FAT Allocation Size or ...)

ATU

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 2126
  • YKPAIHA
    • ATU, Inc.
Re: SD Card File Limit?
« Reply #7 on: February 21, 2024, 01:09:25 PM »
i  am going to change it to create a monthly folder to avoid any issues after I retire.

franji1

  • Bit Weenie
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 3858
    • Host Engineering
Re: SD Card File Limit?
« Reply #8 on: February 21, 2024, 01:42:59 PM »
Have you run any file system diagnostics from your PC on your SD card (e.g. CHKDSK, no switches)?  Is it FAT or FAT32 or some other FAT?

Eliminate all that "other" possible stuff.

FAT has its limitations.  Tiny Allocation Sizes vs. File Sizes vs. number of other files (e.g. a tons of tiny files in another folder with HUGE FAT Allocation Size or ...)

I had to run my cmd.exe window "as administrator" to properly run chkdsk on one of my sd cards.  My output was the following:

Code: [Select]
C:\WINDOWS\system32> chkdsk e:
The type of the file system is FAT32.
Shadow copying the specified volume is not supported.

Volume Serial Number is C202-D1CC
Windows is verifying files and folders...
File and folder verification is complete.

Windows has scanned the file system and found no problems.
No further action is required.
    7,741,440 KB total disk space.
           36 KB in 2 hidden files.
           20 KB in 4 folders.
       76,424 KB in 120 files.
    7,664,956 KB are available.

        4,096 bytes in each allocation unit.
    1,935,360 total allocation units on disk.
    1,916,239 allocation units available on disk.

ATU

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 2126
  • YKPAIHA
    • ATU, Inc.
Re: SD Card File Limit?
« Reply #9 on: February 22, 2024, 02:16:49 PM »
FAT32
No Errors found