title: Why does sqlite3 not work on Amazon Elastic File System?
body: <p>When I try to create a base with <code>sqlite3</code> on a EFS directory, this results in an error:</p>
  
  <p><code>$ sqlite3 foo.db
  SQLite version 3.7.17 2013-05-20 00:56:22
  Enter ".help" for instructions
  Enter SQL statements terminated with a ";"
  sqlite&gt; .log stderr
  sqlite&gt; CREATE TABLE foo (int bar);
  Error: disk I/O error
  </code></p>
  
  <p>The Sqlite3 database in question is supposed to story meta data only and will be updated infrequently. Concurrent access is not required. However, it is required that if the process creating the Database dies, the process can be restarted on a different host and carry on where the previous instance quit.</p>
  
  <p>Amazon claims that <a href="https://aws.amazon.com/efs/faq/" rel="nofollow noreferrer">EFS</a> is a "file system that [is] accessible to Amazon EC2 instances via a file system interface (using standard operating system file I/O APIs) and that support full file system access semantics (such as strong consistency and file locking)." Thus, I'm assuming it is fit for the task at hand. </p>
  
  <p>The mount options in <code>/etc/fstab</code> are:</p>
  
  <blockquote>
    <p>eu-west-1a.fs-ID.efs.eu-west-1.amazonaws.com:/ /efs nfs4 nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2 0 0</p>
  </blockquote>
  
  <p>I understand that <a href="https://stackoverflow.com/questions/9907429/locking-sqlite-file-on-nfs-filesystem-possible">it is often generally discouraged to put databases on NFS</a>. However, I believe, given the language used by both Amazon and SQLite, developers will keep trying.</p>