Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I am running RHDS in a VM, but would like to store the data and logs on a separate volume, that is on a SAN. The partition is ext4fs on /sdb1 and is mounted as /data.

I tried many variations of the different approaches described here. First, after a fresh install of RHDS, before I created any instances, I created the folders on /data and linked to them from /var, as follows:

mkdir /data/lib
mkdir /data/log
mkdir /data/lib/dirsrv
mkdir /data/log/dirsrv
rmdir /var/log/dirsrv
rmdir /var/lib/dirsrv
ln -s /data/lib/dirsrv/ /var/lib/
ln -s /data/log/dirsrv/ /var/log/

When I create an instance (named esx02vm01) of the directory, I get this error:

[02/May/2013:09:51:45 -0400] - /etc/dirsrv/slapd-esx02vm01/dse.ldif:
nsslapd-errorlog: Cannot open errorlog file
"/var/log/dirsrv/slapd-esx02vm01/errors",
errors cannot be logged.  Exiting....

I thought RHDS might be having trouble with the symbolic links. In my second attempt, I instantiated with files in the default locations. After confirming the directory was working, I shut it down. Then I moved the instance folders under /var/lib and /var/log over to the /data folder and modified the dse.ldif file for that instance to point to the new folder locations, as follows:

mkdir /data/lib
mkdir /data/log
mkdir /data/lib/dirsrv
mkdir /data/log/dirsrv
cp -r --preserve=all /var/lib/dirsrv/slapd-esx02vm01 /data/lib/dirsrv/
cp -r --preserve=all /var/log/dirsrv/slapd-esx02vm01 /data/log/dirsrv/
vi /etc/dirsrv/slapd-esx02vm01/dse.ldif
* replace all /var/lib/dirsrv/slapd-esx02vm01 with /data/lib/dirsrv/slapd-esx02vm01*
:%s/\/var\/lib\/dirsrv\/slapd-esx02vm01\//\/data\/lib\/dirsrv\/slapd-esx02vm01\//g
* (6 substitutions on 6 lines)
* replace all /var/log/dirsrv/slapd-esx02vm01 with /data/log/dirsrv/slapd-esx02vm01
:%s/\/var\/log\/dirsrv\/slapd-esx02vm01\//\/data\/log\/dirsrv\/slapd-esx02vm01\//g
* (4 substitutions on 4 lines)
:qw
mv /var/lib/dirsrv/slapd-esx02vm01 /var/lib/dirsrv/old-slapd-esx02vm01
mv /var/log/dirsrv/slapd-esx02vm01 /var/log/dirsrv/old-slapd-esx02vm01
service dirsrv start

I got the same error attempting to start the directory:

Starting dirsrv:
esx02vm01...[03/May/2013:08:56:00 -0400] - /etc/dirsrv/slapd-esx02vm01/dse.ldif:
nsslapd-errorlog: Cannot open errorlog file
"/data/log/dirsrv/slapd-esx02vm01/errors",
errors cannot be logged.  Exiting....

Then, I moved the error file back to the original location, so just the database file was on /data. These errors where logged when the directory is started:

[03/May/2013:09:17:17 -0400] - 389-Directory/1.2.11.15 B2013.100.2247 starting up
[03/May/2013:09:17:17 -0400] - mkdir_p : error -5950 (File not found.)
[03/May/2013:09:17:17 -0400] - Can't start because the database directory
"/data/lib/dirsrv/slapd-esx02vm01/db" either doesn't exist, or is not accessible
[03/May/2013:09:17:17 -0400] - start: Failed to init database, err=-1 Unknown error: -1

In each case, I confirmed that the reported directories and files exist, and that they have the same ownership and permissions as the original directories and files. When I created the instance, I ran setup-ds-admin.pl as root, using the account rhds for the instance. I created the rhds user with the command:

useradd -M rhds

What is the proper way to relocate the databases for an instance of Red Hat Directory Server?

-Luke

share|improve this question

1 Answer 1

The following procedure works successfully for me with 389-ds 1.2.9.14:

  1. create a new instance
  2. make sure dirsrv is stopped: service dirsrv stop
  3. move the /var/lib/dirsrv/ directory to the data partition; in my case /mnt/389ds/data/
  4. create a symbolic link from /var/lib/dirsrv/ to /mnt/389ds/data/
  5. move the /var/log/dirsrv/ directory to the data partition; in my case /mnt/389ds/log/
  6. create a symbolic link from /var/log/dirsrv/ to /mnt/389ds/log/
  7. start the server: service dirsrv start

I have installed multiple production servers this way and they are all running well!

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.