Learn how to add a new hard disk in Linux with this detailed guide. Follow steps to partition, format, and mount a new disk using Linux command line tools. #centlinux #linux
Table of Contents
Introduction
Adding a new hard disk to a Linux system can seem like a daunting task if you’re unfamiliar with the process, but it’s actually quite simple once you break it down step by step. Whether you’re expanding your system’s storage for personal use or working on a server setup, this guide will help you through the process from start to finish.
Let’s dive in and get that new hard disk up and running!
Prerequisites Before Adding a Hard Disk
Before you start working on the software side, there are a couple of things you need to do:
- Ensure Physical Installation: First, make sure the new hard disk is physically installed in your system. Power down your machine, connect the new drive to the correct interface (SATA, NVMe, etc.), and power it back up.
- Check System Compatibility: Ensure your system supports the new disk, particularly if you’re working with older hardware or certain disk types (e.g., SSD vs HDD).
Once the disk is installed, we can move to the next step.

Step 1: Verify the New Hard Disk is Detected
Once your system boots up, it’s essential to confirm that your new disk has been detected. You can do this by opening a terminal and running the following command:
sudo fdisk -l
This command lists all the disks connected to your system, along with their sizes and partition tables. You should see your new hard disk listed as something like /dev/sdb
or /dev/sdc
, depending on the order it was connected.
- Disk Naming Convention: Linux names disks in the form of
/dev/sdX
, where “X” is a letter starting from “a.” For example,/dev/sda
is your first disk,/dev/sdb
is the second, and so on.
Read Also: How to Install AWS CLI on Linux System
Step 2: Partitioning the New Hard Disk
Now that the disk is detected, the next step is to partition it. Partitioning helps you divide the disk into logical sections, allowing the system to understand how to store files on it.
Using fdisk
for Partitioning
The fdisk
tool is commonly used for creating partitions. Here’s how to create a partition:
- Start
fdisk
by running:
sudo fdisk /dev/sdb
- Enter n to create a new partition.
- Follow the prompts to set the partition type, size, and number.
- Once done, type w to write the changes.
You’ve now created a new partition on your disk!
Using parted
for Partitioning
For more advanced disk partitioning tasks—especially when dealing with larger drives exceeding 2TB in size—parted
is often the preferred tool over traditional utilities like fdisk
. Unlike fdisk
, which is limited to the MBR (Master Boot Record) partitioning scheme, parted
fully supports GPT (GUID Partition Table), making it ideal for modern systems and high-capacity storage devices.
It also offers a more flexible and scriptable interface for managing partitions. Whether you’re creating new partitions, resizing existing ones, or setting specific alignment options, parted
provides the functionality needed for precise disk management. Here’s a basic example of how to use parted
to get started with partitioning a new disk:
- Start by launching
parted
:
sudo parted /dev/sdb
- Create a new GPT partition table:
mklabel gpt
- Add a new partition:
mkpart primary ext4 0% 100%
This creates a partition that spans the entire disk.
Amazon Fire HD 10 tablet (newest model) built for relaxation, 10.1″ vibrant Full HD screen, octa-core processor, 3 GB RAM, 32 GB, Lilac
$89.99 (as of May 17, 2025 16:12 GMT +00:00 – More infoProduct prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on [relevant Amazon Site(s), as applicable] at the time of purchase will apply to the purchase of this product.)Step 3: Formatting the New Partition
After creating the partition, you’ll need to format it with a file system. Linux supports several file systems, such as ext4
, xfs
, and btrfs
.
Here’s how to format the partition using mkfs
:
sudo mkfs.ext4 /dev/sdb1
This command formats the first partition on /dev/sdb
using the ext4
file system. If you prefer other file systems, you can replace ext4
with xfs
or others as needed.
Choosing the Right File System
- ext4: Ideal for general-purpose use, widely supported, and stable.
- xfs: Great for handling large files, often used in enterprise environments.
- btrfs: Advanced file system with support for snapshots and more, but less mature than ext4.
For most users, ext4
is the safest choice.
Step 4: Mounting the New Hard Disk
In order to start using your newly created partition, you need to mount it to a specific directory within your filesystem. Mounting connects the partition to a mount point, making its storage space accessible for use. You have two options for mounting: a temporary mount, which lasts only until the system is rebooted, or a permanent mount that ensures the partition is automatically mounted every time the system boots.
For temporary mounting, you can use the mount
command. To configure automatic mounting on boot, you’ll need to edit the /etc/fstab
file and define the appropriate mount parameters. Setting up automatic mounting is especially useful for ensuring that data directories, external drives, or additional volumes are always available when the system starts.
Temporary Mounting
To mount the partition temporarily, run:
sudo mount /dev/sdb1 /mnt
This mounts the partition to /mnt
, but it will not persist after a reboot.
Permanent Mounting via /etc/fstab
To ensure the partition is mounted every time the system boots, you need to edit the /etc/fstab
file:
- Open the file for editing:
sudo nano /etc/fstab
- Add the following line to the file:
/dev/sdb1 /mnt ext4 defaults 0 0
This will automatically mount your partition at boot.
Step 5: Verifying the Mounting Process
Once you’ve mounted the new disk, it’s important to verify that the operation was successful and that the disk is accessible from the intended mount point. This step helps confirm that the system recognizes the disk and that it’s ready for use.
You can perform this verification by using the following command, which displays a list of all currently mounted filesystems along with their respective mount points and usage details:
df -h
This command lists all the mounted partitions along with their usage. Your new partition should be listed, confirming it’s accessible.
Read Also: Top 100 Linux Interview Questions for DevOps
Step 6: Assigning Permissions to the New Partition
By default, the root user will have control over the newly mounted partition. To allow other users to write to it, you’ll need to change the ownership and permissions:
- Change Ownership:
sudo chown -R username:group /mnt
- Change Permissions:
sudo chmod 755 /mnt
Replace username
with the actual username and group
with the user’s group. This will allow read, write, and execute permissions for the owner.
Ansible for DevOps: Server and configuration management for humans
$19.99 (as of May 17, 2025 16:11 GMT +00:00 – More infoProduct prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on [relevant Amazon Site(s), as applicable] at the time of purchase will apply to the purchase of this product.)Troubleshooting Common Issues
Sometimes things don’t go as smoothly as expected. Here are a few common issues and solutions:
- Disk not detected: If the new disk isn’t showing up in
fdisk -l
, ensure it’s connected correctly and check your BIOS/UEFI settings. - Partition errors: Double-check the partitioning steps if you encounter errors when trying to mount the partition.
Best Practices for Managing New Hard Disks in Linux
- Backups: Always ensure that you have regular backups, especially when dealing with new drives.
- Monitor Disk Health: Use tools like
smartctl
to check the health of your disk regularly. - Optimize Performance: Depending on the file system, you can use tools like
tune2fs
to optimize performance.
Recommended Training: The Linux Command Line Bootcamp: Beginner To Power User from Colt Steele

