4

Folders have metadata such as name, date modified, permissions, etc. Is it possible to fill up a whole drive with only empty folders?

2 Answers 2

6

According to to this reddit comment and article, yes.

In case someone in the future sees this and the comment is deleted, here is what it said word-for-word.

According to this article each folder record is 1KB each. So a 500GB disk could only contain 500,000,000 folders at max. The real number would be slighty lower, since their is some additional metadata that needs to be stored.

4
  • 2
    Note that this is specific to Windows, or rather the filesystem being used (NTFS in this case). Other OSes and file systems use different ways of storing directories.
    – slhck
    Jul 17, 2018 at 6:46
  • Note: Its NOT 1k, its 1 cluster or allocation unit. This varies on the file system, NTFS is 4k by default but anything from .5k to 64k(in increments of powers of 2) is fair game for many file systems. In the FAT16 days a sector could hold 16 directory entries per sector. Now a days with long file names the ratio could be even lower. Therefore the max is probably a lot lower than 500M. Even if you use short filenames 11 characters are reserved. Some file systems,FAT32, have a backward compatibility so there are potentially 2 directory entries for each file.
    – cybernard
    Jul 27, 2018 at 2:43
  • @slhck even in NTFS it varies. Older NTFS uses 4KB for each MFT entry instead of 1KB by default like modern NTFS
    – phuclv
    Sep 30, 2021 at 2:34
  • @cybernard that's completely wrong. Each file has one corresponding MFT entry in NTFS or inode in many Unix file systems. Each MFT entry is 1KB in modern NTFS regardless of the block size, and each inode is typically 128 or 256 bytes. Small folders don't need a separate data block to be allocated at all (called resident files in NTFS, inline files in ext4), so they only consume a single inode/MFT entry
    – phuclv
    Sep 30, 2021 at 2:38
-1

I found this link trying to understand odd behavior I saw.

I had created a chain of empty directories for future population by a batch job. However, initially, all directories and sub-directories were utterly and completely devoid of ANY files. The count are 10,000 directories in total. The names are 20-25 characters long and some are only 10 long. From the top, ex TempA, they go 4 deep in subdirectores. The count for all the subdirectories for TempA are 10,000 subdirectories. I was surprised to see the external drive (exFat filesystem it seems) I had them stored on drop 10 gigs! Yes, I said 10 GIGS, not megs. I then created a TempB, and copied the 10,000 subdirectories (empty of any files mind you) from TempA to TempB. Again, the diskspace on this drive dropped another 10 Gigs.
Doing the math (10 billion/10,000), Windows 10 is allotting 1 Meg to an empty directory.
That surprised me. I can somehow understand the top layer of directories having lots of inventory space consumption due to large amounts of items (again, empty sub directories) underneath, but it's pretty amazing that 10 gigs was being consumed. If I took all the names of the directories and put them into a text file, it would be small. I guess inventory metadata and security? consume a lot.

Suffice it to say, next time I create a quick "Temp" directory, I'll appreciate the space needed more than the assumed 'almost nothing'.

1
  • 2
    Your essential message is "yes, empty directories take up space", which is already an accepted answer, but this looks like a supporting comment. Please note; SE sites aren't forums but Q&A sites. Please check out the Help section, starting with how to write a good answer. That's how you collect rep that allows you to comment; comments as answers aren't acceptable. As this really adds nothing new, I'd suggest deleting it. I'm sure your input will be valuable down the line :-) Sep 29, 2021 at 23:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .