how to bulk update /etc/fstab file

I have about 50 linux servers need updating the records inside /etc/fstab file.

The only change is from  those that have netapp:/vol/vol_orabackup mounted to svm2nfs:/vol_orabackup.

The original is netapp:/vol_orabackup      /orabackup       nfs     rw,bg,hard,nointr,rsize=32768,wsize=32768,tcp,noac,vers=3,timeo=600

The destination is svm2nfs:/vol_orabackup      /orabackup       nfs     rw,bg,hard,nointr,rsize=32768,wsize=32768,tcp,noac,vers=3,timeo=600

 Can I write a script and run the script to update it?

I heard about some configuration update tool, is there a tool I can use to manage all configuration files on linux. thank you.
Jason YuAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jason YuAuthor Commented:
I got the following lines as below, please give your advise:

#!/bin/bash

DIRECTORY=/orabackup2

if [ ! -d "$DIRECTORY" ]; then
  # Control will enter here if $DIRECTORY doesn't exist.
  mkdir /orabackup2
fi


#Create temporary file with new line in place

cat /etc/fstab | sed -e "s/netapp\:\/vol/svm2nfs/" > /tmp/test1

#Copy the new file over the original file

mv /tmp/test1 /etc/fstab

Open in new window

0
Duncan RoeSoftware DeveloperCommented:
The sed command looks wrong to me. I find it best to use a delimiter other than slash when editing text containing slashes. Although in this case you don't really need any slashes: how about 's/netapp/svm2nfs/'
0
gheistCommented:
You should not use long netapp mount options meant for DB data mounts for 1) backup volume 2) non-netapp volumes
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

Duncan RoeSoftware DeveloperCommented:
@gheist: In this context, netapp is simply a host name is it not?
0
Jason YuAuthor Commented:
Yes, netapp is just a share name on netapp storage device.
0
gheistCommented:
I am absolutely sure that netapp changed their recommendation to r/wsize=64k couple of years ago.
0
gheistCommented:
sed (
sed -i s/netapp:\/vol/svm2nfs/g /etc/fstab
0
Duncan RoeSoftware DeveloperCommented:
The original Q asked how to change netapp:/vol_orabackup to svm2nfs:/vol_orabackup (i.e. with no /vol component to remove) so I stick by my suggested sed line in http:#a40731046
Were there a /vol to remove, I would suggest s+netapp:/vol+svm2nfs+ i.e. use a delimiter that does not occur in the original or replacement string
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
gheistCommented:
Yes, but add -i parameter to edit in-place...
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux Distributions

From novice to tech pro — start learning today.