This article covers what to do when encountering the error "Could not create and pre grow file in dir".
The following error is thrown when creating a table or other object in GemFire that uses a disk store:
ERROR X0Z33: SQLSTATE=X0Z33,SEVERITY=-1: (Server=test.pivotal.com[1531],Thread[DRDAConnThread_32,5,gemfirexd.daemons]) For DiskStore 'PROD_SENDER_DISKSTORE': Could not create and pre grow file in dir dir=/app/pivotal/gemfirexd/diskstores maxSpace=1073741824 usedSpace=0 availableSpace=1073741824 with size=1,073,741,824 Caused by: SqlException: SQLSTATE=X0Z33,SEVERITY=-1: (Server=test.pivotal.com[1531],Thread[DRDAConnThread_32,5,gemfirexd.daemons]) For DiskStore 'PROD_SENDER_DISKSTORE': Could not create and pre grow file in dir dir=/app/pivotal/gemfirexd/diskstores maxSpace=1073741824 usedSpace=0 availableSpace=1073741824 with size=1,073,741,824 at com.pivotal.gemfirexd.internal.client.am.Statement.completeSqlca(Statement.java:2038)
Note: This is after creating the disk store succesfully.
The root cause is related to the sizes configurED for the oplog size and the directory itself.
GemFire XD tries to allocate the configured size from scratch when initializing disk stores.
As a result, configuring both MAXLOGSIZE and max directory size to the same value this error will be thrown as GemFire XD needs the space required by logging and other misc activity which is aprox. 20MB. These misc files includes disk store metadata (.if) and store access control (.lk) for example.
So to conclude the solution is to increase the max disk size by at least 20MB in comparison to the MAXLOGSIZE as follows:
CREATE DISKSTORE "GFXD-DEFAULT-PRST-DISKSTORE" MAXLOGSIZE 1024 AUTOCOMPACT TRUE ALLOWFORCECOMPACTION TRUE COMPACTIONTHRESHOLD 50 TIMEINTERVAL 1000 WRITEBUFFERSIZE 32768 QUEUESIZE 0 ('/path/to/diskstore' 1048);