1833780 Members
2511 Online
110063 Solutions
New Discussion

Scripting a fstab

 
SOLVED
Go to solution
Richard Pereira_1
Regular Advisor

Scripting a fstab

Hi,
I have a batch script that creates a series of lvols and filesystems and then mounts them with specific options (largefiles, nosuid, etc)

I was asked to have the script create a "shadow" fstab and then cat it to my existing fstab. Once this is dont, i can umount fine, but mount always fails.

exemple of my file;
/dev/vgrestores/lvR69saparc /oracle/R69/saparch vxfs largefiles,detainlog 0 2
/dev/vgrestores/lvR69orasid /oracle/R69 vxfs rw,nosuid,delaylog,largefiles,detainlog 0 2
/dev/vgrestores/lvR69saparc /oracle/R69/saparch vxfs rw,nosuid,delaylog,largefiles,detainlog 0 2
/dev/vgrestores/lvR69saprg /oracle/R69/sapreorg vxfs rw,nosuid,delaylog,largefiles,detainlog 0 2
/dev/vgrestores/lvR69817 /oracle/R69/817_64 vxfs rw,delaylog,largefiles,detainlog 0 2
/dev/vgrestores/lvR69mlogA /oracle/R69/mirrlogA vxfs rw,nosuid,delaylog,detainlog 0 2
/dev/vgrestores/lvR69mlogB /oracle/R69/mirrlogB vxfs rw,nosuid,delaylog,detainlog 0 2
/dev/vgrestores/lvR69ologA /oracle/R69/origlogA vxfs rw,nosuid,delaylog,detainlog 0 2
/dev/vgrestores/lvR69ologB /oracle/R69/origlogB vxfs rw,nosuid,delaylog,detainlog 0 2

however when i umount and try mounting with this script, i get errors from mount , stating;
vxfs mount: illegal -o suboption -- rw
vxfs mount: Usage: [....]

as a test i removed the rw, but it still errors regardless what options are there. as another test, i wrote the file manually (thinking of hidden characters) but it also fails. Any ideas are welcomed
12 REPLIES 12
Mark Greene_1
Honored Contributor

Re: Scripting a fstab

How are you doing the cat? as >/etc/fstab or as >>/etc/fstab? If you are doing the former and it results in the file getting a new inode, and if some other process (like mountd) has an active lock on the file prior to the cat, you've got a timing problem.

mark
the future will be a lot like now, only later
A. Clay Stephenson
Acclaimed Contributor

Re: Scripting a fstab

first thing I see is that "detainlog" should be "datainlog"
If it ain't broke, I can fix that.
Steven E. Protter
Exalted Contributor

Re: Scripting a fstab

Be nice to see the script.

man on the mount command will provide you the ability to modify your script. The command might not be formed correctly in the script.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Sridhar Bhaskarla
Honored Contributor

Re: Scripting a fstab

Richard,

Clay was right on it. Just change 'detainlog' to 'datainlog' and everything will work fine.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Richard Pereira_1
Regular Advisor

Re: Scripting a fstab

oops, your right about the datainlog, still fails hoever. heres the weirdest part. i just did a more simple test.

i used vi and edited the current /etc/fstab and added the following manually

/dev/vgrestores/lvR69mlogA /oracle/R69/mirrlogA vxfs rw,nosuid,nolargefiles,delaylog,datainlog 0 2

# mount /oracle/R69/mirrlogA
vxfs mount: illegal -o suboption -- rw
vxfs mount: Usage:
mount [-l] [-v|-p]
mount [-F vxfs] [-eQ] -a
mount [-F vxfs] [-eQrV]
[-o [rw|ro] [suid|nosuid] [quota] [remount]
[log|delaylog|tmplog] [largefiles|nolargefiles]
[fsetname=fileset] [qio|noqio]
[mincache=direct|dsync|closesync|tmpcache|unbuffered]
[convosync=direct|dsync|closesync|delay|unbuffered]
[datainlog|nodatainlog] [blkclear] ] {special | mount_point}
mount [-F vxfs] [-eQrV]
[-o [rw|ro] [suid|nosuid] [quota] [remount]
[log|delaylog|tmplog] [largefiles|nolargefiles]
[fsetname=fileset] [qio|noqio]
[mincache=direct|dsync|closesync|tmpcache|unbuffered]
[convosync=direct|dsync|closesync|delay|unbuffered]
[datainlog|nodatainlog] [blkclear] ] special mount_point
mount [-F vxfs] [-eQrV]
[-o [ro] [suid|nosuid] [snapof=primary_special]
[snapsize=blocks] ] special mount_point

could there be a bigger issue going on? seems anything i add fails, even using vi and editing myself.
Mark Greene_1
Honored Contributor

Re: Scripting a fstab

Richard,

Restart mountd with the -l options to log errors, and the -t option set to 2. Then run your tests and you should get more specific info from mountd about what it doesn't like. Are you getting any sort of errors in your syslog?

mark
the future will be a lot like now, only later
John Poff
Honored Contributor

Re: Scripting a fstab

Hi,

I don't separate the options with commas in my fstab files, I just use spaces. Also, the 'rw' option is the default so you shouldn't have to specify it.

JP
Geoff Wild
Honored Contributor

Re: Scripting a fstab

That is wacked...

/dev/vg01/lvpatch /var/software/patch vxfs rw,suid,largefiles,delaylog,datainlog 0 2

I do it like that - and it works fine - nothing wrong with commas nor rw....

Try it again - with /sbin/mount

Sounds like you may have corruption in your fstab file - illegal characters or something...


Check for tabs with vi, :set list

As tedious as it may be, recreate your fstab file - by hand - do NOT cut paste.

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Mark Greene_1
Honored Contributor
Solution

Re: Scripting a fstab

If the concern is really about bogus characters, cat -v will reveal more than vi will, but the true test is od -c /etc/fstab|pg. It's tedious, but there's nothing to be missed as long as you are thorough in your review.

mark
the future will be a lot like now, only later
John Poff
Honored Contributor

Re: Scripting a fstab

Another trick you can use is the 'mount -p' command which reports the list of mounted filesystems in /etc/fstab format. Get the filesystems mounted manually, do a 'mount -p >fstab.new' and then rename the fstab files around.

JP
Richard Pereira_1
Regular Advisor

Re: Scripting a fstab

thanks for the great suggestions, somehow a garbage char was getting inserted. But what i ended up doing anyways was avoiding touching the systems /etc/fstab and just built a seporte file called fstab.app and then had a routine go through the list and mount what was defined in there.

as usual, you guys offered quick and helpfull responses
Richard Pereira_1
Regular Advisor

Re: Scripting a fstab

closing thread