Flash drive internal fragmentation.
[ This isn't really a debian question; it's more of a linux question or maybe a
file system question, but because this is the most appropriate of the groups I
read, I'll pretend it's really important that this happened on a debian
system. ]
I tried to copy a 1.4G directory
$ du -sh dr-dobbs
1.4G dr-dobbs
$
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
64 -rwxr-xr-x 1 rclayton rclayton 3 2010-03-23 14:42 fig2.gif
64 -rwxr-xr-x 1 rclayton rclayton 1 2010-03-23 14:42 fig2.htm
64 -rwxr-xr-x 1 rclayton rclayton 3 2010-03-23 14:42 fig3.gif
64 -rwxr-xr-x 1 rclayton rclayton 1 2010-03-23 14:42 fig3.htm
64 -rwxr-xr-x 1 rclayton rclayton 6 2010-03-23 14:42 fig4.gif
64 -rwxr-xr-x 1 rclayton rclayton 1 2010-03-23 14:42 fig4.htm
64 -rwxr-xr-x 1 rclayton rclayton 5 2010-03-23 14:42 fig5.gif
64 -rwxr-xr-x 1 rclayton rclayton 1 2010-03-23 14:42 fig5.htm
64 -rwxr-xr-x 1 rclayton rclayton 7 2010-03-23 14:42 fig6.gif
64 -rwxr-xr-x 1 rclayton rclayton 1 2010-03-23 14:42 fig6.htm
64 -rwxr-xr-x 1 rclayton rclayton 5 2010-03-23 14:42 list1.htm
$ cd /home/dr-dobbs/articles/CUJ/1990/9001/branniga
$ ls --block-size=1k -ls
total 88
20 -r-x------ 1 rclayton rclayton 18 2010-03-21 08:32 branniga.htm
4 -r-x------ 1 rclayton rclayton 3 2010-03-21 08:32 fig1.gif
4 -r-x------ 1 rclayton rclayton 1 2010-03-21 08:32 fig1.htm
4 -r-x------ 1 rclayton rclayton 3 2010-03-21 08:32 fig2.gif
4 -r-x------ 1 rclayton rclayton 1 2010-03-21 08:32 fig2.htm
4 -r-x------ 1 rclayton rclayton 3 2010-03-21 08:32 fig3.gif
4 -r-x------ 1 rclayton rclayton 1 2010-03-21 08:32 fig3.htm
8 -r-x------ 1 rclayton rclayton 6 2010-03-21 08:32 fig4.gif
4 -r-x------ 1 rclayton rclayton 1 2010-03-21 08:32 fig4.htm
8 -r-x------ 1 rclayton rclayton 5 2010-03-21 08:32 fig5.gif
4 -r-x------ 1 rclayton rclayton 1 2010-03-21 08:32 fig5.htm
8 -r-x------ 1 rclayton rclayton 7 2010-03-21 08:32 fig6.gif
4 -r-x------ 1 rclayton rclayton 1 2010-03-21 08:32 fig6.htm
8 -r-x------ 1 rclayton rclayton 5 2010-03-21 08:32 list1.htm
$
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 happened on a debian testing system updated weekly.
Reply to: