3

I installed a fresh Ubuntu 18.04 yesterday for the first time. I gave 12.7GB to root and 8.8GB to home from a dual boot SSD with 128GB only that is shared with Windows 10.

I thought I could just redirect what I install to HDD afterwards but I don't think it's that simple.

Is there a way to give like 100GB from my 1TB HDD to store my installations in Ubuntu?

Zanna
  • 70,465
  • Yes but not without cost. You can make any directory mount on any drive, and migrate any directory to another drive/device. When you install using dpkg/apt tools they install on specific directories; which is one way to achieve it (by having directories on different drives). This added complexity (changes to /etc/fstab) has costs (maintenance & problem solving should things go wrong), so if you're not sure how to do that, it's probably not a good idea for you. – guiverc Feb 02 '19 at 08:36
  • Hum ok...so what's my best option? Delete ubuntu partitions from w10, and install again with root in ssd and home on the hdd? – askubuntu Feb 02 '19 at 09:52
  • @user535733 How to resize partitions? is in my opinion an inferior way to answer this question. Clearly it's a duplicate question, but if it gets closed it will be closed for the wrong reason because a better way of solving this specific problem exists. It's hard to be objective and egotistical at the same time without being labeled as opinion-based, but objectivity is my goal for this question. – karel Feb 02 '19 at 12:16
  • Another option is linking folders back into /home. https://askubuntu.com/questions/1013677/storing-data-on-second-hdd-mounting & https://askubuntu.com/questions/1058756/installing-all-applications-on-a-ssd-disk-and-putting-all-files-on-hdd-disk Probably better to then have /home as folder inside / instead of separate partition as then /home itself only has hidden files & folders for user settings, not all your data. – oldfred Feb 02 '19 at 14:48
  • @CharlesGreen How to resize partitions? is in my opinion an inferior way to answer this question. Clearly it's some kind of a duplicate question, but the duplicate question is a blunt instrument that doesn't do a very good job of answering the specific question that askubuntu asked. For this reason I don't think it's an urgent necessity that this question be closed. – karel Feb 03 '19 at 10:03
  • @karel Your answer is certainly more eloquent than what I marked as duplicate - I had seen something earlier in a discussion of where to place Home and User directories which was quite similar, but had forgotten that. I have retracted my vote. – Charles Green Feb 03 '19 at 14:14
  • @earthmeLon we just reopened this. Please retract close vote and delete comment... – Fabby Feb 12 '19 at 22:08

1 Answers1

5

There is a way to redirect what you install to the HDD afterwards by using custom folders for folders in /home in order to span your home directory across multiple hard disks. In your case the multiple hard disks are the 128GB SSD and the 1TB HDD.

Example (xdg-user-dirs-update - Update XDG user dir configuration):

 xdg-user-dirs-update --set DOWNLOAD /media/askubuntu/1TB-HDD/Downloads/

would switch from /home/$USER/Downloads/ to /media/askubuntu/1TB-HDD/Downloads/ and downloaded files would then download to the HDD and not to the SSD. The same applies for all the other directories.

Both the local ~/.config/user-dirs.dirs and global /etc/xdg/user-dirs.defaults configuration files use the following environmental variable format to point to user directories: XDG_DIRNAME_DIR="$HOME/directory_name" An example configuration file looks like this (these are all the template directories):

Results of cat ~/.config/user-dirs.dirs :

XDG_DESKTOP_DIR="$HOME/Desktop"
XDG_DOCUMENTS_DIR="$HOME/Documents"
XDG_DOWNLOAD_DIR="$HOME/Downloads"
XDG_MUSIC_DIR="$HOME/Music"
XDG_PICTURES_DIR="$HOME/Pictures"
XDG_PUBLICSHARE_DIR="$HOME/Public"
XDG_TEMPLATES_DIR="$HOME/Templates"
XDG_VIDEOS_DIR="$HOME/Videos"

As xdg-user-dirs will source the local configuration file to point to the appropriate user directories, it is therefore possible to specify custom folders. For example, if a custom folder for the XDG_DOWNLOAD_DIR variable has been named $HOME/Internet in ~/.config/user-dirs.dirs any application that uses this variable will use this directory.

karel
  • 114,770