Hello guys! I have 500GB NVME and 1TB HDD. I know that some directories within the /home/user/ directory would benefit from being on the NVME, like .local, .config .Applications, etc. In that regard, I feel like keeping them on the NVME. while having the multimedia directories be on different hard drives. But I don’t know how to do it and almost all tutorial I watched is only focus on moving /home* to HDD and not other directories within the home folder. Can some of you help please!
You can customize the XDG directory paths:
xdg-open ~/.config/user-dirs.dirs
Or replace a directory with a symlink:
mv ~/dir /mnt
ln -s /mnt/dir ~
Can you explain it more, sir? I’m not quite sure how to do that.
There are different ways to do it. Before doing anything, make sure you have working backups of your files.
Symlinks
The simple way is to just symlink individual directories to corresponding dirs on the HDD. But it might not look as nice with the link icons in your home dir.
-
Move the original dir to the HDD:
mv ~/Downloads /mnt/yourhdd
-
Create a symlink:
ln -s /mnt/yourhdd/Downloads ~
Now, there is a ~/Downloads
which is a symlink to /mnt/yourhdd/Downloads
.
Bind mounts
The way I prefer is bind mounts. It’s more complicated but looks nicer; you won’t be able to tell the dirs are special unless you look at the mounts.
First, check that there is a line like this in your /etc/fstab
for your HDD (it may look different depending on your HDD’s filesystem):
UUID=... /mnt/yourhdd btrfs compress=zstd:1 0 0
-
Move the original dir to the HDD:
mv ~/Downloads /mnt/yourhdd
-
Create a new empty dir which will be the mount point:
mkdir ~/Downloads
-
Edit fstab by running
sudoedit /etc/fstab
, and add a line like this:/mnt/yourhdd/Downloads /home/yourusername/Downloads none bind,x-gvfs-hide 0 0
This means mount the first path to the second path; it has
none
filesystem type since it’s a bind mount, and thex-gvfs-hide
means it won’t appear like a separate drive in the sidebar of your file manager. -
Re-mount the system:
sudo mount -a
-
Check
~/Downloads
, it’s no longer empty. Note that~/Downloads
and/mnt/yourhdd/Downloads
both point to the same physical files on your HDD. -
Write down everything you did because you will forget how this works
For more information on bind mounts, see man mount
section Bind mount operations.