How to Add a Second Drive to Ubuntu

Linux & Ubuntu | Published 2026-03-24 | By NetCollege Team

Summary: Step-by-step guide to partition, format, mount, and permanently attach a second drive in Ubuntu.

Introduction

This guide shows how to add a second disk to an Ubuntu PC, mount it at /data, and make it persistent after reboot.

Step 1: Verify the new disk is visible

sudo lsblk -f

Confirm your new disk appears (for example as /dev/sdb).

sudo parted /dev/sdb --script mklabel gpt
sudo parted /dev/sdb --script mkpart primary ext4 0% 100%

Step 3: Format the partition as ext4

sudo mkfs.ext4 -F /dev/sdb1

Step 4: Create a mount point

sudo mkdir -p /data

Step 5: Mount the disk temporarily to test

sudo mount /dev/sdb1 /data

Check it mounted correctly:

lsblk -f

Step 6: Make the mount permanent (survives reboots)

Get the UUID of the partition:

sudo blkid /dev/sdb1

Copy the UUID value (looks like 12345678-1234-1234-1234-123456789abc), then open fstab:

sudo nano /etc/fstab

Add this line at the bottom (replace with your actual UUID):

UUID=your-actual-uuid-here   /data   ext4   defaults,noatime,discard   0   2

discard is optional. Many systems use defaults,noatime and rely on periodic TRIM (fstrim.timer) instead.

Step 6.5: Validate fstab before reboot

sudo mount -a

If no error is shown, your fstab entry is valid.

sudo chown -R $USER:$USER /data

Final check

Reboot and verify the mount is still present:

lsblk -f

Frequently asked questions

Do I need to partition a new Ubuntu disk before mounting it?

In most cases yes. Creating a GPT partition and filesystem first gives a cleaner, predictable setup for long-term use.

Why should I use UUID in fstab instead of /dev/sdb1?

Device names can change between boots, while UUIDs remain stable and reduce boot-time mount failures.

How do I safely test fstab changes before rebooting?

Run sudo mount -a after editing fstab to validate syntax and mount behavior before restarting the system.

← Back to category