Ruducing the the size of and de-fragmenting the eDirectory's database

  • 7023899
  • 24-May-2019
  • 24-May-2019

Environment

eDirectory 8.8 SP8
eDirectory 9

Situation

Over time as entries are created and deleted 'empty' space not re-used by new entries is still in use by the database on the hard disk.  Therefore, to minimize the disk space in use by eDirectory the desire is to remote this 'slack'. 

Resolution

There are three ways to reduce the size of an eDirectory dib.

1. Perform a reclaim disk space operation using ndsrepair.  The command would be:
ndsrepair -R -f yes
Reclaim consolidates completely free blocks in a file. It does not free as much space as a rebuild but it is also quicker since it does not actually rebuild the database.  Running ndsrepair -I will report a rough estimate of how much space will be saved.

2. Perform a rebuild of the database using ndsrepair.  The command would be:
ndsrepair -R -i no -d yes -t no -r no -v no
A rebuild will also take care of any fragmentation within a single block as well.

3. Since Option 3 take considerable time on very large databases it may make more sense to delete the server and add it back via dibclone due to time constraints.



Below are some examples of the savings from these operations:

Original dib:
-rw------- 1 root root 991232 May 24 17:01 nds.01
-rw------- 1 root root 987136 May 24 17:01 nds.db

After a reclaim disk space
ndsrepair -R -f yes
-rw------- 1 root root 909312 May 24 17:04 nds.01
-rw------- 1 root root  24576 May 24 17:04 nds.db

After a rebuild
ndsrepair -R -l yes -i no -t no -r no -v no
-rw------- 1 root root 819200 May 24 17:07 nds.01
-rw------- 1 root root  49152 May 24 17:07 nds.db

Obviously, this was a small dib and slack was created by only the addition and deletion of 100 users so one's mileage as a percentage of reduction could be considerably better.