I have a NTFS drive for Storage, which is shared between Win 11.

I want to change the location of (or replace) ~/Downloads, ~/Music, etc…,.

Note that the link to made is between NTFS and EXT4.

I found two ways while searching.

   1.Creating **Symlinks** in `~` with target pointed to folders in NTFS drive.

   2. **Mounting** the NTFS folders **directly** to`~/Downloads`, `~/Music`, etc..,.

Which one should I do? Which one is more beneficial?

Also how to mount folders to other folders (option 2) ? (I would really appreciate a GUI way)

I know this is not that important of a thing to post on Main Linux Community, but I already asked 2 linux4noobs community, and they are empty.




This is a continuation to my previous discussion, where most of the people said,

  1. It doesn’t matter where I mount.

  2. Mount certain folders directly into home other. (like mounting /mnt/data/music to ~/music)

  • @Nibodhika@lemmy.world
    link
    fedilink
    101 month ago

    Hey man, I think this is a perfectly valid question to ask here. Also I was one of the people who replied on the other thread as well.

    So, let’s start with the why. I imagine you want to have ~/Downloads be inside your large disk so files get automatically downloaded there, I imagine ~/Documents is to have access to the same documenta on both OSs. If that’s not the why or there’s something else let me know as I’ll be basing my answer on this assumption.

    Last time we told you about how you can mount things wherever you want to, I imagine by now you have an entry on your fstab that automatically mounts that NTFS drive somewhere. I’ll call that somewhere /ntfs just to give it a name/path, but any other path should be the same.

    If you wanted your ENTIRE NTFS partition to be on ~/Downloads it’s as easy as changing that fstab entry from /ntfs to /home/gpstarman/Downloads (or whatever your username is). But I imagine you want something more complex, you want to have /ntfs/downloads and ~/Downloads to be the same directory.

    Like you found out there are two ways to do this, the first and most easy one is to create a link. To do so graphically just open whatever file explorer you use right click and drag from one path to the other and you should have an option link here or something similar. Note that you might need to delete or rename your existing ~/Downloads folder to have the link be named that. If you wanted to do it by command line it’s ln -s <target> <link name>, so in your hypothetical case ln -s /ntfs/downloads ~/Downloads

    This should work for 99% of cases and honestly I don’t think you should care too much about mounting. I’ll reply to this comment with the steps for mounting and explaining why it’s different just to be on the safe side.

    • @Nibodhika@lemmy.world
      link
      fedilink
      61 month ago

      For mounting it’s a bit trickier, just like you added an entry to fstab to say that you wanted to mount (for example ) /dev/sdb2 on /ntfs you would need to add another one saying you want to mount /ntfs/downloads to /home/<username>/Downloads. If you want to run this as a one off the command is mount --bind /ntfs/downloads /home/<username>/Downloads (but note that running this with a command will become undone when you reboot, the only way to preserve it after reboots is to have an fstab entry)

      What this does is essentially at the kernel level say that one path is the other. How is this different from a link? Well, a link is just a file that points to the other place, whereas a mount is the other place. A couple of examples on how this is different:

      • If you had a Download folder you would need to rename or delete it before making a link there. Mounting on the other hand necessitates that the Downloads folder exists, and will obfuscate anything inside it while the other folder is mounted. This means that if you had files inside Downloads and you mounted the other folder on top those files are still in the disk, but you have no way of accessing them until you unmount the folder.

      • Links can’t go outside of your system. This is likely not important to you, but if you for example are doing things with chroot or docker this can become a problem.

      In short, a link is like a door that when you open it tells you “go to the other door”, whereas the mount is replacing the room behind that door with another one. Most programs are smart enough to go to the other door, and on most cases the other door exists so all is good. On some edge cases (like I said, docker, chroot, etc) the “go to door X” could be a problem if inside the client system X doesn’t exist.

      Ps: I don’t know of any way of doing this graphically, this is advanced stuff so likely it’s expected that people who want to mount folders know enough to do it in a terminal

      • @gpstarmanOP
        link
        31 month ago

        Thanks Again.

        This is Everything I needed to know.

        Guess I’ll stick to Symlinks for the sake of simplicity.

  • @Samueru@lemmy.ml
    link
    fedilink
    4
    edit-2
    1 month ago

    Folders? you mean directories 👀

    Mount the disk (if you ask me at /media/nameofdir) and configure ${XDG_CONFIG_HOME:-~/.config}/user-dirs.dirs (99% of that time that would be the .config dir in your home lol) and define each XDG_***_DIR= to the respective directory in the path of the mounted disk, no need to make symlinks, though you might need to because there is likely many apps that don’t follow xdg specs.

    I would really appreciate a GUI way

    I know gnome-disks has a GUI way to change the mount options, I don’t know how good it is though.

      • @Samueru@lemmy.ml
        link
        fedilink
        2
        edit-2
        1 month ago

        would you suggest XDG or creating Symlinks?

        You can do both, and both are easy.

        The user-dirs.dirs file contains something like this:

        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"
        

        For example if you mount the disk in /media/dirname, it would be something like this, I’m giving it a external-drive name in this example:

        XDG_DESKTOP_DIR="/media/external-drive/Desktop"
        XDG_DOCUMENTS_DIR="/media/external-drive/Documents"
        XDG_DOWNLOAD_DIR="/media/external-drive/Downloads"
        XDG_MUSIC_DIR="/media/external-drive/Music"
        XDG_PICTURES_DIR="/media/external-drive/Pictures"
        XDG_PUBLICSHARE_DIR="/media/external-drive/Public"
        XDG_TEMPLATES_DIR="/media/external-drive/Templates"
        XDG_VIDEOS_DIR="/media/external-drive/Videos"
        

        And for the symlinks, if the drive already has the Desktop, Documents, etc directories. It is as simple as this:

        ln -s /media/external-drive/* $HOME

        That will symlink all the files in the drive to your $HOME

        I suggest you do both because you might run into a program that doesn’t follow XDG user directories.

  • ferret
    link
    fedilink
    English
    4
    edit-2
    1 month ago

    I don’t think this is a bad question at all, personally I would prefer to mount the drive once and symlink folders for a couple reasons:

    1. It’s easier to automate
    2. it’s theoretically faster (to initialize) as symlinks are effectively free
    3. I personally like symlink syntax more than mount syntax :P

    One possible con to symlinks is that certain (linux native) software can misbehave when it has to interact with them, but this is a fairly uncommon issue. Stuff ran through wine or proton should support them just fine, as they are abstracted away.

    • @seaQueue@lemmy.world
      link
      fedilink
      11 month ago

      bind mounts don’t usually have the problems that symlinks do. The only time I’ve had issues involve container systems like docker or flatpak.

      • @gpstarmanOP
        link
        1
        edit-2
        1 month ago

        Lots of internet people says that one can’t create mount points across different filesystems.

        problems that symlinks do

        Can you explain more please?

        • @seaQueue@lemmy.world
          link
          fedilink
          21 month ago

          Lots of internet people says that one can’t create mount points across different filesystems.

          Citation needed. Bind mounts work just fine wherever you put them, again: you need to mount your source filesystem somewhere then you can bind mount paths from that mounted filesystem anywhere in the running VFS tree. You should Google linux bind mounts, they’re quite simple.

          problems that symlinks do

          Can you explain more please?

          Some software has problems following symlinks properly and fails to work unless given the symlink source path instead

          • @gpstarmanOP
            link
            11 month ago

            Citation needed

            My bad. I got it confused with hardlinks.

            Thank you.

    • @gpstarmanOP
      link
      11 month ago

      Thanks man.

      It’s easier to automate

      I’m failing to see how and why one would do this? ( just curious )

      I personally like symlink syntax more than mount syntax :P

      same man. It’s just more simple.

    • @gpstarmanOP
      link
      11 month ago

      Thank You.

      This helped me. But would you suggest XDG or creating Symlinks?

      • SavvyWolf
        link
        fedilink
        English
        21 month ago

        Honestly, whichever one you want. You could probably continue down the rabbit hole of which option is “better” or more closely fits some idealised standard. But ultimately, both methods solve your problem well enough.

  • @seaQueue@lemmy.world
    link
    fedilink
    3
    edit-2
    1 month ago

    For data like this from another filesystem I usually like to mount the entire volume somewhere private (like under /run) and then bind mount the parts I want to use into their desired locations (like /home/foo/Download, etc.)

    I do this with a second ext4 drive that I use for performance sensitive storage with my primary btrfs system root. It works well, just be aware of edge cases involving containers (you may have to grant the container access to the original mount location under /run in addition to the bound path. This is definitely a gotcha when working with those paths with flatpak.)

    • @gpstarmanOP
      link
      1
      edit-2
      1 month ago

      then bind mount the parts I want to use into their desired locations

      how though?

      This is definitely a gotcha when working with those paths with flatpak

      Can you explain a bit more please?

      • @seaQueue@lemmy.world
        link
        fedilink
        21 month ago

        how though?

        mount -o bind /source /target or use fstab or systemd mount units

        Can you explain a bit more please?

        Container software often needs permission for both the virtual path (wherever the bind mount is mounted to) and the source path (wherever the original is mounted from. It’s not terribly complicated but it does mean fiddling with access permissions in flatpaks.

        You should read about bind mounts, they’re fairly straightforward and there are many, many, many explanations available online

    • @gpstarmanOP
      link
      1
      edit-2
      1 month ago

      Thank you for the link. This helped a lot.

  • Eager Eagle
    link
    fedilink
    English
    1
    edit-2
    1 month ago

    afaik you can’t mount folders, only drives. So what you’re looking for are symlinks (symbolic links, as opposed to hard links; use e.g. ln -s <source> ~/Downloads). I have a few in my $HOME pointing to other drives as well.

    if your NTFS drive is unmounted or unavailable, the link will be broken; but you won’t have to recreate it in the future: so it’s a “set and forget” operation for as long as the path the link points to remains the same.

    • @gpstarmanOP
      link
      1
      edit-2
      1 month ago

      Thank You.

      FYI, you can mount folders. I just don’t exactly know how.

  • @neidu2@feddit.nl
    link
    fedilink
    1
    edit-2
    1 month ago

    Seconding this. As it’s a mount that is explicitly for your user, you might as well mount it where it’s most convenient for you.

    If, on the other hand, it was a mountpoint for the entire system, I’d keep it in /mnt and go the symlink route - I’m old fashioned, and I like to use /mnt for as much as possible. I find it more tidy that way. On that note, I’m not 100% sold on /media yet

    • @gpstarmanOP
      link
      1
      edit-2
      1 month ago

      Seconding this.

      I’m sorry, but which one exactly?

      As it’s a mount that is explicitly for your user

      So, mounting folders just do that for a single user whom created the mount point?