Score:1

replace phases of fsck in fstab

cn flag
MiK

I'm searching some way to replace fsck phases in my fstab file but only for line which contains specific path.

currently fstab looks like that:

/dev/mapper/vgroot-root /          xfs          defaults          0 0
/dev/mapper/vgroot-home /home          xfs          defaults          0 0
/dev/mapper/vgroot-opt /opt          xfs          defaults          0 0
/dev/mapper/vgroot-var /var          xfs          defaults          0 0
/dev/mapper/vgapp-optapp /opt/apt          xfs          defaults          0 0

192.168.1.1:/app/rep_t1 /data/rep_t1          nfsrep_t1 defaults          0 0
192.168.1.1:/app/rep_t1 /data/rep_t1          nfsrep_t1 defaults          0 0

I would like to change phases from "0 0" to "1 2" but only for local filesystem (/dev/mapper). How can i do that? Currenly i'm able to change only 1 value like below:

sed -i -e '/mapper/ s/0/1/' /etc/fstab

Here is how it should be:

/dev/mapper/vgroot-root /          xfs          defaults          1 2
/dev/mapper/vgroot-home /home          xfs          defaults          1 2
/dev/mapper/vgroot-opt /opt          xfs          defaults          1 2
/dev/mapper/vgroot-var /var          xfs          defaults          1 2
/dev/mapper/vgapp-optapp /opt/apt          xfs          defaults          1 2

192.168.1.1:/app/rep_t1 /data/rep_t1          nfsrep_t1 defaults          0 0
192.168.1.1:/app/rep_t1 /data/rep_t1          nfsrep_t1 defaults          0 0
Score:0
in flag

You were close:

sed -i '/mapper/ s/0 0/1 2/' /etc/fstab

See this excellent sed tutorial if you want to learn more.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.