piclist 2008\07\17\112216a >
Thread: SDHC Cards, was Re: Digital Sound
www.piclist.com/techref/io/audio.htm?key=sound
face
flavicon
face BY : Harold Hallikainen email (remove spam text)




> (However, I've seen assorted things that claim to top out at 1GB;
> perhaps
> above that is where you need FAT32 instead of FAT16?  (Microsoft SAYS
> Fat16
> is good up to 2G...)
>
> BillW


>From Wikipedia:
In 1988 the improvement became more generally available through MS-DOS 4.0
and OS/2 1.1. The limit on partition size was dictated by the 8-bit signed
count of sectors-per-cluster, which had a maximum power-of-two value of
64. With the standard hard disk sector size of 512 bytes, this gives a
maximum of 32 KB clusters, thereby fixing the "definitive" limit for the
FAT16 partition size at 2 gibibytes. On magneto-optical media, which can
have 1 or 2 KB sectors, the limit is proportionally greater.

Much later, Windows NT increased the maximum cluster size to 64 KB by
considering the sectors-per-cluster count as unsigned. However, the
resulting format was not compatible with any other FAT implementation of
the time, and it generated greater internal fragmentation. Windows 98 also
supported reading and writing this variant, but its disk utilities did not
work with it.

So, it appears the 2GB limit is because the sectors per cluster byte in
the boot sector is considered to be unsigned (limiting us to 127 sectors
(each 512 bytes) per cluster. However, the number of sectors per cluster
also has to be a power of 2, dropping us down to 64 sectors per cluster.
That's 32kB per cluster. With 16 bit FAT entries, you can have about 64K
clusters (65,536 minus some reserved values), limiting the disk (actually,
the partition) to 2GB.

Apparently NT considers the SectorsPerCluster byte to be unsigned,
allowing a number up to 255, but still required to be a power of 2, so we
are up to 128 sectors per cluster for 4GB per partition.

The requirement that the sectors per cluster be a power of two is probably
to make the math easier (shift instead of a complicated multiply), but it
would be interesting to see what happens if you set it to some other
number (like 255), or if you were to interpret zero sectors per cluster as
256 sectors per cluster.

Further, the sector size is normally 512 bytes, but does not necessarily
have to be. Wikipedia says some magneto-optical disks have sector sizes of
1kB or 2kB. The bytes per sector is defined as a 16 bit number in the boot
sector, so you could make it really big if you wanted. As I recall from
writing some MMC/SD card code years ago, you pass an actual byte address
(not a sector number) into the card, so the card itself does not care
about sector size (though I think there is a configuration register with
bytes per sector).

Increasing the bytes per sector or the sectors per cluster works well with
large files, but with a lot of small files, you have a lot of wasted
space.

Finally, you can always do multiple partitions on a card to cram even more
data on the card.

Harold

--
FCC Rules Updated Daily at http://www.hallikainen.com - Advertising
opportunities available!
<2394.71.93.35.174.1216308109.squirrel@sujan.hallikainen.org> 7bit

In reply to: <4C5D1DB7-A7C0-457D-8C45-9056304A5D38@mac.com>
See also: www.piclist.com/techref/io/audio.htm?key=sound
Reply You must be a member of the piclist mailing list (not only a www.piclist.com member) to post to the piclist. This form requires JavaScript and a browser/email client that can handle form mailto: posts.
Subject (change) SDHC Cards, was Re: Digital Sound

month overview.

new search...