LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Desktop (https://www.linuxquestions.org/questions/linux-desktop-74/)
-   -   /home on a NAS and fallback options (https://www.linuxquestions.org/questions/linux-desktop-74/home-on-a-nas-and-fallback-options-855195/)

mfaine 01-09-2011 11:37 AM

/home on a NAS and fallback options
 
I just bought a nice Synology NAS and I'm planning on copying my current /home partition to the NAS and mounting my home directory from the NAS. The only issues I can see would be if for some reason it doesn't mount I'd be left without a home directory. I think this isn't a real problem but I still would like to have my speculation verified if possible.

If I copy the /home to the NAS I can then remove everything under my current /home but leave .bashrc and perhaps some other dot files just in case it doesn't mount (for whatever reason) then I can login and work anyway? Does this sound correct?

Also, what about having a message like

echo Local login, check NAS

or something like that in the .bashrc that I leave on the local filesystem? Wold that work. Is there a better way to do this. Been using Linux for years but for some reason never had to deal with this situation before.

yooy 01-09-2011 12:02 PM

Quote:

If I copy the /home to the NAS I can then remove everything under my current /home but leave .bashrc and perhaps some other dot files just in case it doesn't mount (for whatever reason) then I can login and work anyway?
I assume linux would look for home at some place, not first at some place and than another. Notification about "/home unavailable" seem better solution to me.


-----------------------------
some basic info about NAS

mfaine 01-09-2011 03:13 PM

Quote:

Originally Posted by yooy (Post 4218484)
I assume linux would look for home at some place, not first at some place and than another. Notification about "/home unavailable" seem better solution to me.


-----------------------------
some basic info about NAS

Yes, if I mount the NAS to /home and it doesn't mount the /home directory will still exist and will still contain basic home directories and files.

jlinkels 01-09-2011 04:58 PM

If you have more than one computer, mounting /home from a NAS is a terribly bad idea if you run a GUI. Imagine running KDE4.3 on one machine and KDE4.4 on the next. Or if you have certain .*rc files which need to be specific to one computer. I take the effort to create a mount point /mnt/mynas/home/myname and keep all /home directories local. I once thought it was a nice idea, did it as well, and know better now.

jlinkels

mfaine 01-09-2011 11:15 PM

Good point. This is exactly the kind of information I was looking for. Thanks. I only have the one computer now but that is sure to change. I like your solution and may do the same. I guess the goal is to both isolate my home directory from upgrades or re-installs but also to allow for the exact same setup on every computer I own. Of course, laptops do pose a challenge of their own. It seems more research is in order.

schultzter 01-13-2011 03:18 PM

Not what I wanted to hear!
 
Quote:

Originally Posted by jlinkels (Post 4218696)
If you have more than one computer, mounting /home from a NAS is a terribly bad idea if you run a GUI.

That makes a lot of sense, unfortunately.

I'm trying to figure out how to integrate my NAS into the two (or three if count by OS) computers I have. It needs to be simple since most of the household doesn't care what's running as long as they can get their e-mail and find their photos or music on the NAS drive.

I thought mounting the NAS' home share over each computer's /home directory would be a brilliant solution. But I see your point and agree it would probably cause more problems (configs, caches, etc. would probably get corrupted or at least generate a lot of warnings and errors).

So what's a good solution to keep per user machine specific configs separate but user content shared without requiring an advanced degree computer science?!

Thanks,

jlinkels 01-13-2011 06:55 PM

Create a mount point for the NAS and mount it there. It'll look like a part of the hard disk. You can tune most programs so they use this folder as default directory.

If you are running Windows machines (better don't), either install NFS clients on the windows machines (but that is uncommon) or install Samba on the NAS. All NASes support that.

As for e-mail, Outlook don't let you store your mail folder where you want it. Use another e-mail client like Thunderbird which does, or even better use IMAP so the mail never reaches your computer.

jlinkels

schultzter 01-13-2011 10:22 PM

I need more details...
 
Quote:

Originally Posted by jlinkels (Post 4223599)
Create a mount point for the NAS and mount it there. It'll look like a part of the hard disk. You can tune most programs so they use this folder as default directory.

Yeah, I get that; but is there a standard/common/recommended location to mount things like photos, videos, music, documents, etc. from a NAS? I'm thinking something like /media/pictures, ... The directories will read/write so I wouldn't put them in a tree that is typically read-only (like /usr).

And what about the user's personal data from the NAS, I'm thinking that should be mounted in their home directory? Like /home/username/netdata

I've looked at the FHS but it's not much help.

The other question is how do I do the mounting since access to the NAS requires a username & password but I'd like those shares on the NAS to be mounted automagically whenever the user logs in. I don't think I could just put them into the /etc/fstab file so I'm thinking they need to go into some file that is run whenever the user logs in - but I don't know which one. Or is there another way of doing this? Is automount a viable solution?

Quote:

Originally Posted by jlinkels (Post 4223599)
If you are running Windows machines (better don't), either install NFS clients on the windows machines (but that is uncommon) or install Samba on the NAS.

My NAS supports CIFS (Samba), NFS, and a few others. I'm fine with using CIFS since there will occasionally be Windows machines accessing them (like my work laptop) but I could use NFS and CIFS if necessary.

Quote:

Originally Posted by jlinkels (Post 4223599)
All NASes support that.

All categorical statements are false!

Thanks,

mfaine 01-14-2011 08:47 AM

I have gone ahead and done it but with only one computer. I'm using autofs with /etc/auto.home configured

* server_ip:/volume1/homes/&

This will mount the home account from my NAS for the user at login.

It took a little planning and backing up and I still have my old /dev/sda1 partition that was /home and I'm thinking of rsyncing it using cron with the one on the NAS (at least for now) until I see if this will be a good solution.

linuxbird 01-15-2011 07:29 AM

I have all my networked machines running a NAS like /home. Performance with GUIs is only slightly slower, and usually unnoticeable. I'm not actually using a NAS, but rather a NFS mount to a server.

mfaine 01-16-2011 09:06 AM

Maybe it is just a matter of working the kinks out but I've had quite a bit of unreliable behavior since I started mounting /home from the NAS using autofs. I do still plan to pursue this strategy but ultimately what I need is a failover /home. I"m not sure how to do it yet. What I don't want is instability. I need to be able to login consistently without problems.

I'm hoping that something like this would work:
1. create a directory off off of / called home
2. put a directory in there for my user account. /home/mark
3. add .bashrc to the home directory with basic settings.
4. use autofs to mount my real home directory from the NAS overlaid on top of the existing /home
5. on failure the /home/mark directory would still be there and would work as a emergency home directory.

Perhaps I could even add a echo line to the end of .bashrc that would print something like: "NAS /home directory did not mount successfully, please check"

I could also use some NFS expert advice on making sure that the occasional network restart doesn't lock up my computer or cause loss of data. Getting the right set of options for NFS seems crucial.

schultzter 01-16-2011 07:37 PM

Try NFS from your /etc/fstab configuration
 
Quote:

Originally Posted by mfaine (Post 4226133)
I've had quite a bit of unreliable behavior since I started mounting /home from the NAS using autofs.

I'm not the expert here, but I'm working on it.

I dont' think autofs is the right solution for mounting your /home. I think autofs is used for those directories you only need occasionally and don't need to be mounted until you actually try to use them.

For mounting /home I think it should be mounted at boot time as part of the start-up process. That may mean having to use NFS or something that can handle linux/Unix file permissions (I'm not sure if Samba/CIFS can do that properly).

Do a man nfs in the terminal and it will show you how to setup your /etc/fstab file. I've never done it so I'm afraid I can't give you a working example.

mfaine 01-16-2011 11:24 PM

Yes, I'm using NFS exclusively. You may have a point about autofs for home even though there does seem to be support for using it in this way. The instructions for doing so are even a part of the man page (wildcard secion)

-Mark

jlinkels 01-17-2011 09:07 AM

This is an example of mounting an NFS drive thru fstab:

Code:

smc1.rnbxxxx.com:/home                  /mnt/smc1/home          nfs    rw,user        0      0
The mount point is /mnt/smc1/home. As you can see I do not mount my home directory, but mount it on a different location.

Autofs is a bad idea anyway. It just mounts when you need to access the file system. You need a fixed connection.

That having said, there are two ways to connect to NFS, UDP and TCP. TCP is unforgiving, if the server cannot be reached, your computer will hang if /home needs to be accessed until you can access it. UDP is more forgiving, but I don't know how exactly. You'll find docs about that on Google.

The question is whether you really want a sloppy mount on /home. In Linux it is possible to mount critical directories into your file system because mounts are considered reliable. Not being there is not an option, therefor the system hangs when a mount fails. If you start to accept that mounts sometimes are not there as expected you might damage your system.

jlinkels

schultzter 01-19-2011 11:27 PM

Change the XDG environment variables
 
Quote:

Originally Posted by jlinkels (Post 4218696)
If you have more than one computer, mounting /home from a NAS is a terribly bad idea if you run a GUI.

I may be totally off-base here, but I was trying to solve a totally un-related issue with Skype and I wondered if the solution to this problem might be changing the default XDG environment variables to point to somewhere different?


All times are GMT -5. The time now is 11:29 AM.