3 Answers
3

I don't use mongo but I would presume there is a way to configure its data directory, in which case your best bet might be to create a directory for it in /home and then use that instead of /data/db. You would want to do that as root, so the directory still has the correct owner. [see the last paragraph here for more about that...]

Another option is to use a symbolic (aka 'soft') link. First:

sudo mkdir -p /home/mongo/data/db

This creates the directory you are going to use within the 1.8 TB /home partition. Now check what the ownership and permissions are on /data/db and make sure they are duplicated for the new directory. Now move all the data from /data/db into that directory and delete the now empty inner db directory (but not /data itself). Next:

sudo ln -s /home/mongo/data/db /data/db

This creates a soft link from /data/db to /home/mongo/data/db; anything put into the former will actually go into the later, and likewise WRT to accessing the content (these two paths are linked and point to the same place, which is the one in /home). If you haven't used sym links like this before, they are a pretty handy general purpose *nix tool and very easy to understand. Google and read up on them.

Some software, generally outward facing servers, may have (optional) security restrictions to do with following symlinks. I did a quick web search to check about this WRT mongo and I don't think there is a problem, but in the process I did find this comment about the data directory, lol:

By default, mongod writes data to the /data/db/ directory. [...] You
can specify, and create, an alternate path using the --dbpath option
to mongod and the above command.