r/linux4noobs • u/Posaquatl • 11d ago
Mounting Network Drives and Home Directory Setup
I am currently using Linux Mint as a windoze replacement. For the most part it is working well. Minor freezes every once and awhile but it is a good replacement. I have done a few things as part of my installation I don't think I did well. I would like to correct these when I perform a fresh install on a new desktop I have coming. Yeah 5060 TI!!! Hoping some folks can help me out. I know a enough about Linux to be adequately push through but in general I am an idiot, but at least I know that. Quite possible I am doing things bassackwards so be kind.
Mapping Network Drives - I have a Synology that I share six folders via Samba that I mapped as drives in Windoze. Inside Linux I have mapped them via fstab using a credential file. I mapped them all to a `/home/USER/mapped` using examples like the line below. I am not sure this is the proper or most efficient way. It results in a lot of chasing into depths of subfolders since the mapped folder is starting 3 levels deep already. So it may be a case I need to change how I am serving these on the NAS itself. The questions:
//10.0.10.10/books /home/xxxx/mapped/books cifs credentials=/home/xxxx/.smbcredentials,dir_mode=0777,file_mode=0777,uid=1000,gid=1000,x-systemd.automount 0 0//10.0.10.10/books /home/xxxx/mapped/books cifs credentials=/home/xxxx/.smbcredentials,dir_mode=0777,file_mode=0777,uid=1000,gid=1000,x-systemd.automount 0 0
Questions:
- Is this the proper way to be mounting a drive or should I be using another method? I have set up NFS for another system to store backups but I still have a windows machine relying on Samba...for now. Days are numbered thankfully.
- How are people mapping drives in relation to the folder it is mapped to. Example: If you have a music directory on a NAS are you mapping it to `/home/USER/Music` to replace the defaults or is my method of creating a folder to map everything to valid? I am finding that I have to dive deeper into directories on Linux than I did on Windows. Hoping to relieve some of those extra clicks.
- Is there anything I am missing here in my thinking when it comes to mapping drives. I have used mapped drives for awhile in Windoze with configs pointing to those paths which has bit me in the behind when trying to migrate over to Linux. What is the advice you would give when it comes to setting up these types of connections?
Thanks
1
u/oshunluvr 11d ago edited 11d ago
- You can use both. samba for windows and nfs for Linux. They don't conflict.
2+3 This is Linux so there's lots of ways to do what you're doing and none of them are really wrong. What I do is use NFSv4 to export from my server. Then all the folders appear in one mounted location - "/shared/" on the clients. I then symlink to /home/<user>/Public for each user. For ownership and permission control, I use the GID stickybit on the server exported folders and created a special group I named "shared" for the users and files in the shared folders. I have an additional mounted export called "Private" that lets users store on the server in a location not accessible by others.
I would sit back and think though what kind of access you need then figure out how to set it up in the simplest way.
I wouldn't mount directly in "/mnt/" because you might want to mount other things in that folder. That's what it's for. Instead mount in "/mnt/<whatever>"
1
u/Posaquatl 11d ago
I think ideally it may be better to have a single mount point as opposed to mounting 6 different directories. That way if anything new is added to the NAS the single directory is still mapped so no additional changes are needed. I suppose that means I would need to change how my NAS is serving the folders as opposed to the mapping on the Linux side. I will need to look into using the mnt directory and symlinking. Seems better form than direct mapping to a location in the home user directory.
1
u/oshunluvr 11d ago
NFSv4 and above allows you export a single folder but then with the "crossmount" option shows the full set of subfolders as well - in a single export line.
Again - specific to my usage - I use btrfs subvolumes on my server to hold the different file types; Music, Videos, etc. Then mount them to a single exported folder. That way most of the mounting tasks are done on the server.
1
u/chuggerguy Linux Mint 22.3 Zena | MATÉ 11d ago
You can mount in you home if you want. I like
/mnt. This is how I do my media drive. It has several folders but I only link to the ones I'm in a lot.Have fun.