Ubuntu – How to use second HDD as program installation drive path

hard drivepartitioningssdstorage

My issue is that I have no idea how to make Ubuntu recognize my intent to have one drive for the loading and use of the operating system and the other for the storage of programs. Is this even feasible? I have extensive knowledge with Windows, and even server related functions; however despite a year of use with Linux 3 years ago, I'm struggling to find a solution.

I'm using a 120 GB Samsung 3D VNAND SSD for booting Ubuntu and updates to the OS and a secondary 2TB Western Digital Black Drive (that i'm hoping to get ubuntu to install programs onto)

Since I was confused on the formatting I simply partitioned the 120 GB SSD to load Ubuntu and left the data cable to the 2TB unplugged from the motherboard

After loading in and playing with the partitioning tool I realized that the HDD was appearing in a separate window

There was no tie whatsoever with the original SSD where Ubuntu is located

While I can format the 2TB and 120GB Drives I'm unable to determine how to make them work the way I want them to.

Best Answer

I would advice against it and keep the OS on 1 drive. And on the SSD to have the fast boot.

If you want to use a 2nd drive you need to mount the directories onto partitions on that disk.

Software is installed into a lot of directories since software is placed into directories intended for that part of the software. /bin/, /usr/, /lib/, /var/ and more directories will contain parts of an installation. And you will need partitions for each of them where you need to make sure you create plenty of room so the partition can not fill up. Each directory will have overhead decreasing the space you can use for your own files. See this answer on U&L where it is explained how you so this with symlinks or binding (that is a bit high level though).

In the end you will see you probably are going to copy -everything- over to that 2nd disk.

I myself would put the / on the SSD and if you want a separate /home/. And use the 2Tb as a data partition. This is what I have:

$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda2        46G  5,9G   38G  14% /
/dev/sda1        47M  3,5M   43M   8% /boot/efi
/dev/sda5        34G  540M   32G   2% /home
/dev/sdb1       917G   69G  802G   8% /discworld

(I remove the tmp's).

My /home/ is empty. I use users-dirs.dirs to point my directories to /discworld/:

$ ls -l /discworld/
total 72
drwxr-xr-x 6 rinzwind rinzwind 12288 mrt 18 23:07 Desktop
drwxr-xr-x 2 rinzwind rinzwind  4096 mrt  2 19:21 Documents
drwxr-xr-x 3 rinzwind rinzwind  4096 mrt 14 11:46 Downloads
drwxr-xr-x 2 rinzwind rinzwind  4096 jun  7  2015 Music
drwxr-xr-x 4 rinzwind rinzwind  4096 mrt 18 23:47 Pictures
drwxr-xr-x 2 rinzwind rinzwind  4096 jun  7  2015 Public
drwxrwxr-x 3 rinzwind rinzwind  4096 mrt  5 16:04 steam
drwxr-xr-x 2 rinzwind rinzwind  4096 jun  7  2015 Templates
-rw------- 1 rinzwind rinzwind   672 nov  8 20:15 backup.user-dirs.dirs
drwxr-xr-x 2 rinzwind rinzwind  4096 jun  7  2015 Videos

$ more .config/user-dirs.dirs 
XDG_DESKTOP_DIR="/discworld/Desktop"
XDG_DOWNLOAD_DIR="/discworld/Downloads"
XDG_TEMPLATES_DIR="/discworld/Templates"
XDG_PUBLICSHARE_DIR="/discworld/Public"
XDG_DOCUMENTS_DIR="/discworld/Documents"
XDG_MUSIC_DIR="/discworld/Music"
XDG_PICTURES_DIR="/discworld/Pictures"
XDG_VIDEOS_DIR="/discworld/Videos"

And I have a spare SSD so if it ever fails I can be up and running in 15 minutes (with an SSD that is what it takes to install).


And there is a move in the Linux world to create a base system that has a read only and a writable part. When that is possible your idea will be possible. You put all the read only stuff on the SSD and the system will remount it writable to do updates and then mount it as read-only for using it.

Related Question