What actually goes on into a hard disk when a folder is created?

176 views

[ad_1]

Saving files (like images or documents) writes a sequence of bits in the disk and, somehow, assign those bits to a path. But what happens when a single folder with no content is created? how is it saved in the disk?

In: Technology
[ad_2]

With most file systems, it just updates the index (usually that’s at the “front” of the hard disk).

So the index will say “there’s a folder called XYZ in this path” but if you ask the index what’s in that folder it’ll say “nothing”. In the storage area of the disk, there will be no change.

The folder only “exists” in the index, it’s not a thing in the storage area.

In most filesystems, folders are also just files. So creating an empty folder is like creating an empty text document – the file exists, it has metadata, but its size is 0 until you fill it with something.

A folder on-disk can literally be as simple as a flat sequence of “(filename, location)” pairs.