2

Why can a USB Flash drive be formatted as NTFS or FAT32? Is the USB Flash Drive and Hard Drive just to be thought of as "an ocean of bytes"?

I get very used to hearing formatting a hard drive as FAT32 or NTFS, but we can also format a USB Flash drive as NTFS or FAT32?

Is it because a hard drive or Flash drive both can be thought of as "an ocean of bits" or "an ocean of bytes"? I remember RAM as: it takes 16 bit or 32 bit as an address signal (the 16 or 32 copper footing on the circuit board), and give out 8 bit of data (the other 8 copper footing on the circuit board). So can a hard drive be thought of as working that way too? So that's why a Flash drive can be the same too? Just an "ocean of bytes".

But is it true that hard drive's hardware make it an ocean of sector or something else, that is, the smaller unit of read / write is not byte but something else?

So with this "ocean of bytes", NTFS has the format that says, "if the first byte is ________, then it means ____ (it is a file or folder, and link to which sector, indicated by byte 2 and 3, etc, etc)"

1 Answer 1

5

You can, but operating systems can't. Both the flash drives and hard drives are read (and written) by sectors and only sectors. The device driver usually applies this restriction to the higher level, and also reading whole sector with e.g. NTFS superblock is much more faster than reading the same sector several times implicitly because of a driver that translates "byte range" requests to "sector" requests, so filesystem drivers are also performing read and write operations by sectors (or any multiplies of sectors: there exists a technology called DMA -- direct memory access -- that allows reading and writing large bursts of sectors without using CPU time thus making disk access very fast).

Flash chips (not drives) are technically divided on other blocks of data because of two reasons:

  1. Flash chips can be read from any position to any position but written only by fixed sized and positioned blocks.
  2. Flash chips contain both more data and free space than you think because it is normal for a chip to gain some failed sectors during work. They are remapped to other sectors by storage controller on USB drive and are not visible for OS as bad sectors; there is actually no software way to check if they exists. Again, flash memory controllers are always equipped with algorithms that allow seamlessly replace failed sectors without any notice for upper layers.

The NTFS doc you are reading does not suggest reading those variables by bytes. You need to read them in whole sectors they contained in, and then address a particular byte in memory.

Also recent memory (virtually any on a 386-compatible machine) is not addressed by bytes. Instead it is addressed by 32- (rarely), 64- and even 128-bit words. And when you are reading a byte in a middle of such word processor really requests the whole word and then selects byte you need. There is even a hardware exception on some 64-bit processors that raises when you try to access an unaligned (by the 64-bit word boundary) pointer.

1
  • A simple check is to create an empty file and check it's size in disk. That should tell you the memory block it assigns for a file. You can write a byte of data to it and check again. My guess is it remains same there by indicating that OS usually accesses memory in blocks.
    – nightgaunt
    Nov 20, 2014 at 12:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .