0

I found two directories on some of my systems which are completely the same. All subdirectories and all files are the same. When I delete a file in one directory it disappears in other too. This would indicate sym links, doesn't it? But ls -s doesn't show any links on either side. What could it be? Thanks.

Reb
  • 71
  • 1
  • 2
  • 5
  • What are the directories? – dr_ Nov 19 '15 at 15:06
  • What does `mount` say? – EEAA Nov 19 '15 at 15:17
  • @Reb, You mean two directories in separate locations? Can you see, if you can run this command: `incrontab -l` – Diamond Nov 19 '15 at 15:19
  • @dr01: Directories are /dir01/ and /usr/local/dir02/. Names of dir01 and dir02 are different but everything downward is mirror picture. – Reb Nov 19 '15 at 15:48
  • @EEAA: None of my directories is mentioned in 'mount' output. – Reb Nov 19 '15 at 15:49
  • @bangal: Yes, as you can see in my reply to dr01 I'm talking about two directories on separate locations. 'incrontab -l' throws "no table for root". – Reb Nov 19 '15 at 15:49
  • @Reb, it means incron is installed in your system. Can you see if there is a file named: `/etc/incron.allow` and check it contents. – Diamond Nov 19 '15 at 15:56

3 Answers3

2

ls -s shows the file sizes, not the symlinks. Try the command ls -lap and most likely you'll see that your directories are symlinked.

file mydir will also tell you if the mydir directory is a symlink.

dr_
  • 1,035
  • 11
  • 19
  • I tried ls -lap, but no symlinks were found. Looks like this was not my problem. Thanks dr01. – Reb Nov 21 '15 at 10:53
1

Symlink

You can check the type of a file with the file command (note: do not include trailing slash on a dir).

Example:

$ file /bin 
/bin: symbolic link to usr/bin
$ file /usr/bin
/usr/bin: directory

Bind Mount

Allows you to mount a portion of a filesystem in another location. See http://man7.org/linux/man-pages/man8/mount.8.html for details.

You can see a list of bind mounts by running findmnt | fgrep [

  • It all ooks like this is my problem. List of bind mounts is: └─/dir01 /dev/mapper/centos-root[/usr/local/dir02] ext4 rw,relatime,data=ordered I should probably proceed with unmount /dir01? – Reb Nov 21 '15 at 10:57
0

It is possible that these two are directories synced automatically with incron.

Here is a detailed link on how to trigger commands on File/Directory changes with Incron on Debian

Incron is similar to cron, but instead of running commands based on time, it can trigger commands when file or directory events occur (e.g. a file modification, changes of permissions, etc.).

Since it seems, your computer have incron installed, you may look for possible configuration files (/etc/incron.allow, user's incrontab) and check how it is configured. While making some changes to the directory, logs should be seen also in syslog. See man incrontab for more info.

Can not say it for sure, but it's possible.

Diamond
  • 8,791
  • 3
  • 22
  • 37