[ale] Strange filesystem behavior

DJ-Pfulio DJPfulio at jdpfu.com
Wed Apr 13 16:05:59 EDT 2016


Symbolic links **can** cross file systems, unlike hard links.
Shells interpret (glob) different ls/cd input differently. For example,
I know that tsch/csh won't follow symbolic links, but some (all?) bash
versions do.  So if you cd following a symbolic link, the way back will
not necessarily follow the way you got there.

I've don't this a few times when a system ran out of storage and almost
always do it on VM hosts if using simple file-based VMs in
/var/lib/libvirt/images/

Use ls -al to see links. I like to alias ls='ls -F' so that links show
up in all 'ls' commmands wiht an '@'. But if you run any scripts that
use 'ls' as input (not a good practice, but ... sometimes I do it too),
remember to use \ls so the alias won't be used.

Or did I miss the question completely?

On 04/13/16 15:18, Michael Hirsch wrote:
> Can anyone explain this?  The owners of this system use a lot of
> symlinks to play weird games with their files.  For instance, in the
> directory used below, /var/tmp/jobsched/jaws/conf the last entry,
> conf, is actually a symlink into another filesystem entirely.  But I
> still don't understand how this is possible.
> 
> Consider this:
> bash-4.1$ pwd
> /var/tmp/jobsched/jaws/conf
> bash-4.1$ ls ../../../..
> autosys_api  common  daemon         jaws.sh            jboss  log
> sbin     sdk
> batch        config  import_export  jaws.sh.vmoptions  lib    README
> scripts  tools
> bash-4.1$ cd ../../../..
> bash-4.1$ ls
> account  cvs    etscfg  lib    lost+found  mqm.client  phd        run
>    VRTSat_lhc  yp
> adm      db     ftp     local  lum         nis         preserve
> spool   VRTSvcs     zapplets
> cache    db2    games   lock   mail        openv       prodperim  tmp     vx
> crash    empty  gdm     log    mqm         opt         redhat     VRTSat  vxvm
> 
> So when I "ls ../../../.." ls sees a bunch of file, starting with
> "autosys_api" and "common".  But if I cd to that directory ls sees a
> completely different set of files.
> 
> I didn't think that symlinks and filesystems worked like this.  I
> expected to see the same files in the two "ls" commands.
> 
> What is making this happen?  What am I missing.
> 


More information about the Ale mailing list