Conclusion
Adding a new hard disk to a Linux system may seem complex at first, but it’s actually a manageable process when broken down into clear, step-by-step instructions. Whether you’re expanding your system’s storage capacity or preparing a disk for specific workloads, Linux provides powerful tools to help you get the job done efficiently.
By following the proper procedure—detecting the new hardware, partitioning the disk, formatting it with a suitable filesystem, and mounting it—you’ll have your new drive fully integrated and ready to use. Once configured, the additional disk space can be used to store files, host applications, or support backups, significantly enhancing your system’s overall performance and flexibility.
Your Linux servers deserve expert care! I provide reliable management and optimization services tailored to your needs. Discover how I can help on Fiverr!
Frequently Asked Questions (FAQs)
1. Can I add multiple hard disks at the same time?
Yes, you can. Follow the same process for each disk, ensuring they are properly partitioned and mounted.
2. Which file system should I choose for performance?
For most users, ext4
is a good all-around file system, but xfs
might be better for larger files.
3. How do I unmount and remove a hard disk safely?
Use the umount
command followed by the mount point or partition name, like umount /mnt
.
4. How can I check the health of my hard disk in Linux?
Use smartctl
from the smartmontools
package to run health checks on your disk.
5. Is it possible to resize partitions after creating them?
Yes, using tools like gparted
or parted
, you can resize partitions, but be careful to avoid data loss.
Leave a Reply
You must be logged in to post a comment.