Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: help how to symlink two Drives

  1. #1
    Join Date
    Jan 2010
    Beans
    101

    help how to symlink two Drives

    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 the same directories on my data HDD. Is this possible ?
    If it is please help with the link with an example.
    Thank you
    Last edited by ajgreeny; November 9th, 2023 at 06:13 PM. Reason: Font normalised

  2. #2
    Join Date
    Jun 2009
    Location
    SW Forida
    Beans
    Hidden!
    Distro
    Kubuntu

    Re: help how to symlink two Drives

    These all may be similar and what I use, but I do not use snaps and not sure if they work with links:

    https://ubuntuforums.org/showthread....9#post14048909
    http://ubuntuforums.org/showthread.php?t=2315714
    Splitting home directory discussion and details:
    http://ubuntuforums.org/showthread.php?t=1811198 &
    http://ubuntuforums.org/showthread.php?t=1901437
    http://ubuntuforums.org/showthread.p...hlight=%2Fdata

    Some others:
    Link using ~/config/users-dirs.dirs
    https://askubuntu.com/questions/1462...booted-w-win11
    Links
    https://askubuntu.com/questions/1013...d-hdd-mounting &
    https://askubuntu.com/questions/1058...es-on-hdd-disk

    /home/$USER/.config called user-dirs.dirs
    https://askubuntu.com/questions/1271...ng-home-on-hdd

    I have always used /mnt/data, but many have posted better to create mount in / not /mnt. Once I did manually mount something in /mnt and lost all my links until I rebooted.
    UEFI boot install & repair info - Regularly Updated :
    https://ubuntuforums.org/showthread.php?t=2147295
    Please use Thread Tools above first post to change to [Solved] when/if answered completely.

  3. #3
    Join Date
    Nov 2008
    Location
    Boston MetroWest
    Beans
    16,326

    Re: help how to symlink two Drives

    Sure. I deleted the corresponding folders from my home directory and replaced them with symlinks like this:
    Code:
    [root@cyways symlinks]# ls -l
    total 0
    lrwxrwxrwx. 1 phl phl 27 Feb 26  2022 Documents -> /media/server1_name/phl/Documents
    lrwxrwxrwx. 1 phl phl 27 Feb 26  2022 Downloads -> /media/server1_name/phl/Downloads
    lrwxrwxrwx. 1 phl phl 16 Jul 17 16:41 Music -> /media/server2/Music
    lrwxrwxrwx. 1 phl phl 19 Jul 17 16:43 Pictures -> /media/server2/Pictures
    So, for instance,
    Code:
    cd ~
    ln -s /media/server1_name/phl/Documents/
    [etc.]
    If you ask for help, do not abandon your request. Please have the courtesy to check for responses and thank the people who helped you.

    Blog · Linode System Administration Guides · Android Apps for Ubuntu Users

  4. #4
    Join Date
    Mar 2010
    Location
    USA
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: help how to symlink two Drives

    Quote Originally Posted by lumaja View Post
    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 the same directories on my data HDD. Is this possible ?
    If it is please help with the link with an example.
    Thank you
    While what the last post explained, that "is" possible...

    But could you clarify just what you are asking about please?

    Do you mean that you want to symlink 'all' the folders on the OS system user home to point to the other drive? In that case, why not just mount it as your home? If it where just a few folder, then a symlink stragegy for that would be fine. That would assume that those folders on the booted home were empty.

    OR...

    Do you mean that you want the files from both to be accessible from your home on the booted drive? Which would be a merge or folders within folders... While you can move all files to merge them into the folders so they are all in one place, for example all from the first drive back into the second drive, then mount that second drive as your home, you cannot mount or symlink two sources into the same 'single target'.

    That is why I am asking for clarification on what you are trying to do.
    Last edited by MAFoElffen; November 10th, 2023 at 05:56 AM.

    "Concurrent coexistence of Windows, Linux and UNIX..." || Ubuntu user # 33563, Linux user # 533637
    Sticky: Graphics Resolution | UbuntuForums 'system-info' Script | Posting Guidelines | Code Tags

  5. #5
    Join Date
    Jan 2010
    Beans
    101

    Re: help how to symlink two Drives

    Thank you for all the information.
    I have to explain what exactly I want to achieve.
    I have two drives one is 500 GB SSD the other 500 HDD on desktop.
    The SSD drive s it a standard Ubuntu structure with /home/username/ newly installed
    Ubuntu there is no data in Documents, Downloads, Music... directories.
    The HDD is my daily working drive has a normal installed Ubuntu and there are files in Documents, Music, Pictures etc.
    What I understand of Symlink it refers to file or folder on other HDD.
    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 from HDD directory contained my Calc files
    to work on them.
    I don’t know how to achieve this I need explanation and an example will be very good.
    Thank you
    Last edited by lumaja; November 10th, 2023 at 11:07 AM.

  6. #6
    Join Date
    Jul 2009
    Beans
    517
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: help how to symlink two Drives

    Another option to those suggested above is to bind mount the various directories. It's similar to mounting a partition on a directory but instead you mount a directory on another directory by using the bind option.

    But for this to work, your uid (1000 ?) on both systems will need to be the same. This applies to all methods. There are workarounds but it's a bit more complex.
    https://unix.stackexchange.com/quest...apping-userids

    Provided your uid values are the same, you first need to add an entry to your /etc/fstab file to mount the source partition. You'll need to figure out which partition on your HDD contains your users home directory. You can then add multiple bind mounts for each directory you want to map.

    You'll first need to create a directory to mount your partition from your HDD on to
    Code:
    sudo mkdir /mnt/data
    Use the blkid command to find the UUID value for the partition.

    Add the below to your /etc/fstab filie, replace UUID with the value you found above and set the correct username in the paths
    Code:
    UUID=11111111-2222-333-4444-555555555555        /mnt/data       ext4    defaults,nofail 0       2
    
    /mnt/data/home/lumaja/Downloads         /home/lumaja/Downloads  none    bind    0       0
    /mnt/data/home/lumaja/Documents         /home/lumaja/Documents  none    bind    0       0
    /mnt/data/home/lumaja/Music             /home/lumaja/Music      none    bind    0       0
    /mnt/data/home/lumaja/Pictures          /home/lumaja/Pictures   none    bind    0       0
    /mnt/data/home/lumaja/Videos            /home/lumaja/Videos     none    bind    0       0
    You can then mount the new filesystems added to /etc/fstab using
    Code:
    sudo mount -a
    or reboot.
    Mark your thread as [SOLVED], use Thread Tools on forum page.

  7. #7
    Join Date
    Nov 2008
    Location
    Boston MetroWest
    Beans
    16,326

    Re: help how to symlink two Drives

    I gave you some pretty detailed instructions. Did you try them? What didn't work for you?
    If you ask for help, do not abandon your request. Please have the courtesy to check for responses and thank the people who helped you.

    Blog · Linode System Administration Guides · Android Apps for Ubuntu Users

  8. #8
    Join Date
    Jan 2010
    Beans
    101

    Re: help how to symlink two Drives

    To SeijiSensei
    I don’t have enough knowledge on following your instructions just made the “data” directory can’t find it in HDD need more explanation on the subject please.


    To MAFoElffen
    The SSD drive has the common directories.
    Home,Desktop, Documents, Downloads, Music, Pictures, Videos they are all empty.
    The HDD has directories as SSD with all my data.
    The Symlink I want make is from the boot SSD Documents directory refer HDD Documents
    directory, to work on every day files etc I gave an example before.
    I hope this explains.

  9. #9
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: help how to symlink two Drives

    The main thing I have to add is that the actual storage location for all those files needs to have a native Linux file system unless only data files (music/movies/books) will be stored there. Then it doesn't matter, but if you intend to have settings/configurations also stored on the other file system, then it must be a native Linux file system, like ext4.

    If you want everything, without exception, for the user's HOME on the other drive, I'd just mount that other file system to /home/lumaja directly. Again, this would require that file system be native Linux.

  10. #10
    Join Date
    Jan 2010
    Beans
    101

    Re: help how to symlink two Drives

    The system on both drives are ext4

Page 1 of 2 12 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •