Uno with a 500 GB hard drive

I just got a 500 GB FAT32 hard drive to work on an Uno using this USB host shield https://www.circuitsathome.com/products-page/arduino-shields/usb-host-shield-2-0-for-arduino

I have no idea why you would need 500GB on an Uno but it works.

Here is the program:

#include <SPI.h>
#include <UsbFat.h>
#include <masstorage.h>

USB usb;
BulkOnly bulk(&usb);
UsbFat hdd(&usb, &bulk);
File file;

void setup() {
  Serial.begin(9600);
  Serial.print(F("FreeRam "));
  Serial.println(FreeRam());

  // Init the USB hdd.
  if (!hdd.begin()) {
    Serial.println("hdd.begin failed");
    return;
  }
  Serial.print(F("\r\nVolune Size: "));
  Serial.print(0.000000001*512UL*hdd.vol()->blocksPerCluster()*hdd.vol()->clusterCount());
  Serial.println(F("GB"));

  file.open("test.txt", O_CREAT | O_RDWR);
  file.println("Hello USB");
  file.close();
  Serial.println();

  hdd.ls(&Serial, LS_A | LS_DATE | LS_SIZE);
  Serial.println();
  Serial.println("Done");
}
void loop() {}

Here is the output. I have some extra test files on the drive.

FreeRam 850

Volune Size: 499.98GB

2000-01-01 01:00:00 11 test.txt
2014-11-11 09:14:56 65 With.Two dots.txt
2014-11-14 10:29:08 151 A long name can be 255 characters.txt
2014-11-11 09:03:54 45 LFN,NAME.TXT
2014-11-11 09:14:56 186 lower.txt
2014-11-11 09:14:56 188 MIXCASE.txt
2014-11-11 09:14:56 184 mixed.TXT
2014-11-11 07:57:28 67 Not_8_3.txt
2014-11-11 07:54:26 30 OK%83.TXT
2014-11-11 07:59:42 33 STD_8_3.TXT
2014-11-11 08:59:48 59 With Blank.txt
2000-01-01 01:00:00 1 test.bin

Done

If 500GB works, what is the likely maximum size? 2TB seems to be the crucial one...

When you have a spare afternoon, you might like to knock up a quick version of NTFS so we can have 4GB+ file sizes :wink: :stuck_out_tongue: ??

You have made some significant developments recently, I for one appreciate your efforts. LFN in SdFat was a nice touch too.

Regards,

Graham

A FAT32 volume is limited to 2TB for 512 byte blocks. The total number of blocks in a volume is a 32-bit field.

When you have a spare afternoon, you might like to knock up a quick version of NTFS so we can have 4GB+ file sizes

exFAT is a better choice than NTFS. exFAT has much better performance on large SDXC cards. These cards are designed for and the standard specifies exFAT for these cards.

An exFAT volume can be 128 PiB and I think a file can use the entire volume. A PiB is 2^50 bytes.

I am looking at exFAT but I don't see how it could be implemented for Uno. I did hide the option to format SDXC cards FAT32 in the SdFormatter example. This allows 256 GB or larger SDXC cards to be used in SdFat.

500GB would make a heck of an MP3 player if it could run on batteries. I have some Neuros Audio MP3 players that I can't get to turn on anymore. The LiPo battery died, I replaced it with another and confirmed it is charged, but it won't turn on. 80GB drives in those.

Would exFAT impact read/write performance over FAT32? How seriously are you thinking about making an SdexFAT/USBexFAT? My own particular usage would be on a DUE, but I can understand you wishing to appeal to the wider market (Mega2560).

The reason for asking about performance, is that I have a 32GB Sandisk Cruzer Slice, and it came ready formatted as FAT32, which was fine up to the point I tried to put a 8GB iso file on to it....... Did some reading, came across exFAT/NTFS comparisons, pros/cons........... General gist was no point bothering with exFAT when NTFS does everything better and on more platforms, but exFAT would be OK solely on windows based systems. Something to do with Microsoft licensing agreements. However back to my story, I formatted my Cruzer Slice as NTFS, default cluster size............ and forgive me, but I no longer have the benchmark figures........... but NTFS is dog slow...........compared to FAT32 in terms of read/write performance............ BUT I can now write 8GB files to it given an evening to do so.... This is on a 6 Core 3.2GHz AMD Phenom Win 7 x64 system...... which should tick along at a reasonable pace. What performance would a lowly Arduino likely achieve?

Regards,

Graham

Great job,

I have no idea why you would need 500GB on an Uno but it works.

similar things are said about a lot of technologies…

There will be people coming up with a myriad of applications, it could be used for

  • an “endless” game so many levels
  • foto frame arduino based
  • to hold code for an Arduino based interpreter.
  • to log all you can for a long time …

Would exFAT impact read/write performance over FAT32?

I see benchmarks for exFAT/NTFS with at least three times better performance for exFAT.

exFAT is the standard file system for SD cards larger than 32 GB. exFAT has a lot in common with FAT32.

The Memory Stick XC™ Series adopted exFAT file system for its new memory stick cards enabling high speed data storage.

exFAT can have huge clusters, up to 32 MB. This is good for flash devices. 128 KB clusters are the default for SDXC which is the erase size for flash on many devices.

There doesn't seem to be a big problem with Microsoft. I think Microsoft will tolerate free open source software.

Please note that open source or other publicly available implementations of exFAT do not include an IP license from Microsoft.

Samsung has put source for an implementation on a file server.

Oh ok, that's good then. It was a couple of years ago since I read the comparisons between NTFS/exFAT.... and I have not looked into it again since. Perhaps things have progressed ;D

Graham

Update: However, exFAT should be a true competitor to NTFS on flash-based systems with limited processing power and memory. NTFS on flash memory has been known to be inefficient for quite some time. exFAT’s smaller footprint/overhead makes it ideal for this purpose.

Ok you were right as usual... :wink: