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
  • 72,312

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
  • 122,292
  • 133
  • 301
  • 332