title: OrientDB: getting OLowDiskSpaceException when trying to restore a database backup
body: <p>I backed up my database and I'm now upgrading to v2.1.16.
  I've tested my backup and restore routine on a local Vagrant virtual server and everything went fine.</p>
  
  <p>I'm now trying to run the same procedure on my Amazon AWS server, and the process fails due to a OLowDiskSpaceException.</p>
  
  <p>Here is the message I'm getting:</p>
  
  <pre><code>Started import of database 'remote:localhost/mydatabase' from /home/ubuntu/orientdb_
  update_16.04.27.11.10.+0000.gz...
  Non merge mode (-merge=false): removing all default non security classesError on
   database import happened just before line 0, column 1
  com.orientechnologies.orient.core.exception.OLowDiskSpaceException: Error occurr
  ed while executing a write operation to database 'mydatabase' due to limited free sp
  ace on the disk (-26 MB). The database is now working in read-only mode. Please
  close the database (or stop OrientDB), make room on your hard drive and then reo
  pen the database. The minimal required space is 100 MB. Required space is now se
  t to 100MB (you can change it by setting parameter storage.diskCache.diskFreeSpa
  ceLimit) .
          at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginat
  edStorage.checkLowDiskSpaceAndFullCheckpointRequests(OAbstractPaginatedStorage.j
  ava:2890)
          at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginat
  edStorage.updateRecord(OAbstractPaginatedStorage.java:943)
          at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.exe
  cuteSaveRecord(ODatabaseDocumentTx.java:2005)
          at com.orientechnologies.orient.core.tx.OTransactionNoTx.saveRecord(OTra
  nsactionNoTx.java:159)
          at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.sav
  e(ODatabaseDocumentTx.java:2568)
          at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.sav
  e(ODatabaseDocumentTx.java:121)
          at com.orientechnologies.orient.core.record.impl.ODocument.save(ODocumen
  t.java:1768)
          at com.orientechnologies.orient.core.record.impl.ODocument.save(ODocumen
  t.java:1764)
          at com.orientechnologies.orient.core.metadata.schema.OSchemaShared$1.cal
  l(OSchemaShared.java:1213)
          at com.orientechnologies.orient.core.db.OScenarioThreadLocal.executeAsDi
  stributed(OScenarioThreadLocal.java:71)
          at com.orientechnologies.orient.core.metadata.schema.OSchemaShared.saveI
  nternal(OSchemaShared.java:1208)
          at com.orientechnologies.orient.core.metadata.schema.OSchemaShared.relea
  seSchemaWriteLock(OSchemaShared.java:642)
          at com.orientechnologies.orient.core.metadata.schema.OSchemaShared.relea
  seSchemaWriteLock(OSchemaShared.java:631)
          at com.orientechnologies.orient.core.metadata.schema.OSchemaShared.dropC
  lass(OSchemaShared.java:557)
          at com.orientechnologies.orient.core.metadata.schema.OSchemaProxy.dropCl
  ass(OSchemaProxy.java:156)
          at com.orientechnologies.orient.core.sql.OCommandExecutorSQLDropClass.ex
  ecute(OCommandExecutorSQLDropClass.java:122)
          at com.orientechnologies.orient.core.sql.OCommandExecutorSQLDelegate.exe
  cute(OCommandExecutorSQLDelegate.java:90)
          at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginat
  edStorage.executeCommand(OAbstractPaginatedStorage.java:1547)
          at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginat
  edStorage.command(OAbstractPaginatedStorage.java:1528)
          at com.orientechnologies.orient.core.command.OCommandRequestTextAbstract
  .execute(OCommandRequestTextAbstract.java:67)
          at com.orientechnologies.orient.server.network.protocol.binary.ONetworkP
  rotocolBinary.command(ONetworkProtocolBinary.java:1323)
          at com.orientechnologies.orient.server.network.protocol.binary.ONetworkP
  rotocolBinary.executeRequest(ONetworkProtocolBinary.java:400)
          at com.orientechnologies.orient.server.network.protocol.binary.OBinaryNe
  tworkProtocolAbstract.execute(OBinaryNetworkProtocolAbstract.java:223)
          at com.orientechnologies.common.thread.OSoftThread.run(OSoftThread.java:
  77)
  
  Error: com.orientechnologies.orient.core.db.tool.ODatabaseExportException: Error
   on importing database 'mydatabase' from file: /home/ubuntu/orientdb_update_16.04.27
  .11.10.+0000.gz
  
  Error: com.orientechnologies.orient.core.exception.OLowDiskSpaceException: Error
   occurred while executing a write operation to database 'mydatabase' due to limited
  free space on the disk (-26 MB). The database is now working in read-only mode.
  Please close the database (or stop OrientDB), make room on your hard drive and t
  hen reopen the database. The minimal required space is 100 MB. Required space is
   now set to 100MB (you can change it by setting parameter storage.diskCache.disk
  FreeSpaceLimit) .
  </code></pre>
  
  <p>The weird thing is I have plenty of free space available. Running 'df -h' returns:</p>
  
  <pre><code>Filesystem      Size  Used Avail Use% Mounted on
  udev            492M   12K  492M   1% /dev
  tmpfs           100M  336K   99M   1% /run
  /dev/xvda1      7.8G  2.2G  5.2G  30% /
  none            4.0K     0  4.0K   0% /sys/fs/cgroup
  none            5.0M     0  5.0M   0% /run/lock
  none            497M     0  497M   0% /run/shm
  none            100M     0  100M   0% /run/user
  </code></pre>
  
  <p>Why is OrientDB convinced I have less than 100MB of free space, when in fact I have over 5GB?</p>
  
  <p>EDIT: here is my configuration</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;
  &lt;orient-server&gt;
      &lt;handlers&gt;
          &lt;handler class="com.orientechnologies.orient.graph.handler.OGraphServerHandler"&gt;
              &lt;parameters&gt;
                  &lt;parameter value="true" name="enabled"/&gt;
                  &lt;parameter value="50" name="graph.pool.max"/&gt;
              &lt;/parameters&gt;
          &lt;/handler&gt;
          &lt;handler class="com.orientechnologies.orient.server.hazelcast.OHazelcastPlugin"&gt;
              &lt;parameters&gt;
                  &lt;parameter value="${DISTRIBUTED}" name="enabled"/&gt;
                  &lt;parameter value="${ORIENTDB_HOME}/config/distributed-db-config.json" name="configuration.db.default"/&gt;
                  &lt;parameter value="${ORIENTDB_HOME}/config/hazelcast.xml" name="configuration.hazelcast"/&gt;
              &lt;/parameters&gt;
          &lt;/handler&gt;
          &lt;handler class="com.orientechnologies.orient.server.handler.OJMXPlugin"&gt;
              &lt;parameters&gt;
                  &lt;parameter value="false" name="enabled"/&gt;
                  &lt;parameter value="true" name="profilerManaged"/&gt;
              &lt;/parameters&gt;
          &lt;/handler&gt;
          &lt;handler class="com.orientechnologies.orient.server.handler.OAutomaticBackup"&gt;
              &lt;parameters&gt;
                  &lt;parameter value="false" name="enabled"/&gt;
                  &lt;parameter value="4h" name="delay"/&gt;
                  &lt;parameter value="backup" name="target.directory"/&gt;
                  &lt;parameter value="${DBNAME}-${DATE:yyyyMMddHHmmss}.zip" name="target.fileName"/&gt;
                  &lt;parameter value="9" name="compressionLevel"/&gt;
                  &lt;parameter value="1048576" name="bufferSize"/&gt;
                  &lt;parameter value="" name="db.include"/&gt;
                  &lt;parameter value="" name="db.exclude"/&gt;
              &lt;/parameters&gt;
          &lt;/handler&gt;
          &lt;handler class="com.orientechnologies.orient.server.handler.OServerSideScriptInterpreter"&gt;
              &lt;parameters&gt;
                  &lt;parameter value="true" name="enabled"/&gt;
                  &lt;parameter value="SQL" name="allowedLanguages"/&gt;
              &lt;/parameters&gt;
          &lt;/handler&gt;
          &lt;handler class="com.orientechnologies.orient.server.token.OrientTokenHandler"&gt;
              &lt;parameters&gt;
                  &lt;parameter value="false" name="enabled"/&gt;
                  &lt;parameter value="" name="oAuth2Key"/&gt;
                  &lt;parameter value="60" name="sessionLength"/&gt;
                  &lt;parameter value="HmacSHA256" name="encryptionAlgorithm"/&gt;
              &lt;/parameters&gt;
          &lt;/handler&gt;
          &lt;handler class="com.orientechnologies.orient.server.plugin.livequery.OLiveQueryPlugin"&gt;
              &lt;parameters&gt;
                  &lt;parameter value="false" name="enabled"/&gt;
              &lt;/parameters&gt;
          &lt;/handler&gt;
      &lt;/handlers&gt;
      &lt;network&gt;
          &lt;sockets&gt;
              &lt;socket implementation="com.orientechnologies.orient.server.network.OServerSSLSocketFactory" name="ssl"&gt;
                  &lt;parameters&gt;
                      &lt;parameter value="false" name="network.ssl.clientAuth"/&gt;
                      &lt;parameter value="config/cert/orientdb.ks" name="network.ssl.keyStore"/&gt;
                      &lt;parameter value="password" name="network.ssl.keyStorePassword"/&gt;
                      &lt;parameter value="config/cert/orientdb.ks" name="network.ssl.trustStore"/&gt;
                      &lt;parameter value="password" name="network.ssl.trustStorePassword"/&gt;
                  &lt;/parameters&gt;
              &lt;/socket&gt;
              &lt;socket implementation="com.orientechnologies.orient.server.network.OServerSSLSocketFactory" name="https"&gt;
                  &lt;parameters&gt;
                      &lt;parameter value="false" name="network.ssl.clientAuth"/&gt;
                      &lt;parameter value="config/cert/orientdb.ks" name="network.ssl.keyStore"/&gt;
                      &lt;parameter value="password" name="network.ssl.keyStorePassword"/&gt;
                      &lt;parameter value="config/cert/orientdb.ks" name="network.ssl.trustStore"/&gt;
                      &lt;parameter value="password" name="network.ssl.trustStorePassword"/&gt;
                  &lt;/parameters&gt;
              &lt;/socket&gt;
          &lt;/sockets&gt;
          &lt;protocols&gt;
              &lt;protocol implementation="com.orientechnologies.orient.server.network.protocol.binary.ONetworkProtocolBinary" name="binary"/&gt;
              &lt;protocol implementation="com.orientechnologies.orient.server.network.protocol.http.ONetworkProtocolHttpDb" name="http"/&gt;
          &lt;/protocols&gt;
          &lt;listeners&gt;
              &lt;listener protocol="binary" socket="default" port-range="2424-2430" ip-address="0.0.0.0"/&gt;
              &lt;listener protocol="http" socket="default" port-range="2480-2490" ip-address="0.0.0.0"&gt;
                  &lt;commands&gt;
                      &lt;command implementation="com.orientechnologies.orient.server.network.protocol.http.command.get.OServerCommandGetStaticContent" pattern="GET|www GET|studio/ GET| GET|*.htm GET|*.html GET|*.xml GET|*.jpeg GET|*.jpg GET|*.png GET|*.gif GET|*.js GET|*.css GET|*.swf GET|*.ico GET|*.txt GET|*.otf GET|*.pjs GET|*.svg GET|*.json GET|*.woff GET|*.woff2 GET|*.ttf GET|*.svgz" stateful="false"&gt;
                          &lt;parameters&gt;
                              &lt;entry value="Cache-Control: no-cache, no-store, max-age=0, must-revalidate\r\nPragma: no-cache" name="http.cache:*.htm *.html"/&gt;
                              &lt;entry value="Cache-Control: max-age=120" name="http.cache:default"/&gt;
                          &lt;/parameters&gt;
                      &lt;/command&gt;
                      &lt;command implementation="com.orientechnologies.orient.graph.server.command.OServerCommandGetGephi" pattern="GET|gephi/*" stateful="false"/&gt;
                  &lt;/commands&gt;
                  &lt;parameters&gt;
                      &lt;parameter value="utf-8" name="network.http.charset"/&gt;
                      &lt;parameter value="true" name="network.http.jsonResponseError"/&gt;
                  &lt;/parameters&gt;
              &lt;/listener&gt;
          &lt;/listeners&gt;
      &lt;/network&gt;
      &lt;storages/&gt;
      &lt;users&gt;
          &lt;user resources="*" password="..." name="root"/&gt;
          &lt;user resources="connect,server.listDatabases,server.dblist" password="guest" name="guest"/&gt;
      &lt;/users&gt;
      &lt;properties&gt;
          &lt;entry value="1" name="db.pool.min"/&gt;
          &lt;entry value="50" name="db.pool.max"/&gt;
          &lt;entry value="true" name="profiler.enabled"/&gt;
          &lt;entry value="info" name="log.console.level"/&gt;
          &lt;entry value="fine" name="log.file.level"/&gt;
      &lt;/properties&gt;
  &lt;/orient-server&gt;
  </code></pre>