Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Iam very new to linux. suppose i have two file with same name fstab one file is located in /etc and the other is located in /root/ If i make a change in /etc/fstab file the changes has to reflect in /root/fstab . Is there any command to do this? Kindly help me...


share|improve this question

Given your comment to @ewwhite, a symbolic link won't solve your problem. The symbolic link will be replicated, but not the file contents. You have several options. The simple one:

  • Periodically copy /etc/fstab to /root/fstab using a cron job.

More work but exactly what you want:

  • Use something like incron to arrange for a script to run whenever /etc/fstab changes. This can then copy the file to wherever the file needs to go.
share|improve this answer
But based on the comment to @ewwhite, cron is probably also not a good option. There are procedures and tools specifically for doing this in a DRBD environment, including /etc/fstab and other files/directories. See my response for more details. – Sean Reifschneider Nov 23 '10 at 13:43

You could use a symbolic link to the original file in /etc/fstab.

ln -s /etc/fstab /root/fstab

That creates a link at /root/fstab that points to the file at /etc/fstab.

May I ask why you need to see that file in multiple locations? Why not just use /etc/fstab?

share|improve this answer
Iam using HA drbd for replication.My replicated device is in one partion(sda3) and /etc is in one partion.After failover only the file in sda3 are replicating.In my case files are replicating but the fstab file of (/etc/) also has to change at a time. – user58513 Nov 23 '10 at 12:37
Yes, the DRBD scenario changes this a bit... I'd go with one of the purpose-built utilities or some thing like a scheduled synchronization. – ewwhite Nov 23 '10 at 15:32

For /etc/fstab on Linux-HA, you typically would not change /etc/fstab as part of the resource start. Normally what you would do is list all the mount-points you may have, but ones that are not always mounted list with "noauto". For example:

/dev/drbd0           /shared              ext3       defaults,noauto,noatime 0 0
/dev/drbd1           /var/lib/pgsql       ext3 defaults,noauto,noatime 0 0

At boot time those file-systems will not be mounted. Then, to bring those file-systems up you would list a resource like:

Filesystem::/dev/drbd0::/shared::ext3 \
Filesystem::/dev/drbd1::/var/lib/pgsql/::ext3 \

Additionally, you may wish to look at drbdlinks (probably available in your distro) which manages links to DRBD file-systems. However, I don't think you want to make /etc/fstab a drbdlink...

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.