Question: I'm running an openLDAP server version 2.4.40 on CentOS 7. LDAP is going to be configured using online conf option (olc). Thanks to this [question](https://stackoverflow.com/questions/17669586/where-is-my-data-directories-store-by-slapd-openldap-on-ubuntu), I know that slapd's database files are in `/var/lib/ldap`. 

I'm trying to run an openLDAP server on a linux box as read-only OS partition and another partition for persistent data. I will be able to install and configure openLDAP on the OS partition, but will lose access to it after configuring it. 

**Question:** Is it possible to change the location LDAP reads/writes data from */var/lib/ldap* to somewhere on the persistent data partition?

Answer: 
I read your question in two parts:

1. You want to have the OS be read-only while preserving write access to the LDAP data
2. As a solution for #1, you propose storing the LDAP data in a location other than `/var/lib/ldap`

While I suspect #2 is possible, I don't have enough direct experience with OpenLDAP to address that directly. What I can do is suggest an alternative solution for #1. It's trivial to mount a difference disk partion at `/var/lib/ldap`, both through the `mount` command and through `fstab`. This should effectively accomplish your goal, whether or not OpenLDAP handles this natively. You might also be able to replace the `/var/lib/ldap` folder with a symlink to the desired location. Again, this bypasses OpenLDAP and any support that is or is not built into that project.

Finally, you should also think about preserving write access for certain log areas. The techniques in the paragraph above can work for moving log file locations, too.
Openldap does not appear to support moving a database, DB, file after it has been created. Openldap does not currently support deleting DB files either. 

It is possible to create a new DB file and define its olcDbDirectory attribute to a path on another partition.

```
dn: olcDatabase=bdb,cn=config
objectClass: olcBdbConfig
olcDatabase: bdb
olcDbDirectory: /partition/db/new-db-file
olcSuffix: dc=example,dc=net

```

Information found in ch 6.1.1.4.5 [Add/Delete Databases using OLC](http://www.zytrax.com/books/ldap/ch6/slapd-config.html#use-databases)