Você está na página 1de 3

FAT Partition Efficiency: Slack

One issue related to the FAT file system that has gained a lot more attention over the years is the concept of slack, which is the colloquial term used to refer to wasted space due to the use of clusters for storing files. This began in the mid-1 !s when larger and larger hard dis"s began shipping with most systems. Typically, retail systems were not being divided into multiple partitions, and users began noticing that large quantities of their hard dis" seem to #disappear#. $n many cases this amounted to hundreds of megabytes on a dis" of only 1 to % &' in si(e. )hen the use of FAT*% became more common this problem was less of an issue for a while. Today, with hard dis"s si(ed at +! &' or more commonplace, even FAT*% has problems with slac". Of course the space doesn,t really #disappear#, assuming we are not tal"ing about lost clusters, which can ma"e space really unusable on a dis" unless you use a scanning utility to recover it. The space is simply wasted as a result of the cluster system that FAT uses. A cluster is the minimum amount of space that can be assigned to any file. -o file can use part of a cluster under the FAT file system. This means, essentially, that the amount of space a file uses on the dis" is #rounded up# to an integer multiple of the cluster si(e. $f you create a file containing e.actly one byte, it will still use an entire cluster,s worth of space. Then, you can e.pand that file in si(e until it reaches the ma.imum si(e of a cluster, and it will ta"e up no additional space during that e.pansion. As soon as you ma"e the file larger than what a single cluster can hold, a second cluster will be allocated, and the file,s dis" usage will double, even though the file only increased in si(e by one byte. Thin" of this in terms of collecting rain water in quart-si(ed glass bottles. /ven if you collect 0ust one ounce of water, you have to use a whole bottle. Once the bottle is in use, however, you can fill it with *1 more ounces, until it is full. Then you,ll need another whole bottle to hold the **rd ounce. 1ince files are always allocated whole clusters, this means that on average, the larger the cluster si(e of the volume, the more space that will be wasted. 2)hen collecting rain water, it,s more efficient to use smaller, cup-si(ed bottles instead of quart-si(ed ones, if minimi(ing the amount of storage space is a concern3. $f we ta"e a dis" that has a truly random distribution of file si(es, then on average each file wastes half a cluster. 2They use any number of whole clusters and then a random amount of the last cluster, so on average half a cluster is wasted3. This means that if you double the cluster si(e of the dis", you double the amount of storage that is wasted. 1torage space that is wasted in this manner, due to space left at the end of the last cluster allocated to the file, is commonly called slack. The situation is in reality usually worse than this theoretical average. The files on most hard dis"s don,t follow a random si(e pattern, in fact most files tend to be small in si(e. 2Ta"e a loo" in your web browser,s cache directory sometime43 A hard dis" that uses more small files will result in far more space being wasted. There are utilities that you can use to analy(e the amount of wasted space on your dis" volumes, such as the fantastic 5artition 6agic. $t is not uncommon for very large dis"s that are in single partitions to waste up to +!7 of their space due to slac", although %8-*!7 is more common. 9et,s ta"e an e.ample to illustrate the situation. 9et,s consider a hard dis" volume that is using *% "i' clusters. There are 1:,!!! files in the partition. $f we assume that each file has half a cluster of slac", then this means that we are wasting 1; "i' of space per file. 6ultiply that by 1:,!!! files, and we get a total of %;8 6' of slac" space. $f we assume that most of the files are smaller, and so therefore on average each file has slac" space of around two-thirds of a cluster instead of one-half, this 0umps to *8+ 6'4 $f we were able to use a smaller cluster si(e for this dis", the amount of space wasted would reduce dramatically. The table below shows a comparison of the slac" for various cluster si(es for this e.ample. The more files on the dis", the worse the slac" gets. To consider the percentage of dis" space wasted in this e.ample, divide the slac" figure by the si(e of the dis". 1o if this were a 2full3 1.% &' dis" using *% "i' clusters, a full *!7 of that space is slac". $f the dis" is %.1 &' in si(e, the slac" percentage is 1:7<

Cluster Size

Sample Slack Space, 50% Cluster Slack Per File 1: 6' ** 6' ;; 6' 1** 6' %;8 6'

Sample Slack Space, 6 % Cluster Slack Per File %% 6' ++ 6' = 6' 1:: 6' *8+ 6'

! ki" # ki" $ ki" %6 ki" &! ki"

As you can see, the larger the cluster si(e used, the more of the dis",s space is wasted due to slac". Therefore, it is better to use smaller cluster si(es whenever possible. This is, unfortunately, sometimes easier said than done. The number of clusters we can use is limited by the nature of the FAT file system, and there are also performance tradeoffs in using smaller cluster si(es. Therefore, it isn,t always possible to use the absolute smallest cluster si(e in order to ma.imi(e free space. One way that cluster si(es can be reduced is to use FAT*% instead of FAT1;, as described in other pages in this section. >owever, on very large modern hard dis"s, big partitions even in FAT*% use rather hefty cluster si(es4

1lac" analysis of the ?< drive from one of my 5?s, as displayed by 5artition 6agic 8.!.

5artition 6agic is probably the most popular third-party partitioning tool. $t allows you to change the cluster si(e of the partitions on your dis". This analysis tool shows you how much slac" would be wasted for various cluster si(es on a given dis" volume, to let you decide what cluster si(e you would li"e to use. $t also shows the minimum and ma.imum partition si(es that are allowed for the cluster si(e and file system under consideration. Also reali(e that there will always be some space wasted regardless of the cluster si(e chosen. 6ost people consider the amount of slac" obtained when using + "i' or = "i' partitions to be acceptable@ most consider the slac" of *% "i' cluster si(e partitions e.cessive@ and the 1; "i' partitions seem to go both ways. $t depends entirely on your needs, and how critical your dis" space is. )ith today,s large dis"s, many people don,t care as much about slac" as they used to@ a typical 5? user bringing home a new machine with a *! &' hard dis" isn,t going to get it half full even after quite a while. For others, slac" is still very important. $ personally only avoid the *% "i' partitions when possible, but $ 2more than many others3 also disli"e having my dis" bro"en into many pieces. 1ee this discussion of the tradeoffs between slac" space waste and #end of volume# space waste as well for more perspective on choosing cluster si(es. Tip: Ao remember not to go overboard in your efforts to avoid slac". To "eep it all in perspective, let,s ta"e the worst case above, where *8+ 6' of space is wasted. )ith the cost per megabyte of dis" now below 1 cent, this means that the #cost# of this problem is less than B8. That doesn,t mean that wasting hundreds of megabytes of storage is smart@ obviously $ don,t thin" that or $ wouldn,t have written so much about slac" and partitioning. <C3 'ut on the other hand, spending %! hours and B8! on utility software to avoid it may not be too smart either, considering that for not much more than that you can get a second hard dis" with do(ens of gigabytes4 6oderation is often the "ey to using partitioning to reduce slac", so don,t be ta"en in by some of the #partitioning fanatics# who seem to have lost sight of the fact that dis" space is really very cheap today.

Você também pode gostar