Tuesday, February 14, 2012

Burning Question #1: Partition vs Filesystem

I'm going to try something new. There are some things that I do not know that I call "burning questions", because they are things that I may see day-to-day, but I never take the time to research them to find the answer. Starting today, I'm going to try to research and answer one of those questions every month.


First off, I know the general function but I've never understood, what is a partition? And more specifically, how is a filesystem different than a partition? When using tools like Gparted, you usually just select "ext4", press a button, and you have a usable partition. But when using tools like fdisk, you have to create the partition, then use a tool like mkfs.ext to create the filesystem. So my real question is, what specifically is each, how are they different, or are they the same?


First off, "A partition is a contiguous set of blocks on a drive that are treated as an independent disk. [1]" I've never heard it said so concisely, so it's nice to get that out in the open. Because of how the partition table is set up, there can only be a max of 4 primary partition at a time. The way around this is to use one of the slots for a primary partition as an extended partition, inside which you can create logical partitions to a theoretically limitless degree when it comes to the disk, but usually limited in operating systems (63 total partitions in Linux).

(I am just now realizing that back when I was trying Project vOmniMachine, I didn't realize that the physical limits for logical partitions was limitless, and also that Linux will boot fine with more than 63 partitions, or rather GRUB will boot any of them fine. They just won't be able to see all of each other.)


Anyway, on the difference of a partition to a filesystem:
"When a hard drive is partitioned, it is mapped into sections, but the sections are empty. It is like a newly constructed library; shelves, signs, and a card catalogue system must be put in place before the books are put away." [2]
I love analogies to explain stuff, so if you want a really nice analogy, check out an awesome post by gjc on MetaFilter.

[SPARK!] I think I'm going to include little "sparks" of information that I learned, but are only semi-related. For example, right now I learned what an inode is (though I had my suspicions), but more specifically, that the name for a file is not in the inode, but it's instead stored in the folder. [3]


I think one of the things that confused me is that you mount a partition, not a filesystem. So you say "That partition is mounted at /mnt/disk"....well, that doesn't really make sense to me, because you can't mount a partition, at least from my understanding. There's nothing to mount. It's just a bunch of caution tape telling you where something could be that you could mount.

The ambiguity must come partially from ignorance, mostly newbs, but also just for shortness. For example, you'll often hear "NTFS Partition", but that doesn't make sense; it stands for "a Partition with NTFS on it." Likewise, saying "That partition is mounted at /mnt/disk" is shorthand for "That filesystem on a partition is mounted at /mnt/disk". It actually does kind of make sense, just like if you say "a Linux partition", what you mean is "a partition with Linux on it".

Lastly, to clear up some more confusion, a Partition Type/ID/Identification has little to do with the filesystem. Those two digits are meant to help identify what is on that disk or partition, but does not dictate at all what filesystem can be on it.....I think. At very least, it can be said that it does not necessarily "specify a specific file system" [4].



Hopefully that info is correct, or at least more correct. It's all really fascinating to me, and I still have a lot to learn about filesystems, like how they differ in storing data and what journaling is exactly. There are a few other things I would like to get going every month, so eventually I'd like to have one post scheduled for every week, of 4 different types. I'll see if I can handle this one before taking on another.
-Bry

No comments:

Post a Comment