5

I am working with a server running that has a 15GB root partition, a 1GB swap partition, and a 216.9GB home partition. Apparently, the server ran out of space on the root partition at some point and instead of extending it, a previous maintainer of the server moved the /usr/lib, /usr/share, and /usr/bin directories into /home/usr and made symlinks to the directories' new locations at their old locations.

The server is running Arch Linux 3.6.10-1. The root and home partitions each have an ext4 filesystem.

With the exception of small nuances such as having to explicitly tell find to follow symlinks while searching for a file in /usr, could this setup be problematic? I am especially concerned and curious about any security issues related to the setup.

2 Answers2

3

Use mount with bind option instead of symlinks and you wouldn't have such problems

To do so you can add a few line in your /etc/fstab (source ; french) :

/home/usr/bin        /usr/bin     none   bind    0       0
/home/usr/share      /usr/share   none   bind    0       0
/home/usr/lib        /usr/lib     none   bind    0       0

The general syntax :

/source              /destination none   [r]bind[,...] 0 0
Chris S
  • 78,455
aim
  • 131
2

There are two possible solutions I would consider here:

  1. Figure out what's filling up your root partition, and fix it.
    This is probably the right solution -- With a 15GB root partition (and a sane partition layout) you really shouldn't be filling up the root partition.
    Of course if the data is legit and the partitioning layout is not sane (e.g. /varis on the root partition) there's probably not much you can do about it.

  2. Rebuild the server with a sane partitioning scheme.
    If you've legitimately filled the root partition, or your partitioning scheme is not sane, you should rebuild the system with a more appropriate partition layout.
    This solution is pretty painful (you're going to have to back up your data, reinstall the system, and restore the data), but it will leave you with a clean machine that doesn't have symlinks or bind mountpoints hanging around where they shouldn't be, for you or some future admin to trip over later.

There are alternate solutions (like aim's suggestion of using bind mounts), but I would consider these to be stopgap measures to buy you time with the system operating while you plan for a real solution.

voretaq7
  • 80,749