Exercise: Exploring Storage Devices in Linux
Using Command-Line Tools
1 Purpose
This exercise provides your first hands-on experience with command-line storage tools in a Linux environment. Before you can partition or format a drive, you must be able to identify it and check its health. This exercise walks you through the fundamental commands to inspect the block devices connected to your system and check their S.M.A.R.T. health status.
2 What You’ll Accomplish
By the end of this exercise, you will be able to:
- Use
lsblkto list all block devices and their partitions. - Use
fdiskto identify a drive’s partition table type. - Install software packages in Fedora using
dnf. - Use
smartctlto view detailed drive information and its overall health assessment.
This exercise maps to the following program and course learning outcomes:
- Program Learning Outcomes (PLOs):
- 3. Apply terminology and numeric or system concepts: You will use commands that display and require understanding of device names, partitions, and health statuses.
- Course Learning Outcomes (CLOs):
- 3. Troubleshoot hardware and basic network components: Identifying a drive and checking its health are the first steps in any storage troubleshooting process.
This exercise develops the following skills, which align with the O*NET SOC Code 15-1232.00 for Computer User Support Specialists.
| Learning Objective | O*NET KSAs | Technologies Used |
|---|---|---|
| Identify attached storage devices in Linux. | Knowledge: Computers & Electronics Abilities: Information Ordering |
lsblk, fdisk |
| Check the health status of a storage device. | Knowledge: Computers & Electronics Skills: Troubleshooting, Systems Analysis |
smartctl, S.M.A.R.T. |
3 Prerequisites
This exercise requires a running Fedora 42 virtual machine with internet access and a user account with sudo privileges.
4 Step-by-Step Guide
Open a terminal window in your Fedora VM to begin.
4.1 Step 1: Install smartmontools
While most block device tools are installed by default, the S.M.A.R.T. analysis tool is not. You will install it using the dnf package manager.
Run the following command to install the package. You will be prompted for your password.
sudo dnf install -y smartmontoolsThe
-yflag automatically answers “yes” to the confirmation prompt.
4.2 Step 2: List Block Devices
The lsblk command lists all attached block devices (drives) and their partitions in a tree-like format.
Run the command:
lsblkAnalyze the output. You will likely see a device named
vdaorsda, which represents your primary virtual hard disk. You will also see its partitions listed below it (e.g.,vda1,vda2).
In your student notebook, write down the name of your main storage device and list its partitions.
4.3 Step 3: Identify the Partition Table
Next, you will use fdisk to view detailed information about the drive, including its partition table type.
Run
fdiskwith the-l(list) flag on your main storage device. You must usesudobecause it requires elevated privileges.# Replace /dev/vda with the device name from Step 2 if different sudo fdisk -l /dev/vdaLook at the top of the output. You should see a line that says
Disklabel type: gpt. This confirms your virtual disk is using the modern GUID Partition Table standard.
In your notebook, write down the “Disklabel type” for your main drive.
4.4 Step 4: View Drive Information with smartctl
Now, use the tool you installed to get detailed information directly from the drive’s firmware.
Run the following command to show the information page for your drive:
sudo smartctl -i /dev/vdaReview the output. You can see the device model, serial number, firmware version, and more.
4.5 Step 5: Check Drive Health
This is the most critical use of smartctl: getting a simple, pass/fail health assessment.
Run the following command using the
-H(health) flag:sudo smartctl -H /dev/vdaThe output will be very simple. The most important line is the
SMART overall-health self-assessment test result. For a healthy drive, it will sayPASSED.
In your notebook, write down the result of the health assessment test.
5 Reflect and Review
Now that you have completed this exercise, reflect on your experience in your Microsoft Teams Student Notebook:
- 3 pieces of information you can find using these command-line tools.
- 2 differences between the output of
lsblkandfdisk -l. - 1 question you still have about S.M.A.R.T. technology.
Answer these questions in your notebook to solidify your understanding:
- What command would you use to get a quick, tree-like view of your drives and partitions?
- Why do you need to use
sudoto run commands likefdiskandsmartctl? - You run a health check on a drive and the result is not
PASSED. What is the most important action to take? - What does the
Disklabel typetell you about a drive?