I am going to put an additional (non-USB) hard drive in my system. I already have Ubuntu on my other hard drive so I do not want to install Ubuntu on the additional drive but only use it for storage. How do I add the additional hard drive to my Ubuntu system, e.g. make Ubuntu recognize it and mount it properly?
1 Partition
The easiest and user-friendly way is probably to use
gparted
after you have installed your new HDD and boot your machine:Then you create partitions, by setting their size and type.
gpt
for Ubuntu-only machines andmsdos
(aka MBR) for dual-boot Ubuntu/Windows machines. See this forum post for additional discussionext4
/dev/sdb1
) rather than a placeholder like "New partition #1". If you see the latter, click "Edit > Apply all operations" from the top-bar to actually execute the new partition. Otherwise, it is just in a pending state and your mount will fail in step 2.3gparted
is a very easy to use tool, and yet very advanced.2 Mount
After you are done creating your partitions (most likely it will be just one
ext4
data partition, since this is your additional storage drive), you need to permanently mount it.At this step you already know what names your new partition(-s) have. If not sure, following command will remind you about existing drives and partitions on them:
This will output something like this (intentionally skipped
/dev/sda
system drive info):Output states, that your new partition is
/dev/sdb1
. Now you need to mount it to utilize it's precious space. To achieve this, you need to perform three simple steps:2.1 Create a mount point
2.2 Edit /etc/fstab
Open
/etc/fstab
file withroot
permissions:And add following to the end of the file:
2.3 Mount partition
Last step and you're done!
Links
Modern drives are huge and need to be partitioned with GPT to allow 2TB+ in size.
Find your disk:
If it is already formatted, you should see entry like
/dev/sdb1
withUUID
andPARTUUID
settings.If your disk is not formatted, create a new partition:
and format it:
Create directory for your hdd:
Run
sudo blkid
again, note theUUID
of your/dev/sdb1
partition and add it into/etc/fstab
(make a backup offstab
by installingetckeeper
- this file is important):fstab wiki page describes what does it mean. This should make it persistent over reboots.
Finally mount it without rebooting to test:
First you need to identified the new hard disk.
press
CTRL
+ALT
+T
to open a console then type :You will see something similar with this:
For example the sdb it's the new hard disk that you want to add.
If the sdb it's a new hard disk , you need to format to ext3 or ext4
Keep in mind, command above will delete everything on target hard disk. You can skip this step if there are any data on the hard disk and you want to not lose them.
Now you need the UUID of the new hard disk.
You will see something similar with this:
next step it's to add the new hard disk in fstab for auto mount after reset:
And add new line on bottom, with follow content:
Remeber to replace the
5d6c8f68-dcc8-4a91-a510-9bca2aa71521
and/mnt/NewHDD
with your own UUID and path where will be mounted,CTRL
+X
then pressY
andENTER
to save it.To mount it use:
sudo mount -a
, if the result will be:You must create mount point
sudo mkdir /mnt/NewHDD
then use again:sudo mount -a
Also you need to change owner and group of the new hard disk using next command:
sudo chown user:user -R /mnt/NewHDD
Replace the:
user:user
with your own user and group that you need it.There is a good description how to add another drive here:
Basically you have to partition the new disk, create a file system on it and then mount it. Thats is the easy way. Another way would be to use lvm and create virtual disks on the new drive. That would give you more flexibility: