Sponsored Content
Top Forums Shell Programming and Scripting How to replace value in fstab file? Post 303026259 by Corona688 on Thursday 22nd of November 2018 02:50:51 PM
Old 11-22-2018
Scripting changes to vital system files is very, very dangerous. Be sure you have a plan B in case that goes badly.

If I had to, I'd be paranoid and verify every part of the line.

Code:
awk '(NF==6)&&($1=="/dev/VolGroup00/tmp")&&($2=="/tmp")&&($3=="ext3")&&($4=="defaults"){ print $1,$2,$3,$4,1,1; next } 1' /etc/fstab > /tmp/fstab
# Uncomment once you've tested and are sure /tmp/fstab is what you want it to be.
# use cat, not mv, because mv may change permissions and ownership
# cat /tmp/fstab > /etc/fstab
rm -f /tmp/fstab


Last edited by Corona688; 11-22-2018 at 04:13 PM..
 

10 More Discussions You Might Find Interesting

1. Linux

/etc/fstab

I've created a new drive and i've added it to my fstab file but on startup it will not mount. here is how i put it into my fstab file, is that right? /dev/hdb2 /disk2a ext3 defaults 1 2 (6 Replies)
Discussion started by: byblyk
6 Replies

2. UNIX for Dummies Questions & Answers

fstab question

Folks; Please be patient with this issue when you read it. I know it's a little tricky. I have a new share created on my SUSE 10 box. I'm trying to edit the /etc/fstab file or find a way to make this share needs no authentication. The reason for that is we're using an outside application to... (3 Replies)
Discussion started by: Katkota
3 Replies

3. UNIX for Dummies Questions & Answers

FSTAB Problem

Hello, I transferred a machine from a tape back into a virtual machine. I created several paritions so I could xfter the date into them and made sda1 the active one. When I try and boot the VM it does not work. I used KNOPPIX to create the partitions and transfer the information from the tape... (1 Reply)
Discussion started by: mojoman
1 Replies

4. Red Hat

edit/write the /etc/fstab file

Hi, I comment out some vol group in fstab accidentally. I also comment the swap space in /etc/fstab But I cannot edit /remove it back by using vi /etc/fstab again in init 1 and init 6 . The file system /etc/fstab is read -only . I cannot chmod ..... What can I do in order to recover it ... (2 Replies)
Discussion started by: chuikingman
2 Replies

5. UNIX for Dummies Questions & Answers

fstab

hi , i'm creating a shell script using fstab for my project of last year, i wonder you can help me to know what is the command allow me to get the list of unmounted partitions. thanks (4 Replies)
Discussion started by: Linux001
4 Replies

6. Ubuntu

fstab question

I have created a thumbdrive with a bootable version of Ubuntu 10.04 LTS, it uses Grub legacy. One of the issues I have is that everytime I boot a new system from the thumbdrive, it writes entries for the partitions in the fstab. Consequently, when I boot another system, the OS reads the fstab... (2 Replies)
Discussion started by: stumpyuk
2 Replies

7. Red Hat

Effects of /etc/fstab file!

Hi Folks! I accidentally overwrote in /etc/fstab file. Can you guys please tell me, what impact it would have created, when I restarted the machine(RHEL6). I executed this command : # blkid /dev/vda5 > /etc/fstab (17 Replies)
Discussion started by: nixhead
17 Replies

8. Red Hat

Mount /etc/fstab

Can you please help me mount below filesystem in fstab ( I have rhel 5 ) as the line is long - it is not taking as single line How can break this in 2 line and act as one ....please help ... (4 Replies)
Discussion started by: saurabh84g
4 Replies

9. Linux

/etc/fstab entries

Hi, Can anyone explain why we use defaults 0 0 in fstab and what does 0 inidicate 10.250.104.50:/home/u /home/u nfs defaults 0 0 Thanks in advance Muzaffar (3 Replies)
Discussion started by: muzaffar.k
3 Replies

10. Ubuntu

Create zip file from root owned fstab

I want to zip up my fstab file for backup purposes. This does not work because of permission issues. cd /etc/ zip -u fstab.zip fstab Can I use this with zip? echo xxx | sudo -S or change fstab owner to me? (3 Replies)
Discussion started by: drew77
3 Replies
QUOTAON(8)						    BSD System Manager's Manual 						QUOTAON(8)

NAME
quotaon, quotaoff -- turn filesystem quotas on and off SYNOPSIS
quotaon [-g] [-u] [-v] filesystem ... quotaon [-g] [-u] [-v] -a quotaoff [-g] [-u] [-v] filesystem ... quotaoff [-g] [-u] [-v] -a DESCRIPTION
quotaon announces to the system that disk quotas should be enabled on one or more filesystems. quotaoff announces to the system that the specified filesystems should have any disk quotas turned off. The filesystems specified must have entries in /etc/fstab and be mounted. quotaon expects each filesystem to have quota files named quota.user and quota.group which are located at the root of the associated file system. These defaults may be overridden in /etc/fstab. By default both user and group quotas are enabled. Available options: -a If the -a flag is supplied in place of any filesystem names, quotaon/quotaoff will enable/disable all the filesystems indicated in /etc/fstab to be read-write with disk quotas. By default only the types of quotas listed in /etc/fstab are enabled. -g Only group quotas listed in /etc/fstab should be enabled/disabled. -u Only user quotas listed in /etc/fstab should be enabled/disabled. -v Causes quotaon and quotaoff to print a message for each filesystem where quotas are turned on or off. Specifying both -g and -u is equivalent to the default. FILES
quota.user at the filesystem root with user quotas quota.group at the filesystem root with group quotas /etc/fstab filesystem table SEE ALSO
quota(1), libquota(3), fstab(5), edquota(8), quotacheck(8), repquota(8) HISTORY
The quotaon command appeared in 4.2BSD. BSD
December 11, 1993 BSD
All times are GMT -4. The time now is 12:37 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy