為什麼“大小”和“磁碟大小”之間有很大的區別?

大多數情況下,在檢查資料夾或檔案的大小時,“Size”和“Size on disk”的值將非常接近匹配,但如果兩者之間存在巨大差異呢?今天的超級使用者問答文章將探討這個令人困惑的問題的答案。...

為什麼“大小”和“磁碟大小”之間有很大的區別?

大多數情況下,在檢查資料夾或檔案的大小時,“Size”和“Size on disk”的值將非常接近匹配,但如果兩者之間存在巨大差異呢?今天的超級使用者問答文章將探討這個令人困惑的問題的答案。

今天的問答環節是由SuperUser提供的,SuperUser是Stack Exchange的一個分支,是一個由社群驅動的問答網站分組。

問題

超級使用者讀者thelastblack想知道為什麼**SD卡上的資料夾的“大小”和“磁碟大小”之間有如此巨大的差別:

As you can see below, there is so much difference between the ‘Size’ and ‘Size on disk’ fields for this folder. Why is that?

007Ys3FFgy1gpfolpdaocj30ah0djq3e

I know that ‘Size on disk’ should be a little more than ‘Size’ because of allocation units in Windows, but why is there that much difference? Could it be because of the large number of files?

BTW, this folder is on my Android phone’s SD card. Inside this, my maps app stores its cached maps, and the app gets its maps from Google Maps.

從截圖上看,“大小”和“磁碟大小”之間肯定存在巨大差異,那麼是什麼原因造成的呢?

答案

超級使用者貢獻者Bob為我們提供了答案:

I will be assuming that you are using the FAT/FAT32 file system here, since you mention this is an SD card. NTFS and exFAT behave similarly with regards to allocation units. Other file systems might be different, but they aren’t supported on Windows anyway.

If you have a lot of **all files, this is certainly possible. C***ider this:

  • 50,000 files
  • 32 KB cluster size (allocation units), which is the max for FAT32

Ok, now the minimum space taken is 50,000 * 32,000 = 1.6 GB (using SI prefixes, not binary, to simplify the maths). The space each file takes on the disk is always a multiple of the allocation unit size – and here we’re assuming each file is actually **all enough to fit within a single unit, with some (wasted) space left over.

If each file averaged 2 KB, you’d get about 100 MB total – but you’re also wasting 15x that (30 KB per file) on average due to the allocation unit size.

In-Depth Explanation

Why does this happen? Well, the FAT32 file system needs to keep track of where each file is stored. If it were to keep a list of every single byte, the table (like an address book) would grow at the same speed as the data – and waste a lot of space. So what they do is use “allocation units”, also known as the “cluster size”. The volume is divided into these allocation units, and as far as the file system is concerned, they cannot be subdivided – those are the **allest blocks it can address. Much like you have a house number, but your postman doesn’t care how many bedrooms you have or who lives in them.

So what happens if you have a very **all file? Well, the file system doesn’t care if the file is 0 KB, 2 KB, or even 15 KB, it’ll give it the least space it can – in the example above, that’s 32 KB. Your file is only using a **all amount of this space, and the rest is basically wasted, but still belongs to the file – much like a bedroom you leave unoccupied.

Why are there different allocation unit sizes? Well, it becomes a trade-off between having a bigger table (address book, e.g. saying John owns a house at 123 Fake Street, 124 Fake Street, 666 Satan Lane, etc.), or more wasted space in each unit (house). If you have larger files, it makes more sense to use larger allocation units – because a file doesn’t get a new unit (house) until all others are filled up. If you have lots of **all files, well, you’re going to have a big table (address book) anyway, so may as well give them **all units (houses).

Large allocation units, as a general rule, will waste a lot of space if you have lots of **all files. There usually isn’t a good reason to go above 4 KB for general use.

Fragmentation?

As for fragmentation, fragmentation shouldn’t waste space in this manner. Large files may be fragmented, i.e. split up, into multiple allocation units, but each unit should be filled before the next one is started. Defragging might save a little space in the allocation tables, but this isn’t your specific issue.

Possible Soluti***

As gladiator2345 suggested, your only real opti*** at this point are to live with it or reformat with **aller allocation units.

Your card might be formatted in FAT16, which has a **aller limit on table size and therefore requires much larger allocation units in order to address a larger volume (with an upper limit of 2 GB with 32 KB allocation units). Source courtesy of Braiam. If that is the case, you should be able to safely format as FAT32 anyway.


