224: Filesystem: Drive Letters, Mounting, And Paths. Part 2.
Take Up Code - En podcast af Take Up Code: build your own computer games, apps, and robotics with podcasts and live classes
Kategorier:
How are filesystem organized with multiple drives? Whenever you insert a floppy disk, or a CD or DVD, or even a USB drive, the operating system will detect this event and make that drive letter available for use. So it’s not really the drive itself that makes a drive letter. But instead it’s the presence of a filesystem that makes a drive letter. If you have a floppy drive that’s empty, we might think of that as drive A. But you won’t have a drive A available for use until you insert a floppy disk that contains a filesystem and the operating system recognizes the filesystem. Make sure to listen to the full episode for more details about the shell and how this interacts with the filesystem. You’ll also learn about how you can control when information actually gets written to a filesystem through your application code by flushing buffers. You can also read the full transcript below. Transcript The solution that was included with DOS and later became part of Windows was to give each drive a letter. The first floppy drive was A and the second floppy drive was B. The first hard drive was C and other drives would follow. It’s possible to specify that a CD or DVD drive should be something other than the next available letter. And you can access network filesystems through drive letters too. This system gives you 26 possible drives. Although drives A, B, and C should really be reserved for floppies and the first hard drive. Whenever you insert a floppy disk, or a CD or DVD, or even a USB drive, the operating system will detect this event and make that drive letter available for use. So it’s not really the drive itself that makes a drive letter. But instead it’s the presence of a filesystem that makes a drive letter. If you have a floppy drive that’s empty, we might think of that as drive A. But you won’t have a drive A available for use until you insert a floppy disk that contains a filesystem and the operating system recognizes the filesystem. Let me be a bit more specific though. I’ve been referring to the operating system up till now. It’s probably time that I describe something called the shell. The shell is part of the operating system in the sense that you get a shell with the operating system. But it’s not part of the deep internals of the operating system. It’s like a shell that sits around the operating system. For most of us, the shell is what we see and what we think of as the operating system. It would be like how a company spokesperson can become famous and come to represent the company as a whole. But the spokesperson is not the company just like the shell is not the operating system. Some operating systems could even have different shells that you can either choose from or maybe install later. It’s like choosing a new theme. The entire look and feel of your computer can change with a new shell. With Windows, the shell makes up the desktop and the task bar. It also forms the file explorer you use to browse for files. And the file open dialogs. With a Mac and Linux, it forms the desktops and the launch bar and probably a lot more. In older text based operating systems such as DOS, there was a shell too that was used to manage the command prompts. With Linux and Mac terminal windows, you’ll still hear about the Bash shell and the Korn shell which are two popular command line shells. When you insert a floppy disk, or an optical disk, or a USB storage device, the operating system will be made aware of the new device. But it’s most likely the shell that figures out what to do with it. Many operating systems require that the filesystem that was just inserted must be mounted before it can be used. I remember when Linux was new, this mounting had to be done manually. There was a file that could be updated with instructions to do this automatically. It was still very much a manual process. Mounting the removable filesystem just