I'm backing up my whole server (including virtual machines) periodically with rsync. Now there is something wrong with my harddisk and some files are not readable, including a file of CouchDB (message is obfuscated):

cp: error reading '/var/lib/lxc/my-couch2/rootfs/home/foo/couchdb/couchdb/data/.shards/40000000-5fffffff/bar2.1533443496_design/mrview/54f171fe1f24ac4eb52ac24c85f9d8fc.view': Input/output error

According to the documentation:

To ensure reliability of backups, it is recommended that you back up secondary indexes (stored under data/.shards) prior to backing up the main database files (stored under data/shards as well as the system-level databases at the parent data/ directory). This is because CouchDB will automatically handle views/secondary indexes that are slightly out of date by updating them on the next read access, but views or secondary indexes that are newer than their associated databases will trigger a full rebuild of the index. This can be a very costly and time-consuming operation, and can impact your ability to recover quickly in a disaster situation.

So, AFAIK it's a temporary file. Is there a way to rebuild this file by using CouchDB itself, so that we can both fix the file on the server and are able to make a backup normally?


I asked the same question on apache/couchdb/issues. Regarding to the response, I backed up the erroneous file and triggered all views in the database bar2. That file is restored and everything seems to work correctly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.