Home
Blog
About
Database administration
Operating systems
Development
Links


Following require login:
ScratchPad



Locations of visitors to this page


mount

In the process of bulding servers for what will be a large-ish SAP landscape.
Some of the directory structure is dictated by SAP, some by DB2 and some by us.
On some of our servers it's expedient to have a single large filesystem rather than the filesystem per dirrectory that will appear on the production servers.

We could have used symbolic links to mimic the production layout and that is supported by SAP and DB2.
The problem with that though is that it makes the server a lot more difficult to administer in my view.

Instead we have used mount –bind to map one directory onto another in much the same way as subst works on Windows.
For example:

sh-3.2# mkdir /db2
sh-3.2# mkdir /u01/db2
sh-3.2# mount --bind /u01/db2 /db2
sh-3.2# df -ak
Filesystem           1K-blocks      Used Available Use% Mounted on
...
/u01/db2              39184544    504996  36656968   2% /db2

For me this has a number of advantages:

  • Mounted directory appears in df so it's immediately apparent where the files are located.
  • The mount commands can be put into /etc/fstab which documents the setup.
  • It would be slightly more difficult to unmount one of these directories than it is to delete a symbolic link!
  • ls of a symbolic link just lists the link target, -ls of a mount –bind behaves more normally.

And only one disadvantage:

  • Need to include -a in df for these mounts to appear, see above example.
    Easily fixed by create an alias for df, e.g.
    $ alias df='df -a'
    $ df -k
    Filesystem           1K-blocks      Used Available Use% Mounted on
    ...
    /u01/db2              39184544    504996  36656968   2% /db2

To ensure these directories get mounted on server boot they can be added to /etc/fstab with an entry similar to:

# Field 5 = should FS be dumped, 0=no
# Field 6 = should FS be fsckd, 0=no
/u01  /db2  none  rw,bind 0 0

Copyright HandyDBA 2012