After completing this class you should be able to:
This class will discuss how file systems are organized, structured, and accessed by the user as well as managed by the Operating System (OS). This course began with the physical components of a computer in Computer Architecture, with one of the key items being the HDD. Data stored on the HDD is non-volatile and needs to be organized in a manner in which the OS is able to access and interpret the data located on the medium. The file system workflow will discuss this process as well as identifying terms and concepts within Linux and Windows file hierarchies.
HDDs are organized in a manner in which computers are able to access the data. Formatting is critical to how data is stored by the OS and is the reason why the OSX Apple File System (APFS) formatted disk cannot be read by the Windows OS and the Windows NTFS cannot be read by a macOS. This is really applicable for portable drives, such as flash drives, as moving data from one system to another on a Universal Serial Bus (USB) drive would require the correct format for the OS to read any data on the disk. Partitioning, or dividing, the hard disk into different areas starts with the Master Boot Record (MBR) or the Globally Unique Identifier (GUID) Partition Table (GPT). The Windows Disk Management application can be accessed by going to Windows Start , typing
diskmgmt.msc, and running as administrator. Notice in the file system column, the (C:) volume is NTFS but that the (E:) volume is formatted as exFAT. That's because the portable drive assigned to (E:) is a flash drive also used by a camera.
In Linux, the df command shows the file system and partitions that have been mounted (see console output below). If you run that command on the Ubuntu server, you'll notice that the format is tmpfs, for temporary file system, because it's mounted virtually. Run the -T option with the command, df -T and you'll be able to pick out the physical drive partitions under /dev and see that it's formatted in ext4, or the Fourth Extended File System, used by Linux OSs.
m9999@ubuntu:~$ df
Filesystem 1K-blocks Used Available Use% Mounted on
udev 198029824 0 198029824 0% /dev
tmpfs 39615408 2748 39612660 1% /run
/dev/sda2 190603188 101340556 79507752 57% /
tmpfs 198077024 0 198077024 0% /dev/shm
tmpfs 5120 0 5120 0% /run/lock
tmpfs 198077024 0 198077024 0% /sys/fs/cgroup
/dev/nvme0n1p1 479595176 219080 454940488 1% /var/lib/mysql
/dev/sdb1 9296620868 3999099796 4828922392 46% /home/mids
m9999@ubuntu:~$ df -T
Filesystem Type 1K-blocks Used Available Use% Mounted on
udev devtmpfs 198029824 0 198029824 0% /dev
tmpfs tmpfs 39615408 2748 39612660 1% /run
/dev/sda2 ext4 190603188 101340556 79507752 57% /
tmpfs tmpfs 198077024 0 198077024 0% /dev/shm
tmpfs tmpfs 5120 0 5120 0% /run/lock
tmpfs tmpfs 198077024 0 198077024 0% /sys/fs/cgroup
/dev/nvme0n1p1 ext4 479595176 219080 454940488 1% /var/lib/mysql
/dev/sdb1 ext4 9296620868 3999100284 4828921904 46% /home/mids
Understanding the different hierarchies, default directories, and user profiles in both Linux and Windows environments will develop an understanding on how data is stored across these systems. System directories are necessary for OS operations and will be located in specific directories, whereas user profiles have their own dedicated locations.
Root drive. The drive letters do not always correspond to a single physical drive as it can be divided into multiple partitions. For the Windows OS, the root drive will typically be the C drive (C:). The root drive will always be the highest level in the file hierarchy for that partition. From there, subdirectories will exist to organize the information used by the OS and users, indicated by a back slash \. Directions in slashes are determined by the top of the slash; if the slash is to the left "\" then it's a backslash and if the slash is to the right "/" then it's a forward slash. Windows system administrators may also call double backslashes "wack wack" when attempting to connect to remote systems.
Home directory. The default user directory, or the home directory, in Windows will be C:\Users\m9999\ (boxed in the illustration). If you are not aware of where in the folder hierarchy you're saving notes from class lectures, you may think that the computer is not saving your information when there are multiple files in different locations. The file Class01.txt is located in two different locations, as depicted in the file hierarchy illustration on the right.
Parent and child directories. Desktop\ and Documents\ are folders or directories, which are objects that may contain other files or directories. Both Desktop\ and Documents\ are child directories of m9999\ and m9999\ is the parent directory of Desktop\ and Documents\. Users\ is the parent directory of m9999\. Understanding the folder hierarchy and terms used to describe relationships to each other are important.
Absolute and relative file paths. Identifying file paths can be articulated in two different ways, absolute and relative. An absolute file path always begins with the root directory. The Chrome.exe application is located at C:\Program Files\Google\Chrome\Application\Chrome.exe. No matter where you are in the entire file system, using the absolute file path will allow you to know specifically where the file is located. See if you can properly identify the absolute file path of the Class01.txt file under Documents\.
Relative file paths are based on the current working directory. If the home directory is the current working directory, then the path to the Class01.txt file accessible from the desktop would look like Desktop\\Lectures\Class01.txt. Notice that Desktop\ is a child directory and is based on the location in a file hierarchy, in which the current working directory is the home directory. Because Chrome\ is not a subdirectory of m9999\, the ..\ would have to be used to refer to the parent directory. The relative file path to get to Chrome.exe from m9999\ is ..\..\Program Files\Google\Chrome\Application\Chrome.exe.
Documents\ directory, what is the relative file path to the Class01.txt file (specifically, the one located in a subfolder of the Documents\ directory)?
Directories and Files. The Windows Graphical User Interface (GUI) uses an application called File Explorer to view system files. This is a different application than Internet Explorer as it is a browser that is used to view content on the World Wide Web (WWW). To run File Explorer, click on Windows Start and type
file explorer followed by the ↩ Enter key. A new window should appear containing user access to the entire file system. Directories, also referred to as folders, are objects that contain other directories and files.
settings. On the left pane, select Apps > Default Apps and scroll down to Choose default apps by file type. Look for .html and determine the default application configured for that file type.Root. One of the first things that distinguishes Linux from Windows is that there is no "root drive." It is simply root. The Linux file system utilizes the forward slash to signify the root directory and is the highest level in the file system. So what happens if an external hard drive or USB drive is added? Any additional drives are mounted in the /mnt or /media directories and are accessible from there.
Home directory. The Linux home directory will be located at /home/mids/m9999/. From there, the familiar subdirectories of Desktop/, Documents/, Downloads/, etc, will be available as part of the user profile. Recognize the difference between m9999/ as part of the directory hierarchy and a username of m9999. If user m9999 changes their current working directory to /home/mids/m9555/, they are still logged in as user m9999. Know that when accessing a remote session on the Linux server, users are placed in their home directories by default.
Parent and child directories. Linux directory structures may look different than Windows but the concept of parent and child, or subdirectories, are the same. Now that you know about home directories, what would be the parent directory? Using the Linux File System Hierarchy illustration may be useful but just go "up" one directory to mids/ and that is the parent of m9999/.
Absolute and relative file paths. Absolute file paths will always begin with root, whereas relative file paths are based on the current working directory. Notice in the Home Directory paragraph that the absolute file path is mentioned in the first sentence because it begins with root, or /. No matter where in the file hierarchy the current working directory may be, the absolute file path will bring you to its precise location. What would you think if I told you to meet in room 128? That would be relative to where you are currently located at. Bancroft, Michelson, Hopper, Mahan? If it were to be more specific, such as Mahan 128, would that be enough information? Not if cadets from the military academy needed a meeting location. Yes, there's a Mahan Hall at West Point as well! So, an absolute path would look something like - United States, State of Maryland, City of Annapolis, US Naval Academy, Mahan Hall, 1st Floor, Room 28. No matter where in the world a person may be, that precise location is clearly understood.
Knowledge Check: What is the absolute file path to the highlightedclass03.txt file?Directories and Files. In Linux file systems, directories are denoted by a letter d in front of the permissions (drwxr-xr-x) when viewing the long listing format when viewing the directory's contents. Lab 2 will go more into basic shell commands and navigating the file hierarchy but also take note that the Linux file system is case sensitive, which is not the case for the Windows file system. See if you can spot the only file in the user's home directory below.
Linux console display of the contents of a home directory:m9999@ubuntu:~$ ls -l total 16901988 drwxr-xr-x 2 m9999 mids 4096 Feb 15 2023 Desktop drwxr-xr-x 6 m9999 mids 4096 May 12 18:07 Documents drwxr-xr-x 2 m9999 mids 4096 May 5 14:41 Downloads -rw-r--r-- 1 m9999 mids 276 Aug 16 2023 Class01.txt drwxr-xr-x 2 m9999 mids 4096 Feb 15 2023 Music drwxr-xr-x 2 m9999 mids 4096 Feb 15 2023 Pictures drwxr--r-- 4 m9999 mids 4096 Oct 4 2023 projects drwxr-xr-x 2 m9999 mids 4096 Feb 15 2023 Public drwxr-xr-x 12 m9999 mids 4096 Jul 23 14:43 public_html drwxr-xr-x 2 m9999 mids 4096 Feb 15 2023 Templates drwxr-xr-x 2 m9999 mids 4096 Feb 15 2023 Videos
File extensions in Linux are also used to associate default applications within the GUI but this course will be leveraging the remote shell to access and conduct most of the Linux-based activities. When running programs from the shell, the application is required to be specified along with the file being run. For example, if a user is running a Python script, the command invoked would look something like python script.py. User applications are typically located in /usr/bin/ and system files in /etc/.