On Friday, August 07, 2015 8:33:17 PM waben...@gmail.com wrote:
> Mick <michaelkintz...@gmail.com> wrote:
> 
> > On Friday 07 Aug 2015 00:23:35 waben...@gmail.com wrote:
> > > Mick <michaelkintz...@gmail.com> wrote:
> > > > I was wondering similar questions regarding a 32G flash card I
> > > > have. Using fdisk to partition it the starting sector was
> > > > automatically aligned with 2048 as it fdisk has been improved to
> > > > deal with 4KB sector drives.
> > > > 
> > > > However, formatting it with mkfs.vfat I was none the wise if I
> > > > should use the '-s sectors-per-cluster' option or what to set it
> > > > at.
> > > 
> > > For the SD Cards of my Android devices I use
> > > 
> > > mkfs.vfat -F32 -s64
> > > 
> > > This always gave me good performance.
> > > 
> > > > Furthermore, how can I read the current cluster size off the flash
> > > > card?  Is this appropriate?
> > > > 
> > > > blockdev --getbsz /dev/sdb
> > > > 4096
> > > 
> > > This gives you the physical blocksize of the device.
> > > 
> > > If you wanna know the cluster size, that means the blocksize of your
> > > filesystem, you can use mtools. First
> > > configure /etc/mtools/mtools.conf and set a drive letter for your
> > > SD Card, e.g.
> > > 
> > > drive c: file="/dev/sde1"
> > > 
> > > then use
> > > 
> > > minfo C:
> > > 
> > > to query a lot of information about the filesystem. Beside some
> > > other infos you will get for example:
> > > 
> > > sector size: 512 bytes
> > > cluster size: 8 sectors
> > > 
> > > This means cluster size is 4096 Bytes.
> > > 
> > > --
> > > Regards
> > > wabe
> > 
> > Thanks!
> > 
> > I've used minfo and this is what it showed:
> > 
> > # minfo d:
> > device information:
> > ===================
> > filename="/dev/sdb1"
> > sectors per track: 32
> > heads: 64
> > cylinders: 30399
> > 
> > mformat command line: mformat -t 30399 -h 64 -s 32 -H 2048 d:
> > 
> > bootsector information
> > ======================
> > banner:"mkfs.fat"
> > sector size: 512 bytes
> > cluster size: 32 sectors
> > reserved (boot) sectors: 32
> > fats: 2
> > max available root directory slots: 0
> > small size: 0 sectors
> > media descriptor byte: 0xf8
> > sectors per fat: 0
> > sectors per track: 32
> > heads: 64
> > hidden sectors: 2048
> > big size: 62257152 sectors
> > physical drive id: 0x80
> > reserved=0x1
> > dos4=0x29
> > serial number: 870C0C43
> > disk label="VERBATIM32G"
> > disk type="FAT32   "
> > Big fatlen=15193
> > Extended flags=0x0000
> > FS version=0x0000
> > rootCluster=2
> > infoSector location=1
> > backup boot sector=6
> > 
> > Infosector:
> > signature=0x41615252
> > free clusters=516445
> > last allocated cluster=1448265
> > 
> > 
> > So, with:
> > 
> > sector size: 512 bytes
> > cluster size: 32 sectors
> > 
> > I get a cluster of 16,384 bytes.  This was created automagically,
> > when I ran:
> > 
> > mkfs.vfat -c -n "Verbatim Flash" /dev/sdb1
> > 
> > Without knowing the specific AU/RU as Fernando explained, should it
> > be smaller/bigger, or should I leave well alone.
> 
> I think, this depends on how big the files are that you wanna store on the 
> card. If you plan to store many very small files on it, than it is probably
> better to choose a smaller cluster size. But for music files, pictures and
> videos this size should be ok.
> 
> --
> Regards
> wabe
> 

IIRC somewhere the spec hints at a 32K optimal cluster size. I think this is 
because the AUs where the FAT would be may be implemented with faster or more 
tolerant flash memory (halving the cluster size means doubling the FAT size). 
But if you know the AU size you can do the math and if the FAT fits on the same 
number of AUs I don't see a reason not to use a different cluster size.

-- 
Fernando Rodriguez

Reply via email to