有什麼要補充的解釋嗎?在評論中發出聲音。想從其他精通技術的Stack Exchange使用者那裡瞭解更多答案嗎?在這裡檢視完整的討論主題。

  • 發表於 2021-04-11 12:15
  • 閱讀 ( 82 )
  • 分類:網際網路

你可能感興趣的文章

混合動力驅動(hybrid drive)和固態硬碟(ssd)的區別

...得多的成本提供大容量,但其效能高於傳統機械磁碟。 什麼是固態硬碟(ssd)? 固態硬碟(SSD)是在這個時代飛速發展的最新硬碟技術。顧名思義,這些磁碟沒有任何機械部件。資料儲存在積體電路中。例如,現代的SSD磁碟通常...

  • 發佈於 2020-10-29 10:14
  • 閲讀 ( 62 )

如何使用remix os 3.0在pc上安裝android

... 使用RemixOS3.0:有什麼新功能? ...

  • 發佈於 2021-03-17 12:51
  • 閲讀 ( 67 )

10種最常見的音訊格式:您應該使用哪種格式?

...別和大小。雖然我們都熟悉MP3,但AAC、FLAC、OGG或WMA呢?為什麼有這麼多的音訊標準?有沒有最好的音訊格式?哪些是重要的,哪些是可以忽略的? ...

  • 發佈於 2021-03-18 07:52
  • 閲讀 ( 58 )

硬碟大小解釋:為什麼1tb的實際空間只有931gb

... 為什麼會發生這種情況,有幾個很好的理由。讓我們看看為什麼廣告空間通常與實際空間不一樣。 ...

  • 發佈於 2021-03-19 04:23
  • 閲讀 ( 52 )

jpg與jpeg:這些影象檔案格式之間有什麼區別?

...JIF、JPEG和JPG副檔名或多或少指的是同一件事。為了理解為什麼檔案格式有這麼多的名字,我們需要解開一些複雜的歷史。 ...

  • 發佈於 2021-03-26 15:54
  • 閲讀 ( 66 )

如何在windows10中管理winsxs資料夾

...這就提出了一個問題:WinSxS中到底安裝了哪些檔案,以及為什麼這些檔案如此龐大。Web搜尋和論壇中充滿了有關此資料夾的問題。讓我們揭開WinSxS的祕密和正確的管理方法。 ...

  • 發佈於 2021-03-30 19:20
  • 閲讀 ( 62 )

如何檢視mac的內部儲存空間有多大

...希望的那樣執行良好。下面是如何檢查你的Mac內部儲存的大小。 首先,單擊螢幕左上角的“Apple”徽標,然後從選單中選擇“About This Mac”。 在出現的視窗中,單擊“儲存”按鈕。(在某些早期版本的macOS中,此按鈕可能顯示為...

  • 發佈於 2021-03-31 13:43
  • 閲讀 ( 52 )

如何在linux中獲得檔案或目錄的大小

...際磁碟使用情況以及檔案或目錄的真實大小。我們將解釋為什麼這些值不一樣。 實際磁碟使用情況和實際大小 檔案的大小和它在硬碟上佔用的空間很少相同。磁碟空間按塊分配。如果一個檔案比一個塊小,整個塊仍然分配給...

  • 發佈於 2021-04-02 20:13
  • 閲讀 ( 57 )

如何減小powerpoint簡報的檔案大小

...麼小心複製和貼上它可能會重新格式化你的影象BMP或PNG。為什麼這是一個問題?這兩種檔案格式都比JPG大。 在上面的截圖中可以看到,PNG檔案是153KB,而同一張圖片的JPG檔案是120KB。每次將JPG檔案複製並貼上到PowerPoint,然後將...

  • 發佈於 2021-04-03 11:34
  • 閲讀 ( 63 )

apfs、mac os extended(hfs+)和exfat之間有什麼區別?

...ndows PC上讀取Mac格式的驅動器 區分大小寫:除非你知道你為什麼要這樣做,否則要避免 APFS和macOS Extended都提供了一個“區分大小寫”的選項,但是macOS預設情況下不使用這個設定。除非你真的知道你在做什麼,並且有特定的理...

  • 發佈於 2021-04-07 03:31
  • 閲讀 ( 113 )
N4019100603
N4019100603

0 篇文章

作家榜

  1. admin 0 文章
  2. 孫小欽 0 文章
  3. JVhby0 0 文章
  4. fvpvzrr 0 文章
  5. 0sus8kksc 0 文章
  6. zsfn1903 0 文章
  7. w91395898 0 文章
  8. SuperQueen123 0 文章

相關推薦