I have a 128GB SSD and a 1TB HDD. I want to use my SSD for root and home partitions and use the HDD for mass storage where I'll store movies and other files. How do I do that?
Ubuntu – How to install Ubuntu 18.04 on SSD+HDD hybrid with proper partitioning
18.04partitioning
Related Solutions
You have almost the same setup as me. 128 GB SSD 1.5 TB conventional.
Here is how I would do it:
- Leave everything on the conventional drive for the time being.
- Install and partition the ssd using a live distribution usb stick. I wouldn't even touch your old drive here.
- See if everything boots to the new partition okay. You may need to adjust bios settings to make it boot to your new drive.
- set up the mountpoint
sudo -i mkdir /media/hdd blkid
You will get something like the following:
/dev/sda1: UUID="0f6e1051-cf9f-4299-b691-76d0d8c532d1" TYPE="ext4" /dev/sda5: UUID="058b6235-7e74-42ce-96c9-59f6cb0a44f3" TYPE="swap" /dev/sdb1: UUID="40a50699-a900-4bfe-a9e4-6587c1a83464" TYPE="ext4"
copy the UUID of your secondary drive (mine is sdb1)
nano /etc/fstabpaste in uuid line without the quotes and add some fstab goodness:
# /etc/fstab: static file system information. # # Use 'blkid' to print the universally unique identifier for a # device; this may be used with UUID= as a more robust way to name devices # that works even if disks are added and removed. See fstab(5). # # # / was on /dev/sda1 during installation UUID=0f6e1051-cf9f-4299-b691-76d0d8c532d1 / ext4 errors=remount-ro 0 1 # swap was on /dev/sda5 during installation UUID=058b6235-7e74-42ce-96c9-59f6cb0a44f3 none swap sw 0 0 # /media/hdd on /dev/sdb1 UUID=40a50699-a900-4bfe-a9e4-6587c1a83464 /media/hdd ext4 defaults 0 2
You may need to change the ext4 to something else if your other drive is formatted differently.
Check to make sure mounts properly
mount /media/hddand see if it works.
- make sure permissions are okay in /mnt/hdd/home/username
ls -l /mnt/hdd/home/username
where username is the name of your user. if the permissions look okay skip, if not (still with root)
chown username:username -R /media/home/username
- Link directories you want in home with those on the ssd
These can be done with user permissions, I would suggest you do this with empty directories: For example Pictures
cd ~ rm -rf Pictures ln -sf /media/hdd/home/username/Pictures .
Do this for any directory you expect to take too much space, for me it's Pictures, Music, Documents, Videos
- (optional) Carefully clean up the /media/hdd/ directory with root permissions. By carefully I mean do not delete /media/hdd/home !
The following steps describe how to mount the partition on your HDD
below /mnt/archive
and then add bind mounts to the home directories
of two users, alice and bob. The home directories themselves are
still on another partition.
All commands must be issued as user root
.
Determine UUID of
archive
partition:lsblk -fs NAME FSTYPE LABEL UUID MOUNTPOINT sda5 ext4 slash 467ddc36-vvvv-xxxx-yyyy-zzzzzzzzzzzz / └─sda sda6 ext4 home a87c2c2d-vvvv-xxxx-yyyy-zzzzzzzzzzzz /home └─sda sdb8 ext4 archive 291bd44c-vvvv-xxxx-yyyy-zzzzzzzzzzzz └─sdb ...
In my case, I have
/
and/home
onsda
and an unmounted partition labelledarchive
onsdb8
. For the purpose of this post we assumesda
is an SSD andsdb
is an HDD.Mount the archive partition into an empty directory, say
/mnt/archive
:mkdir /mnt/archive mount UUID=291bd44c-vvvv-xxxx-yyyy-zzzzzzzzzzzz /mnt/archive chown root:root /mnt/archive chmod 750 /mnt/archive
Create user specific folders below
/mnt/archive
(i.e. on the HDD) for users alice and bob and adjust the permissions so that only they can access these directories. Note that the directories are now on the partitionarchive
on the HDD:mkdir /mnt/archive/alice chown alice:alice /mnt/archive/alice chmod 750 /mnt/archive/alice mkdir /mnt/archive/bob chown bob:bob /mnt/archive/bob chmod 750 /mnt/archive/bob
Create
archive
folders in their home directories. Don't worry because the directories are owned byroot
. This does not hurt because alice isnt't supposed to put anything in that directory. The directory/home/alice/archive
only serves as a location where to bind-mount the actual/mnt/archive/alice
to and when it is mounted, the permissions and ownership of/mnt/archive/alice
apply.mkdir /home/alice/archive mkdir /home/bob/archive
bind mount
/mnt/archive/alice
to/home/alice/archive
:mount -o bind /mnt/archive/alice /home/alice/archive mount -o bind /mnt/archive/bob /home/bob/archive
When satified, add the following lines to
/etc/fstab
to mount the partition automatically upon boot:# The /archive partition UUID=291bd44c-vvvv-xxxx-yyyy-zzzzzzzzzzzz /mnt/archive ext4 defaults 0 2 # bind mounts for alice and bob: /mnt/archive/alice /home/alice/archive none bind 0 0 /mnt/archive/bob /home/bob/archive none bind 0 0
Before the bind mount is done, alice will just see a directory owned by root in her home directory. The directory is empty and she cannot (and should not) put files in there:
alice@ubuntu:~$ ll
total 16
drwxr-xr-x 2 root root 4096 Jan 25 12:51 archive
-rw-r--r-- 1 alice alice 8980 Jan 25 12:43 examples.desktop
After the bind mount is done (mount -o bind /mnt/archive/alice /home/alice/archive
),
alice will see the directory /mnt/archive/alice
in her home directory instead, including
the permissions of /mnt/archive/alice
:
alice@ubuntu:~$ ll
total 16
drwxr-x--- 2 alice alice 4096 Jan 25 13:06 archive
-rw-r--r-- 1 alice alice 8980 Jan 25 12:43 examples.desktop
She can do whatever she likes in and with that archive
directory and everything
will happen on the partition on the HDD.
To undo the above steps, use the following commands:
# undo bind-mounts:
umount /home/alice/archive
umount /home/bob/archive
# unmount actual partition:
umount /mnt/archive
Best Answer
Step by step tutorial (just skip what you already did):
1. Boot from the installation drive
Create a bootable USB drive with the installation image and then boot from it to begin the OS installation.
2. Go through the installation process
Choose the options that suit you best. When prompted to choose instalation type, select "Something Else" to create the partitions for the OS. To create a partition, just click the "+" sign on "free space". You will need to create the following partitions on your SSD:
3. Set up your HDD to mount automatically on boot
Easiest way to do this imo is through the
gnome-disks
GUI tool (to use it, just open a terminal - Ctrl+Alt+T, type insudo gnome-disks
and enter your password). Select your HDD, click on the cogwheels -> "Edit Mount Options...", enable "Mount at system startup" and choose a mount point (for example,/mnt/sda1
or whatever that device is identified as, or/media/user/DATA
).4. Link
~
(/home/user
) media folders to the HDD for easy accessYou will have a few default media folders in your
~
folder, which you might want to have on the HDD instead. To move them to the HDD while still being able to access them easily from/home/user
, you will need to move those folders to the HDD (or just delete them and create other folders) and then create symbolic links instead, using a terminal command like:ln -s /mnt/sda1/Downloads ~/Downloads
That's it! You're all set!