[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Flash drive internal fragmentation.



On 2010-03-24 10:51, R. Clayton wrote:
[snip]

to an empty 4G thumb drive

  $ /sbin/fdisk -l /dev/sda

  Disk /dev/sda: 4009 MB, 4009754624 bytes
  124 heads, 62 sectors/track, 1018 cylinders
  Units = cylinders of 7688 * 512 = 3936256 bytes
  Disk identifier: 0x00000000

     Device Boot      Start         End      Blocks   Id  System
  /dev/sda1   *           1        1018     3913161    6  FAT16

  $

and had the copy fail because the thumb drive ran out of space.  After poking
around a bit, I found the block sizes on the thumb drive were huge:

  $ cd /mnt/flasha/dr-dobbs/articles/CUJ/1990/9001/branniga

  $ ls --block-size=1k -ls
  total 896
  64 -rwxr-xr-x 1 rclayton rclayton 18 2010-03-23 14:42 branniga.htm
  64 -rwxr-xr-x 1 rclayton rclayton  3 2010-03-23 14:42 fig1.gif
  64 -rwxr-xr-x 1 rclayton rclayton  1 2010-03-23 14:42 fig1.htm
[snip]

which meant my thumb drive space was getting eaten up by internal
fragmentation.  I understand that flash storage has special needs for most
efficient operation, but are block-size overages of an order-of-magnitude or
more really necessary?  Can I remake the file system with smaller block sizes?
How?  (It is unclear to me if sector size is the same as file block size.)
What bad things happen to flash storage if the file system has 1k block size?


This is a fundamental design flaw of FAT, which was designed for floppy drives.

http://en.wikipedia.org/wiki/File_Allocation_Table
    "To limit the size of the table, disk space is allocated
    to files in contiguous groups of hardware sectors called
    clusters."

Even with FAT16 and FAT32 increasing the number of clusters on a disk, capacity still outstripped FAT. Thus, cluster size had to greatly increase. Thus the huge block count.

I'd try FAT32.  The increased FAT should reduce the cluster size.

--
"History does not long entrust the care of freedom to the weak
or the timid."  Dwight Eisenhower


Reply to: