I recently built an Ubuntu machine and having no knowledge at all about Linux, I was curious about what it's like :)

I used 1 HDD when I installed Ubuntu. A couple of days ago I decided to add one more HDD connected directly into the motherboard using SATA cable.

My question is: How do I make that 2nd HDD permanent, just like my main HDD?

It seems that my computer recognizes my additional HDD as a removable drive (it has a "unmount button" next to it).

If you could please guide me a step-by-step procedure, it would be greatly helpful. Thanks


Preface on preexisting partition layout

All that is written below assumes that your additional hard drive has one single partition and is formatted ext4 (Ubuntu default). We also assume that the existing hard drive device name is /dev/sda containing at least partitions sda1 for root and sda2 for swap.

List all partitions with this command in a terminal (sudo will ask for your password that you will have to type blindly):

sudo fdisk -l


Disk /dev/sda: 55,9 GiB, 60022480896 bytes, 117231408 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x0001fb85

Device     Boot Start       End   Sectors  Size Id Type
/dev/sda1  *     2048 117229567 117227520 55,9G 83 Linux

Disk /dev/sdb: 2,7 TiB, 3000592982016 bytes, 5860533168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: DA1A0C2A-06C2-4648-85BF-720E005BD5BD

Device        Start        End    Sectors  Size Type
/dev/sdb1  81920000 5860532223 5778612224  2,7T Linux filesystem

In the above example disk /dev/sda holds one partition /dev/sda1 and /dev/sdb holds one partition /dev/sdb1 (my swap is on another hard disk).

Check here whether partition /dev/sdb1 really is from the new drive.

Create a mount point for the new drive

We can give any name for the directory (mount point) or subdirectory that holds the new drive but we should avoid a name that already exists (or may exist later). Below is only an example, choose whatever best suits your layout.

For now let's choose a simple name data1 and let it mount to /data1. In your terminal give in the following command:

sudo mkdir /data1

First unmount the new hard drive then mount it (presumably /dev/sdb1) to the new mountpoint to see that all is as expected:

sudo mount /dev/sdb1 /data1
sudo chmod 755 /data1  ## make sensible permissions
cd /data1              ## change to the mount directory
ls -a                  ## list content of the new hard drive

If all is OK we can unmount the drive with

sudo umount /dev/sdb1

More information on mount and mountpoints:

Get the UUID of the new hard drive partition

Any partition of any hard drive will have a unique number called UUID (Universally Unique Identifier). So your old hard drive will have a UUID and your new drive will have another. This UUID will be used later to make sure it is the correct partition we mount. To list the UUIDs of attached drives issue:

sudo blkid

In the resulting list you will find the device name of each registered partition, and it's UUID (you may not have a LABEL).


/dev/sda1: LABEL="ROOT" UUID="ede85c57-e919-4e1f-be24-f8bae5dbb500" TYPE="ext4" PARTUUID="0001fb85-01"
/dev/sdb1: LABEL="BIGSHARE" UUID="c3fa201e-f00b-4959-ae27-4a947d7c2584" TYPE="ext4" PARTUUID="a2617ede-6bd2-40c1-8f4c-2a28a0c839af"

Copy the UUID of the new drive (above that would be c3fa201e-f... yours will be different) for being able to paste it later.

Edit fstab to add the new drive

We have a configuration file /etc/fstab where all partitions are listed that will be mounted at boot.

  1. Let us first make a backup of that file to be able to revert changes:

    sudo cp /etc/fstab /etc/fstab.bak
  2. Then add a new partition by editing this file as root:

    sudo nano /etc/fstab
  3. At the bottom of that file add a line similar to this:

    UUID=<paste number copied from above>   /data1    ext4    defaults    0    2
  4. Write the file with Ctrl + O then Return. Quit the editor with Ctrl + X.

Detailed information on fstab: Ubuntu Community Wiki

Test settings

To see if the drive is mounted correctly we can simulate the mount process at boot with

sudo mount -a

All files of the new hard drive can now be seen in /data1 and they will still be there on the next reboot.

Want to move all HOME to the new drive?

We may want to move all of the HOME directory to that new drive. To do so see my answer to the following question:


For an alternative approach see: How to mount a new drive on startup

| improve this answer | |
  • This is good. One mistake though. Shouldn't the UUID mentioned in "Copy the UUID of the new drive (above that would be a2617ede-6b... yours will be different) for being able to paste it later." be "c3fa201e-f00..." – Hilman Jul 18 '18 at 8:48
  • 1
    @Hilman of course you're correct. This was another drive I had previously. Thank you for the notice :) – Takkat Jul 18 '18 at 9:24
  • 1
    If you are like me and glossed over the note in the beginning of the answer that the drive needs to be formatted in ext4, resulting in the error: "mount: wrong fs type, bad option, bad superblock" then I encourage you to look at the answer of the following question: unix.stackexchange.com/questions/315063/… (essentially just use the command "mkfs.ext4 /dev/sdb") Once that was done, the rest of the answer worked like a charm. – spurra May 1 '19 at 21:37
  • @spurra I don't think drives are formatted by ext4 by default so this is a good note. I did the same as you and my drives are working great. – ComputerScientist Nov 22 '19 at 17:28

Not the answer you're looking for? Browse other questions tagged or ask your own question.