Most operating systems are designed to store collections of data. Such collections are usually called files. These files may come in a variety of sizes, formats, and compositions. Typically these files are stored on magnetic media - disks - organized into file systems. It is beyond the scope of our course to discuss file systems in detail, but there are several aspects of which any sophisticated computer user must be aware.
The most obvious aspect of disk storage for the user is the presence of several different disks on any given computer. Most computers possess one or more hard disks, USB Flash drives, CD drives, and/or DVD drives. These might be formatted differently, and might even be incompatible. For example, the computers you use today have both Linux and Windows operating systems on them, with CD drives. They also use some network storage.
Another critical issue for a computer user is the organization of the file system into disk partitions and directories. A partition is a physical separation of one group of data from another on a disk or disks. Partitions might be two different areas of the same disk, they might be two separate disks, or they might represent disks on entirely separate machines.
A third aspect of filesystems that the user has no choice but to understand is the directory structure of the filesystem. Every filesystem organizes the files into directories, or folders. Directories are a purely logical structure. Indeed, files from separate directories might be stored physically on the disk in an interlacing pattern. The directory structure is purely to help the user and the operating system be organized and rational.
The different disks and partitions on a computer might be formatted differently. Filesystems for various media are typically formatted as follows.
|Floppy/USB drive||FAT - File allocation table filesystem|
|Compact Disk||ISO966 file system - almost universal for CDs|
|Windows partitions of hard disk||NTFS - the NT file system. This uses longer addresses to handle larger disks.|
|Linux partitions||Ext4 - the extended Unix file system.|
In Windows, separate devices, such as the floppy drive, and partitions of disks are represented to the user through the drive letter. Everyone is familiar with the C: drive, which is usually the only partition on the hard drive of the computer. On the other hand, it is possible for the hard drive to have several partitions, in which case more than one drive letter appears in the the explorer.exe display. For example, the old server Walt for this laboratory had two disks divided into five partitions, labeled the C:, D:, I:, P:, and U: drives.
Within any one of these drives lies a heierarchical directory structure. In Windows, directories are commonly called folders. Each folder provides an organizational space that may contain files or other folders. The top level directory for a given partition or device is labeled "\" (pronounced "backslash"), and directories contained in that top level folder have their names preceded by the backslash. The drive letter is sometimes understood, but if greater clarity is required, it may be prepended. Thus you should find directories on your Windows filesystem at C:\netscape and C:\winnt. Subfolders of these can be refered to simply by appending more backslashes and names. For example, the winnt folder contains another folder called system32. We can refer to the latter folder uniquely using its specification relative to the partition: C:\winnt\system32. This unique expansion describing the position of a folder or file in the directory structure is called the path to the folder or file.
By contrast, in Unix partitions and devices do not appear separated to the user. Indeed, your Unix storage should appear to be one big directory structure, with no distinction among files, directories, and devices. This is part of the genius of the design of Unix: devices, partitions, and directories are all represented simply as files. The top level directory is labeled "/" (slash) and is always in the main partition of the hard drive. This is called the root directory of the filesystem. Your machines have many subdirectories of the root directory, labeled analogously to the way Windows does: /usr, /var, /mnt, and so on. These directories have more subdirectories in turn. For example, /media/cdrom is where you might find a CD if you put it in the drive. It turns out that your Unix filesystem might use three separate partitions: though /var looks like just another subdirectory of the root directory, it is also a separate disk partition, as is /usr.
In a command-line environment in either Windows or Unix, the command to look in any given directory is called "cd". To move to the drive letter containing that directory in Windows, you must precede the cd command by a command giving the drive letter alone. Thus, to look into a folder called myfiles on a USB drive on a Windows machine, you would type
while to look in the same folder in Unix, you might type
Since directories etc. are represented as files, we need special names to refer to the files that represent those directories. The current directory you are looking in is always called ".", while its parent is called "..". For example, if there is a subdirectory of the top level folder called "sub", and if there is a directory in that folder called "mine", you may change to that directory in any of the following ways:
|cd \sub\mine||cd /sub/mine|
|cd \sub\.\mine||cd /sub/./mine|
|cd \sub\..\sub\mine||cd /sub/../sub/mine|
You get the idea.
The directory you are looking at is called the current directory. You may always specify the path to an object as an absolute path (with the leading "\" or "/") or as a relative path. The relative path tells how to get to the object from the current directory. Thus in the previous example, if your current directory were /bin, then you could get to the mine directory using any of the following commands.
|cd \sub\mine||Absolute Path||cd /sub/mine|
|cd ..\sub\mine||Go from /bin to /, then down to mine||cd ../sub/mine|
|cd .\..\sub\mine||Extra typing||cd ./../sub/mine|
Storage may be accessible through a computer network. In that way, one may store files on one computer that are accessible through a large group of computers. For example, your computer might have a "U:" drive that actually resides on the server. Likewise, your Unix system mounts several filesystems on the network, which appear at /home and /pub.
The last test will take place at the final exam time on Tuesday, 12 December, from 1:30-3:30. It will be written as a one-hour (not 50 minute) exam, but you may have the full two hours for it. In other respects it will be very like the other tests, but comprehensive - it will emphasize Python, but cover all the topics we have seen. There is a Sample Exam, but be aware that things will have changed somewhat with the advent of ChatGPT.
Assignment A is posted.