This course explores disk management in Linux, covering partitions, MBR, GPT, mount points, and the fdisk utility. We'll also take a look at file systems in Linux and how to use them. This course is part of the Linux Administration Bootcamp learning path, designed to get you up and running with Linux.
Learning Objectives
- Learn about partitions, MBR, GPT, mount points, and the fdisk utility
- Learn how to create and unmount file systems
- Prepare swap space for use by a Linux system
- Learn about the File System Table and how it controls where devices are mounted on a Linux system
- Learn about disk UUIDs and Labels, and how you can use them in conjunction with the File System Table
Intended Audience
- Anyone with basic knowledge of Linux who wants to learn more
- Professionals who want to learn more about Linux to enhance their career prospects
Prerequisites
This is an intermediate-level course so some knowledge of Linux is expected. If you're just starting out, then try our Linux Fundamentals course first.
In this lesson, you'll learn about partitions, MBR, GPT, mount points, and the fdisk utility. When a disk or storage device is partitioned, it is divided into parts. Each one of these parts is called a partition. Partitioning a disk allows you to allocate different sections of the disk for different purposes. As a system administrator you can decide what partitioning scheme to use. For example, you could use four partitions allocating one partition for the operating system data, another partition for the application data, yet another one for the user data, and finally, a partition dedicated a swap space. Another example scheme would simply be to use two partitions and separate the user's home directories from the rest of the system.
Having separate partitions is one way that prevent one part of the system from adversely affecting another part of the system. Having a dedicated partition for user home directories, for example, prevents a user from filling up the entire disk and interfering with the normal operation of the operating system. Even though a user or group of users may fill up the storage allocated for home directories and prevent another user from using more space, the operating system and any applications that are running will still be able to function normally. If this system hosts a website, for example, the operating system will continue to run as well as the web server, and a service outage will have been avoided.
The MBR or master boot record is a boot sector at the beginning of a storage device. The partition table that resides in the MBR contains information on how the logical partitions are organized on the disk. Because the partition table and the MBR can only address storage space up to two terabytes, it is being replaced by the GUID partition table or GPT for short. The MBR partitioning scheme allows for up to four primary partitions. If you want to create more than four partitions, then you'll need to use an extended partition. An extended partition is a special kind of primary partition that is used as a container for other partitions. This allows you to create an unlimited number of logical partitions.
The GUID, global unique identifier partition table or GPT for short, is replacing the older MBR partitioning system. It is part of the Unified Extensible Firmware Interface or UEFI standard. The UEFI is replacing the traditional BIOS. However, GPT has been used on some BIOS systems, primarily due to the disk size limitations of MBR partition tables. There are no primary and extended partitions with GPT. Using the default configuration, GPT supports up to 128 partitions. Also GPT support storage devices up to 9.4 Zettabytes. The primary downside of GPT is that it is not supported on older operating systems. Also you'll need to use newer partitioning utilities that support GPT.
A mount point is simply a directory that is used to access the data on a partition. At the very least, there will be one partition mounted on the slash mount point. Any additional partitions will be mounted on mount points below slash in the directory tree. For example, if you allocated a partition for user home directories, that partition would be mounted at /home. The files and directories that are at or below the /home mount point will reside on that partition. For example, the files in my home directory, /home/jason will be on the partition mounted at /home. If you were to disconnect or unmount that partition and mount it to another directory also called a mount point, all the data will be available at that new mount point.
If slash home were unmounted and the partition was then mounted at /export/home, the files in my home directory would now be available at /export/home/jason. It's important to point out that you can mount partitions over existing data. For example, if files are created in /home before /home is mounted, those files would not be accessible. Let's say you have the slash partition mounted, and you create a home directory for Sarah at /home/sarah. The directory /home/sarah resides on the partition that is mounted on slash. If you were to then mount another partition on slash home, you would no longer be able to access the /home/sarah directory. The data for that directory still exists but it's on the partition associated with slash.
Once you unmount slash home then you would be able to see /home/sarah again. You can mount partitions anywhere in the Linux directory tree. You can even have mount points that reside on other mounted partitions. Let's say you have a partition mounted on /home. You could then mount yet another partition on /home/jason. It's important that /home be mounted before /home/jason however. You'll learn how to associate partitions with mount points as well as control the order that those partitions are mounted in, in a later lesson.
When performing interactive Linux installations you will most likely end up using a partitioning tool provided by the Linux distribution. However, if you want to manipulate this after the initial installation you'll most likely need to use a standard Linux tool. The fdisk utility has been traditionally used to create and modify partitions on a disk, but there are other viable alternatives including gdisk and parted. Earlier versions of fdisk did not support GPT, but as of this time, the latest versions of fdisk support GPT. To manage the partitions on a disk with the fdisk utility, simply provide the path to the device you wish to manage as an argument to the command.
In this lesson, you learned what partition tables are, and some of the reasons to use partitions. You also learned about the GPT and MBR partition tables. We covered mount points and how they are simply directories that are used to access the data on a partition. Finally, you learned that you can create partitions with the fdisk utility. In the next lesson, you will learn exactly how to create partitions with fdisk.
Jason is the founder of the Linux Training Academy as well as the author of "Linux for Beginners" and "Command Line Kung Fu." He has over 20 years of professional Linux experience, having worked for industry leaders such as Hewlett-Packard, Xerox, UPS, FireEye, and Amazon.com. Nothing gives him more satisfaction than knowing he has helped thousands of IT professionals level up their careers through his many books and courses.