Storage devices organize data into fixed-size units called clusters, and operating systems use a file allocation table to track exactly where each file is stored on the drive. Understanding this relationship between clusters, addressing, and file lookup is fundamental to how data is read and written at the OS level.
OS Storage & File Access
Your operating system plays a big role in reading and writing data to and from storage.
Your storage device is like a container, and within this container we have a lot of little compartments, and we store the data into these little compartments. These compartments are called clusters, and so we store data into these little cluster compartments.
Let's say I have a file open and I go to save it, and it's going to save onto my SSD. What it's doing is it's saving it into one of these little clusters, so maybe I name it file.txt. The next time I want to edit that file, what will happen is it will go and find that file, load it into RAM, and now I have it accessible where I can actually edit it.
The problem is, how is it going to find that file? In order to find file.txt we need some sort of addressing, a way to be able to find it easily. Otherwise we'd have to search the whole hard drive for a file before we found it. So to make it easier, so that we didn't have to search everything, we create this addressing.
Addressing can look different depending on what type of devices you have, so we're just going to use a simple grid format, and we're going to store this in 1-1 right here. Once again, that's not necessarily the way your hard disks work, but we're just going to use that as a simple way of explaining addressing.
But addressing is not the complete picture here. We need some way to look up what the address is, so we have another table right here. The table in one example is a file allocation table. Once again, that's not across the board what we use for every single storage device, but it could be something that we use. So what we have is file.txt with the cluster 1-1, so that way we're able to find it. Now all we have to do is take a look at this table right here, do a search for file.txt, or your operating system does the search and sees the cluster and then is able to access this file in 1-1, load it into RAM, so now you have access to it.
But of course our file allocation table needs to be stored somewhere on the drive also. So we need to have this file allocation table, and where do we store that at? What your operating system does is it allocates a certain amount of the drive that's going to be where it has this file allocation table, and then what we do is I look up in this file allocation table to find any data that's actually on the drive.
Each of the clusters on this device has a certain size. Let's use the example of 4,096. This can vary, so don't think that everything is 4,096 bytes, but let's just use that as an example. So this is 4,096 bytes. Our file is most likely not going to be exactly 4,096. That would be pretty crazy if it was exactly 4,096, so it's probably going to be just a certain fraction of that.
Let's say our file is going to be 2,000 bytes right here. In this example right here that file then would take up half of the cluster, but because we have this file allocation table that says that file.txt is in 1-1, what we really do is, on the disk it takes up a full 4,096 bytes on here. So there is a size of the file itself, which is 2,000 bytes, and then there's a size on disk, which is taking up 4,096 bytes because of that cluster size.
Let's see what this looks like on the actual computer. What I'm going to do is I'm going to right-click and say New, and I'm going to go to New Text Document, and I'll create a text document here, and we're just going to call this file. Then I'm going to open this up, and we're going to add some text to it, so this is just some random text, and I'm going to save this and let's take a look at the size.
I'm going to right-click on here and go to Properties, and then within the properties I can see the size of this file is 2.22 kilobytes, so that's 2,280 bytes, but on disk it's 4,096 bytes. So we can see it takes up that full cluster, 4,096 bytes, but the size of the actual file is half that size.
But that's not the only scenario here. Perhaps our file is larger than a cluster, that is, it goes beyond the 4,096. Well then we start using another cluster, and we start filling up another cluster, and then we'd have to reference that as well. So not just 1-1, but we also are using up 1-2 as well.
Let's get a visual of what this looks like. I'm going to jump into my Sysinternals Suite here and scroll down to DiskView64, open it up, and what we'll do is we're going to hit refresh. What it's doing is it's scanning this device for all of those little clusters and it's filling it in, and this is going to take a while for it to do it.
On the bottom here is the full volume of this device, so essentially we can just think of it as the full device and all of the storage capacity of this device. Then we see all of the individual little areas here. There's some color coding that's happening, and I can jump to specific areas here and we can see it filling in here, and I can do some zoom in to see what's happening. Each one of these little dots that we see here, in fact I'll zoom in even closer, each one of those dots is a cluster. So we can see that there's a lot of clusters that are on this device. I'm going to wait until this is fully scanned in.
It finished its scan. There are a few file errors here, which is not that big of a deal, so I'm going to close that out. In fact I'll even make this a little bit bigger. Here we have now our scan of this device. I'm going to zoom into all those individual little clusters. Let's find a fairly large file here. This is a fairly large file, and I can double-click it to actually open up and see the details. This file right here takes up, it looks, 1,229 different clusters, so it's anywhere from 0 to 1,228. In fact, these are the addressing for that cluster. So there you go, there's the drive, the different clusters on there, and then this even shows you which file it's referencing, and so that's the file on this disk.
I'm going to use a different Sysinternals tool to take a look at how many clusters and the cluster size on this device. So I open up the Sysinternals folder here, and I'm going to scroll down till I find NTFSInfo64. That's the tool that I want to use. This is a command line tool, so I'm going to have to open up a command prompt, and I can't just open up any command prompt, it's got to be run as administrator. So I'm going to right-click on it and say run as administrator, and I'll click on yes here.
I'm going to have to change the directory to get into the Sysinternals directory here, so I'm going to copy this link and paste it into here to get into that directory, and type in NTFSInfo64, and then I'll hit enter here. We'll get a little warning here, agree to the terms, but what it's asking for is it needs a drive letter here. So I'm going to just say it's going to be the C drive, we'll hit enter here, and we see some information here about the volume, the volume size, how big it is. So this is the C drive that we're looking at.
We see the allocation size, so every cluster is 4,096 bytes, so we see how many bytes per cluster, and we also see how many total clusters there are. So we've got total clusters and how many total clusters free, and some information on it. So that's how big this C drive is.
TechKnowSurge builds IT and cybersecurity professionals through hands-on, concept-first training built around real understanding — not memorization. Free interactive tools, structured programs, and 25+ years of real-world experience, all in one place.
Explore free tools and programs →