- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- one-liner to add mount options to two mount points...
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
тАО05-04-2010 06:21 AM
тАО05-04-2010 06:21 AM
Before:
LABEL=/tmp1 /tmp ext3 defaults,acl 1 2
LABEL=/tmp1 /tmp ext3 defaults,acl,nodev,nosuid 1 2
I'm trying to do it using sed -i, but I am unable to get it give me desired output. Sorry if this is a duplicate, but I couldn't find a thread for exactly what I'm trying to do.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-04-2010 06:24 AM
тАО05-04-2010 06:24 AM
Re: one-liner to add mount options to two mount points in fstab
there is 1 tab between label and mount, and 2 tabs between mount point and file system type.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-04-2010 07:12 AM
тАО05-04-2010 07:12 AM
Solution$ echo 'LABEL=/tmp1 /tmp ext3 defaults,acl 1 2' | \
> sed -e 's/,acl/,acl,nodev,nosuid/'
LABEL=/tmp1 /tmp ext3 defaults,acl,nodev,nosuid 1 2
With my weak psychic powers, I can't see the
file. Are there any instances of ",acl"
which you don't wish to change?
> It might make a difference [...]
Not here, I believe.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-04-2010 07:17 AM
тАО05-04-2010 07:17 AM
Re: one-liner to add mount options to two mount points in fstab
LABEL=/1 / ext3 defaults,acl 1 1
/dev/cciss/c0d1p5 /backup ext3 defaults 1 2
LABEL=/boot1 /boot ext3 defaults,acl 1 2
none /dev/pts devpts gid=5,mode=620 0 0
none /dev/shm tmpfs defaults 0 0
LABEL=/home1 /home ext3 defaults,acl 1 2
LABEL=/opt1 /opt ext3 defaults,acl 1 2
none /proc proc defaults 0 0
none /sys sysfs defaults 0 0
LABEL=/tmp1 /tmp ext3 defaults,acl 1 2
LABEL=/usr1 /usr ext3 defaults,acl 1 2
LABEL=/var1 /var ext3 defaults,acl 1 2
LABEL=SW-cciss/c0d0p2 swap swap defaults,acl 0 0
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-04-2010 08:16 AM
тАО05-04-2010 08:16 AM
Re: one-liner to add mount options to two mount points in fstab
> var mount point [...]
My regular expression skill is near-minimal,
but you might try something like:
sed -e '/\/tmp\|\/var/s/,acl/,acl,nodev,nosuid/'
$ cat fstab
LABEL=/tmp1 /tmp ext3 defaults,acl 1 2
LABEL=/usr1 /usr ext3 defaults,acl 1 2
LABEL=/var1 /var ext3 defaults,acl 1 2
LABEL=SW-cciss/c0d0p2 swap swap defaults,acl 0 0
$ sed -e '/\/tmp\|\/var/s/,acl/,acl,nodev,nosuid/' < fstab
LABEL=/tmp1 /tmp ext3 defaults,acl,nodev,nosuid 1 2
LABEL=/usr1 /usr ext3 defaults,acl 1 2
LABEL=/var1 /var ext3 defaults,acl,nodev,nosuid 1 2
LABEL=SW-cciss/c0d0p2 swap swap defaults,acl 0 0
man sed
Adding some white space around those names
might be wise, especially if you expect plain
"/tmp" or "/var" to match too many things.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-04-2010 08:24 AM
тАО05-04-2010 08:24 AM
Re: one-liner to add mount options to two mount points in fstab
I don't have to worry about multiple tmp\var mount points so your sed line will work perfectly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-04-2010 08:25 AM
тАО05-04-2010 08:25 AM