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

大多數情況下,在檢查資料夾或檔案的大小時,“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
  • 閱讀 ( 69 )
  • 分類:網際網路

你可能感興趣的文章

如何使用virtualbox:使用者指南

... 在這本使用VirtualBox的指南中,您將瞭解為什麼要使用該軟體,如何安裝作業系統,以及如何讓它為您工作的建議。我們會解釋一切,並在途中分享技巧,這樣你就不會迷路。我們跳進去吧! ...

  • 發佈於 2021-03-12 18:26
  • 閲讀 ( 55 )

為什麼我的手機比我的電腦慢?智慧手機vs.桌上型電腦速度

你口袋裡的智慧**功能強大。它的功能比大量現已失效的超級計算機,以及一些現代的超級計算機還要強大。另一個現成的事實是,“你的**比1969年美國宇航局的所有**都有更強的計算機能力,當時它把兩名宇航員送上了月球。...

  • 發佈於 2021-03-26 09:35
  • 閲讀 ( 49 )

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

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

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

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

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

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

我的usb驅動器應該使用什麼檔案系統?

...化USB驅動器的最佳解決方案。 相關:什麼是檔案系統,為什麼有這麼多? 瞭解檔案系統問題 不同的檔案系統提供不同的方式來組織磁碟上的資料。由於實際上只有二進位制資料寫入磁碟,因此檔案系統提供了一種將磁碟上的物...

  • 發佈於 2021-04-07 13:30
  • 閲讀 ( 53 )

如何縮小virtualbox虛擬機器並釋放磁碟空間

...選項卡並選擇磁碟。您將看到“詳細資訊”旁邊顯示的是什麼型別的磁碟。例如,在下面的螢幕截圖中,“動態分配的儲存”表示這是一個動態磁碟。 第二步:將零寫入虛擬機器中的磁碟 在繼續之前,請確保刪除虛擬機器內磁...

  • 發佈於 2021-04-07 14:42
  • 閲讀 ( 53 )

如何在virtualbox中轉換固定磁碟和動態磁碟

...器。它的磁碟將是固定的或動態的磁碟,無論您將其轉換為什麼。

  • 發佈於 2021-04-07 14:48
  • 閲讀 ( 122 )

fat32、exfat和ntfs之間有什麼區別?

...者之間的區別,所以我們會。 相關:什麼是檔案系統,為什麼有這麼多? 檔案系統提供了一種組織驅動器的方法。它指定資料如何儲存在驅動器上,以及可以將哪些型別的資訊附加到檔案、檔名、許可權和其他屬性。Windows支援...

  • 發佈於 2021-04-08 05:12
  • 閲讀 ( 57 )

如何在virtualbox中安裝steamos

...應的風格。 第二個下載是VirtualBox,它很難找到,這就是為什麼我建議點選這個連結而不是自己去尋找它。進入下載頁面後,單擊與您的Virtual Box版本對應的選項,然後下載“vboxguestaditi***\u X.X.X.iso”檔案。它通常是索引頁上從...

  • 發佈於 2021-04-10 07:39
  • 閲讀 ( 48 )

如何在升級到windows 10之前建立pc映像

...的詳細教程:如何在一個小時內升級你現有的硬碟。 我為什麼要這麼做? 沒有什麼比對你的電腦做一個重大的改變,然後發現這個改變破壞了你的工作流程(就像你依賴的一箇舊的應用程式不再工作了)或者它徹底破壞了你...

  • 發佈於 2021-04-10 08:55
  • 閲讀 ( 49 )
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 文章

相關推薦