4

A thumb drive is obviously a chunk of EEPROM, including a controller/microprocessor to store/retrieve the files stored on it. The operating system normally communicates with the thumb drive, and all thumb drives operate in all operating systems (I think). So there must be a protocol somewhere for how to address/command a thumbdrive over a USB port. I am interested in getting the data from a thumb drive that pertains to what memory blocks are actually occupied by a specific file. Does anybody out there know of a reference that describes thumb drive memory management and protocol?

I tried asking this on Stack Overflow and it was suggested I try here.

fixer1234
  • 27,486
jrdoner
  • 41
  • 1
  • Would it be sufficient, for your purposes, to know what sectors a file occupies, or do you specifically need to know what memory blocks are in use on the EEPROM itself? – misha256 Dec 25 '14 at 03:55

2 Answers2

3

The way a USB Thumb Drive organizes data internally is transparent to a host.

Just like a hard drive, data is written and read using LBA (Logical Block Addressing):

http://wiki.osdev.org/LBA

When a host sends data to a LBA block on a Thumb Drive, the Thumb Drive is free to store that data in any way it likes, so long as the same data is returned when you read that block. You don't get to know how it stores the data on EEPROM (this can be very complex due to wear-levelling, error correction, and performance technologies being employed).

I am interested in getting the data from a thumb drive that pertains to what memory blocks are actually occupied by a specific file.

I suspect what you're actually looking for is information about what LBAs are in use by a particular file. That is a function of the file-system in use, and such information is obtained from the OS, not the USB device. That's because it's the OS that manages files and the mapping of file data to sectors and in turn the mapping of sectors to LBAs on the Thumb Drive.

This is excellent reading on the subject:

http://www.wd-3.com/archive/luserland.htm

misha256
  • 11,393
1

The USB mass storage device class (also known as USB MSC or UMS) is a set of computing communications protocols defined by the USB Implementers Forum that makes a USB device accessible to a host computing device and enables file transfers between the host and the USB device.

from the WikiPedia page.

Here is a boring, technical PDF titled "Reduced Block Commands, Draft Proposal".

And here is a more human-friendly page with a bunch more links that should help you get started.

Sounds like a fun project!

BenjiWiebe
  • 9,015