Help to symlink two Drives

Asked by Luis M.Jacinto

OS: Ubuntu 22.04

I have two drives one is 500 GB SSD the other 500 HDD with all my data, pictures, movies, etc.
The SSD drive is bootable with Ubuntu 22.04.
I want Documents, Downloads, Music, Pictures and Videos of SSD to symlink tthe same Directories on my data HDD. Is this possible ?
If it is please help to do this link.
Thank you

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
Manfred Hampl
Solved:
Last query:
Last reply:
Revision history for this message
Manfred Hampl (m-hampl) said :
#1

What exactly do you want to achieve?
Which files/directories reside where?

Revision history for this message
Luis M.Jacinto (ljacinto) said :
#2

I read Symlink points to a directory or file and this what I want achieve.
On Ubuntu installed on SSD I have the normal directories Documents, Downloads, Music,Pictures.
On HDD I have the some directories with my data I want from the SSD to open the HDD directories to.
Example: from the bootable SSD Documents directory I want to get the HDD Documents directory to work with files in it.
I tried but things dint work properly.
Need an example.
Thank you

Revision history for this message
Manfred Hampl (m-hampl) said :
#3

Asking a question like "how do I apply the symlink command" is premature and goes already a step too far.
Before we can help you, you have to tell what your aim is. Maybe there are much better ways than using the symlink command.

What is the structure of (the main partition of) the SDD drive? Is it a standard Ubuntu structure with /, /home/, /home/username/, /home/username/Downloads/ etc., or do you have some part of the directory tree in separate partitions?
Are there files in the Documents, Downloads, Music... directories on the SDD?
What is the structure of the HDD drive? How and where do you mount the HDD partition(s) into the directory tree?

Why do you want to use the slower HDD drive, if you might be able to use the faster SDD for the files and directories that you mention in your question?

Revision history for this message
Luis M.Jacinto (ljacinto) said :
#4

The HDD is my daily working drive with standard installed Ubuntu it has all my data, pictures,
movies etc.
The SSD drive s it a standard Ubuntu structure with /home/username/ newly installed
Ubuntu there no data in Documents, Downloads, Music... directories.
I want to use the SSD to boot into Ubuntu and use the data from HDD directories.
Example: boot SSD open LibrOffice Calc and then get directories contained my Calc files
to work on them.
I hope this explains

Revision history for this message
Manfred Hampl (m-hampl) said :
#5

You did not answer my questions.

Revision history for this message
Luis M.Jacinto (ljacinto) said :
#6

The idea was to don’t over use SSD with files that they are edit and changed daily.
I view online that Symlink makes a reference of the Folder/Directory I tried
few times and outcome was a errors or found it copies all the from one Directory
to other and this is not I thought to achieve.
Please advice if any other method.

Revision history for this message
Manfred Hampl (m-hampl) said :
#7

What is the structure of the HDD drive? Is this also a standard Linux filesystem structure with /, /home/, /home/username/, /home/username/Downloads/ etc. (e.g. stemming from a previous Ubuntu installation on the HDD)?

How and where do you mount the HDD partition(s) into the directory tree?

Remark: What you want to achieve (system files on one partition, user data files on a different one, in this case even on a different disk) often is done by creating a separate partition for /home and automatically mounting it at boot time.

Revision history for this message
Luis M.Jacinto (ljacinto) said :
#8

Structure of both drives are ext4 with /home/username/.
Don't understand the second question.
System files are in SSD and /home is the HDD witch is automatically mounting it at boot time.

Revision history for this message
Manfred Hampl (m-hampl) said :
#9

What is the output of the command
mount | grep '^/dev/'

Revision history for this message
Luis M.Jacinto (ljacinto) said :
#10

luis@luis-System-Product-Name:~$ mount | grep '^/dev/'
/dev/sda2 on / type ext4 (rw,relatime,errors=remount-ro)
/dev/sda2 on /var/snap/firefox/common/host-hunspell type ext4 (ro,noexec,noatime,errors=remount-ro)
/dev/sda1 on /boot/efi type vfat (rw,relatime,fmask=0077,dmask=0077,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)
/dev/sdb2 on /media/luis/6f014f0b-7ccf-410c-9bcf-bf911baac89f1 type ext4 (rw,nosuid,nodev,relatime,errors=remount-ro,uhelper=udisks2)
luis@luis-System-Product-Name:~$

Revision history for this message
Manfred Hampl (m-hampl) said :
#11

sorry, I missed to ask earlier: what is the output of the command

cat /etc/fstab

Revision history for this message
Luis M.Jacinto (ljacinto) said :
#12

luis@luis-System-Product-Name:~$ cat /etc/fstab
# /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).
#
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sda2 during installation
UUID=95a06925-d082-49f9-9e18-4453d708acbd / ext4 errors=remount-ro 0 1
# /boot/efi was on /dev/sda1 during installation
UUID=557A-36B4 /boot/efi vfat umask=0077 0 1
/swapfile none swap sw 0 0
luis@luis-System-Product-Name:~$

Revision history for this message
Best Manfred Hampl (m-hampl) said :
#13

Your HDD partition is not listed in the /etc/fstab file and the /dev/sdb2 is mounted in /media/luis/...(hex ID)...
This confirms that the partition is automatically mounted only at first use.

As far as I know, this setup does not support creating links from another disk, because the links will point to a non-existing target before the second disk is mounted.
If you want to go that way, then you have to create a permanent mount point for the partition of the second disk in your directory tree and ensuring that the partition is mouted at boot time. Then you can try creating the links that you want.

Already written before:
The recommended way for having the user data on a second disk is done by creating a partition for /home on the second disk and permanently mounting it (via fstab).

Revision history for this message
Luis M.Jacinto (ljacinto) said :
#14

Thank you for great help and explanation.
I want to get this working but don’t enough knowledge I need help, must I open a new
question or can I carry one with this one?

Revision history for this message
Luis M.Jacinto (ljacinto) said :
#15

Thanks Manfred Hampl, that solved my question.