- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Need to put new entries in /etc/fstab w/o editi...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-10-2010 12:08 AM
тАО11-10-2010 12:08 AM
Need to put new entries in /etc/fstab w/o editing the fstab!!
I have heavy load for adding new entries in fstab of more than 100 servers.
As usual I need to edit the /etc/fstab using vi and do the needed changes.
Is there any way to do this? So that I can create a script and to do the execution of that script till mounting.
I heard abt the use of echo command for appending entries in a file, but not sure more abt it.
my require ment is as below.
eg.
mkdir /tmp/test
cp -p /etc/fstab /etc/fstab.old
vi /etc/fstab ==> here I need the cmds for modifying the fstab!
mount -a
bdf /tmp/test
diff /etc/fstab /etc/fstab.old
date
---------
Here only editing fstab is problamatic ...
Your advice will more be appreciated
many thanks.
Rgds
Sreekumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-10-2010 02:09 AM
тАО11-10-2010 02:09 AM
Re: Need to put new entries in /etc/fstab w/o editing the fstab!!
Hi Sreekumar,
You can use echo command and append the fstab file with the needed entry. put an example below.
echo "/dev/vg01/lv1 /tmp/test ext3 defaults 1 2" >> /etc/fstab
if you need to modify a perticular line, then initially discard that line and copy it to a new file
cat /etc/fstab|grep -v "uniq string" >> fstab.new
mv fstab.new fstab
echo "/dev/vg01/lv1 /tmp/test ext3 defaults 1 2" >> /etc/fstab
enter the correct entry needed at the end
Regards
Jayakrishnan G Naik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-10-2010 02:26 AM
тАО11-10-2010 02:26 AM
Re: Need to put new entries in /etc/fstab w/o editing the fstab!!
echo "server:/share /tmp/test nfs rw,hard,intr 0 0" >> /etc/fstab
If you're adding a local/SAN disk, you can do it the same way:
echo "/dev/vgSOME/lvolX /tmp/test vxfs delaylog 0 2" >> /etc/fstab
This will add the line to the end of /etc/fstab.
Be careful to use ">>" (not ">"), otherwise you'll overwrite /etc/fstab with your new line instead of appending to it.
MK
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-11-2010 01:27 AM
тАО11-11-2010 01:27 AM
Re: Need to put new entries in /etc/fstab w/o editing the fstab!!
The echo option worked.
Thx again.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-11-2010 10:57 AM
тАО11-11-2010 10:57 AM
Re: Need to put new entries in /etc/fstab w/o editing the fstab!!
If instead of adding a new line you need to modify an existing one, you can do it with the stream editor. For more info, see man 1 sed.
Regards,
Viktor
Unix operates with beer.