AlgoViz
Operating Systems
Operating Systems · EasyLesson 11 of 12

The file system

When you open your computer and see neat folders full of files — Photos, School, that one folder you should really clean up — it feels obvious and tidy. But the disk underneath knows nothing about folders or files. The disk is just a gigantic pile of numbered blocks, like a warehouse stacked with identical numbered crates. The file system is the OS's organizing layer that lays a friendly tree of files-and-folders over that raw pile, and remembers which crates hold what. Without it, you'd be staring at block number 4,829,117 instead of cat.jpg.

A pile of blocks vs. a tidy filing cabinet

/root folderPhotosfolderSchoolfoldercat.jpgdog.jpgessay.txtunderneath: the disk is really just numbered blocks · 0 1 2 3 4 5 …
The file system shows you a tree of folders and files. Underneath, the disk is just numbered blocks — the OS remembers which blocks each file uses.

Picture a room with a thousand loose pages scattered all over the floor — your homework, photos, notes, all mixed together in one heap. Finding anything means sifting the whole pile. That's what a raw disk is: just blocks of storage, numbered 0, 1, 2, 3…, with no labels and no order. Now picture a filing cabinet: labeled folders, and inside them more folders, and inside those, your actual papers. You can find 'School → essay.txt' in seconds. That's what the FILE SYSTEM gives you. It's the OS layer that takes the heap of numbered blocks and presents it as a clean tree of folders and files, with names you understand. Same papers underneath — just finally organized.

Folders inside folders: a tree

The shape of this organization is a TREE. At the very top is one special folder called the root (often just written '/'). Inside it are more folders, and inside THOSE can be still more folders, plus actual files. Branches inside branches, all the way down — exactly like a family tree, but for your stuff. A FOLDER doesn't hold the actual data of your files. It's more like a labeled drawer: its job is just to hold a list of what's inside it — some files, and maybe some more folders. That's why you can nest them forever (Photos → 2026 → Birthday → cake.jpg): each folder simply points to the things one level below it. The tree is what lets you keep millions of files findable instead of dumped in one giant heap.

How the OS finds your file's data

So you double-click cat.jpg. How does the OS turn that into the actual photo, when the disk is just numbered blocks? For every file, the file system keeps a little record of bookkeeping: the file's name, its size, and — crucially — the LIST of which disk blocks actually hold its data. A photo might be spread across blocks 12, 13, and 88 (files don't have to sit in one neat run of blocks; the system just remembers all the pieces). When you open cat.jpg, the OS looks up that record, sees 'blocks 12, 13, 88', reads exactly those blocks off the disk, and stitches them back into your photo. That's the whole job: the friendly name and folder are for YOU; the block list is how the OS actually finds the bytes. The file system is the translator between the two.

Questions you might have

Is a folder a real thing, or just a label?

It's real, but it doesn't hold your files' data — it holds a LIST. Think of a folder as a labeled drawer whose only contents are a note saying 'inside me are these files and these other folders'. That's what lets you nest folders inside folders forever: each one just points to the things one level down. The actual file data lives elsewhere on the disk; the folder just helps you (and the OS) find your way to it.

How does the OS find my file on the disk?

For every file, the file system stores a little record: its name, its size, and the list of which numbered disk blocks hold its data. When you open the file, the OS reads that record, sees something like 'blocks 12, 13, 88', grabs exactly those blocks off the disk, and stitches them together. You see a name; the OS follows the block list to the real bytes.

What's the difference between a file and the data inside it?

The DATA is the actual content — the photo's pixels, the essay's words — sitting in blocks on the disk. The FILE is the friendly wrapper the file system puts around that data: a name, a size, a place in the folder tree, and the list of which blocks hold the content. So 'essay.txt' is the labeled package; the words inside it are the data. The file system is what connects the nice name to the raw bytes.

Why not just let me deal with the numbered blocks directly?

Because it would be miserable and dangerous. You'd have to remember that your photo lives in blocks 12, 13, and 88, never mix it up with someone else's blocks, and never overwrite the wrong one. The file system does all that bookkeeping for you and hands you a simple name and folder instead. It's the difference between a tidy filing cabinet and a thousand loose pages on the floor.

🧠A disk is really just a huge pile of numbered blocks. The file system is the OS layer that organizes it into a TREE of folders and files with friendly names, and keeps, for each file, the list of which blocks hold its data — so you think in names and folders while the OS handles the raw blocks.
✅ Check yourself3 quick questions — prove the idea stuck.Start →

Best read after: What is an operating system?