Edited /etc/fstab is empty after reboot

Status
Not open for further replies.

Morktral

Cadet
Joined
Sep 27, 2016
Messages
7
Hi there,

I´m new to FreeNAS (and of course FreeBSD), but quite experienced with Linux.

I wanted to mount some NFS shares which are on other NAS Systems onto the FreeNAS Server (9.10), so I edited the /etc/fstab accordingly. Which did work until I rebooted the system. Afterwards the /etc/fstab was empty (and the NFS shares not mounted). So my assumption is that there is another file somewhere which is overwriting those settings made there.

Could anyone of the more experienced guys point me to the right place?

Thanks for your help

Michael
 
Last edited:

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,995
There is a way but I caution you, you will be messing with the FreeNAS OS. A simple Google search came up with /conf/base/etc/fstab. I haven't edited files in this location in quite a while and they may not be retained during a software update either, but as memory recalls, they survive a reboot.

You should read up more on how FreeNAS runs.
 

m0nkey_

MVP
Joined
Oct 27, 2015
Messages
2,739
Hi there,

I´m new to FreeNAS (and of course FreeBSD), but quite experienced with Linux.

I wanted to mount some NFS shares which are on other NAS Systems onto the FreeNAS Server (9.10), so I edited the /etc/fstab accordingly. Which did work until I rebooted the system. Afterwards the /etc/fstab was empty (and the NFS shares not mounted). So my assumption is that there is another file somewhere which is overwriting those settings made there.

Could anyone of the more experienced guys point me to the right place?

Thanks for your help

Michael
OK, first of all, don't edit system files. They will get overwritten. Second, don't mess with /conf, that will screw things up even more.

FreeNAS is an appliance OS. Which means you shouldn't be asking it to do something it was never intended, in this case, mount NFS shares using fstab.

Mounting an NFS share is possible, however I strongly recommend you mount the shares manually or using a post-init script.
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,995
I provided a reasonable answer to the question at hand. Editing the file in question (/conf/base/etc/fstab) should be fine if the user knows what they are doing. This is how we made changes all the time in FreeNAS. It's also a good way to learn FreeNAS. If a person doesn't know what they are doing then of course it's not recommended but there is nothing wrong with this if you cannot achieve your goal in another way.

I would turn off automatic updates if you go down this path only because an update is likely to remove any changes you made. If you can build a post-init script then as the others have said, that would be a much better solution.
 

Morktral

Cadet
Joined
Sep 27, 2016
Messages
7
Would it be better to mount the nfs shares only to the necessary jails instead to the whole system?
(tried that, but got an error message)

Trying right now to mount the nfs shares via script/command:

Is there a way to test the commands before trying to reboot?
 
Last edited:

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,995
Is there a way to test the commands before trying to reboot?
Yes, I would not reboot FreeNAS over and over again to test your script. Create your script, run the script to mount your shares. Umount your shares and run the script again. If you can get the script to run fine then all you need to do is configure the script to run after FreeNAS boots and then the final test, reboot FreeNAS and cross your fingers.
 

Morktral

Cadet
Joined
Sep 27, 2016
Messages
7
Hi again,

sorry to bother you again :(

I did manage to mount the nfs shares via init command during startup, which is working, but I can not "forward" the folder to my jails.
In the jails the folder is empty. I double checked it via shell in the corresponding jail.
Any ideas? Am I wrong with the idea that a mounted nfs share can be forwarded to a jail?

By the way, great help here. Very much appreciated! :)
 

pirateghost

Unintelligible Geek
Joined
Feb 29, 2012
Messages
4,219
Hi again,

sorry to bother you again :(

I did manage to mount the nfs shares via init command during startup, which is working, but I can not "forward" the folder to my jails.
In the jails the folder is empty. I double checked it via shell in the corresponding jail.
Any ideas?

By the way, great help here. Very much appreciated! :)
Did you add that mount point as storage for the jail?
 

Morktral

Cadet
Joined
Sep 27, 2016
Messages
7
Did you add that mount point as storage for the jail?

Yes, and I checked via shell "ls" if I can see the mounted folders/files. When I´m in the "main" shell, wehere the folder is mounted with nfs via script I can see everything. After assigning the folder from /mnt/files to the jail /media/files, the folder doesent´show anything. It´s empty.
I will try to investigate this this evening further... looks strange to me.


EDIT: I deleted both folders and created everything from scrap, which then lead to the right solution! Thanks for the helpful hints... :)
 
Last edited:

DrKK

FreeNAS Generalissimo
Joined
Oct 15, 2013
Messages
3,630
I provided a reasonable answer to the question at hand. Editing the file in question (/conf/base/etc/fstab) should be fine if the user knows what they are doing. This is how we made changes all the time in FreeNAS. It's also a good way to learn FreeNAS. If a person doesn't know what they are doing then of course it's not recommended but there is nothing wrong with this if you cannot achieve your goal in another way.

The thing I'd say on this, Joe, with all due respect, is if a user doesn't already know how to set up the mount writable, how to change the base conf, then reset the appliance mount, and the implications for various SU's, and so on, that probably we should not be telling them. I agree with what you're saying of course from the technical standpoint, but for me, this is in the category of "If a user does not already know how to do this, it would be irresponsible to tell him". Then of course there's a subsequent danger that having enshrined it in a post, the next complete idiot, who really doesn't know a single thing at all (versus the almost-but-not-quite-there user that originated the discussion), will then willy-nilly be jacking with his appliance. Which is not only bad for him, it's bad for us.

Just an opinion.
 

lmannyr

Contributor
Joined
Oct 11, 2015
Messages
198
Id love to see a copy of that script
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,995
The thing I'd say on this, Joe, with all due respect, is if a user doesn't already know how to set up the mount writable, how to change the base conf, then reset the appliance mount, and the implications for various SU's, and so on, that probably we should not be telling them. I agree with what you're saying of course from the technical standpoint, but for me, this is in the category of "If a user does not already know how to do this, it would be irresponsible to tell him". Then of course there's a subsequent danger that having enshrined it in a post, the next complete idiot, who really doesn't know a single thing at all (versus the almost-but-not-quite-there user that originated the discussion), will then willy-nilly be jacking with his appliance. Which is not only bad for him, it's bad for us.

Just an opinion.
I completely understand what you are saying however I'm certain that we will not agree on this topic, and that is fine, however while there are people out there who do not have a clue what they are doing, there are also people out there who are technically competent and should be provided the information if it's asked.

I have never been on a forum where information was held back just because someone might use it incorrectly. If a question is asked, I have always expected a complete and accurate answer. If we are asked to provide data, I feel obligated to provide the best answer I can and depending on the data provided I would add a risk message.
 

wblock

Documentation Engineer
Joined
Nov 14, 2014
Messages
1,506
I have never been on a forum where information was held back just because someone might use it incorrectly. If a question is asked, I have always expected a complete and accurate answer. If we are asked to provide data, I feel obligated to provide the best answer I can and depending on the data provided I would add a risk message.
I agree with this. Incomplete information is usually a bigger problem. Just always remember to include warnings with potentially risky information.
 
Status
Not open for further replies.
Top