File changes in maintenance mode

I am hosting my own NextCloud 22.2.0 instance deployed via docker, and I implemented a very simple backup strategy consisting of:

  • putting the instance in maintenance mode;
  • creating a tarball with the content of the whole NextCloud directory (i.e. /var/www/html);
  • putting the instance back to normal mode;
  • transferring the tarball to the backup server.

Sometimes it happens that creating the tarball fails with message:

tar: ./data/nextcloud.log: file changed as we read it

It sounds quite strange to me since as far as I understand during maintenance mode no file is modified. But I am absolutely not sure, so I’d need some guidance in order to understand what happens.

Thanks in advance for any help

did you look at the log file what was logged during backup? may be attempts to access nextcloud even in maintenance mode are logged.

(tar is not a good backup tool. there are smarter tools now available. :wink: )

From the log there is an entry at 13:00:04 after entering in maintenance mode at 13:00:00 which seems a reply to a webdav client trying to connect:

{"reqId":"UbIRg8BPASr4D31PPB1T","level":4,"time":"2021-12-06T13:00:04+00:00","remoteAddr":"193.205.222.19","user":"iamherd-68889582-1693-4ced-855a-c11dd6331d96","app":"webdav","method":"PROPFIND","url":"/remote.php/dav/files/iamherd-68889582-1693-4ced-855a-c11dd6331d96/","message":"Il sistema \u00e8 in modalit\u00e0 di manutenzione.","userAgent":"Mozilla/5.0 (Macintosh) mirall/3.4.0git (build 8401) (Nextcloud, osx-19.6.0 ClientArchitecture: x86_64 OsArchitecture: x86_64)","version":"22.2.0.2","exception":{"Exception":"Sabre\\DAV\\Exception\\ServiceUnavailable","Message":"Il sistema \u00e8 in modalit\u00e0 di manutenzione.","Code":0,"Trace":[{"file":"/var/www/html/3rdparty/sabre/event/lib/WildcardEmitterTrait.php","line":89,"function":"checkMaintenanceMode","class":"OCA\\DAV\\Connector\\Sabre\\MaintenancePlugin","type":"->","args":[{"__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php","line":456,"function":"emit","class":"Sabre\\DAV\\Server","type":"->","args":["beforeMethod:PROPFIND",[{"__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php","line":253,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->","args":[{"__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php","line":321,"function":"start","class":"Sabre\\DAV\\Server","type":"->","args":[]},{"file":"/var/www/html/apps/dav/lib/Server.php","line":333,"function":"exec","class":"Sabre\\DAV\\Server","type":"->","args":[]},{"file":"/var/www/html/apps/dav/appinfo/v2/remote.php","line":35,"function":"exec","class":"OCA\\DAV\\Server","type":"->","args":[]},{"file":"/var/www/html/remote.php","line":166,"args":["/var/www/html/apps/dav/appinfo/v2/remote.php"],"function":"require_once"}],"File":"/var/www/html/apps/dav/lib/Connector/Sabre/MaintenancePlugin.php","Line":85,"CustomMessage":"--"}}

So maybe this is the problem. I guess I can easily exclude the log from the backup, I was just fearing that this file change in the middle could happen also for other files.
Thanks for the suggestion!