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).
Step 2: Partition the new disk (recommended)
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.
Step 7: Set permissions (optional but recommended)
sudo chown -R $USER:$USER /data
Final check
Reboot and verify the mount is still present:
lsblk -f