226: Filesystem: CHS vs. LBA Modes.

Take Up Code - A podcast by Take Up Code: build your own computer games, apps, and robotics with podcasts and live classes

Categories:

Cylinder, Head, Sector or CHS vs. Logical Block Addressing or LBA give you two ways to find data on a disk. You’ll learn about these two methods in this episode because the terms come up now and then when talking about filesystems. They don’t really have anything to do with a filesystem itself. They describe two different ways to specify exactly where on a disk that information an be found. Listen to the full episode or read the full transcript below to hear one of my crazy examples where I compare CHS to book binding and then show how LBA is like a book’s page numbers. Transcript You’ll learn about these two methods in this episode because the terms come up now and then when talking about filesystems. They don’t really have anything to do with a filesystem itself. They describe two different ways to specify exactly where on a disk that information can be found. For that reason, they’re used by filesystems. And you should at least be familiar with the ideas. Let me start with this example to help explain the concepts. Have you ever tried making your own book? Or have you looked at books to see how the pages are bound together? You could start with a stack of paper and staple the pages along one side. This will hold the pages together but gets a lot more difficult as the number of pages increase. It also makes it difficult to open the book because the staples don’t let the binding bend very well. Instead if stapling directly through the pages, you get better results by folding the paper in half so that each sheet can form two pages. The staples then only need to go through half as many pages and the book is easier to open because the pages are already folded. Some magazines are made this way. Or instead of staples, maybe string is used to thread through the pages. Regardless, you’ll still be limited in how many pages you can bind like this. And the pages at the outside will have a less crisp fold. What about a writing pad? You know the kind with a cardboard back and pages glued together along either the top or side. The glue is designed to hold the pages until you want to tear one out. Then the page comes away fairly clean. There might be a little glue that breaks off and is still stuck to the page. But you don’t have to actually tear the paper itself to remove the page from the writing pad. Either of these methods has problems for a book. You want a lot of pages that are easy to flip through and probably want the pages to remain in place. What if you combine them. What if you first bind small groups of pages together with thread and then glue them together? The glue has more paper to hold on to with each group and the thread keeps individual pages from pulling out of the glue. The book itself is bound tight and it can be opened easy. Job done, right? Maybe for an empty book. But for a book with printing inside, you really need to print the pages before they get stitched and glued together. And this is where you need to know how many pages will make up each group in order to layout the pages for printing. Not all books will group sheets of paper together before binding them. I’ve seen a lot of paperback books that look like they just have individual pages glued together with a thicker layer of glue than a typical writing pad. You’ll probably find a lot more hardback books that follow this stitching strategy. When it’s all done though, do you want to number the pages by their group and then sheet number? No, you want consecutive page numbers because those are more natural. Now let me take this example and put it in similar terms of hard drives and floppy drives. Other than the fact you can remove a floppy disk, they’re quite similar to hard drives. And the same goes for CD and DVD drives. While other drive types could be different, it’s usually better to follow existing standards than try to create something new. A floppy disk has a single spinn