this post was submitted on 18 Jul 2024
25 points (96.3% liked)

Linux

48186 readers
1830 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

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)

you are viewing a single comment's thread
view the rest of the comments
[–] Nibodhika@lemmy.world 10 points 4 months ago (1 children)

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 6 points 4 months ago (1 children)

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

[–] gpstarman@lemmy.today 3 points 3 months ago

Thanks Again.

This is Everything I needed to know.

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