# Files become zero bytes

**URL:** <https://help.nextcloud.com/t/files-become-zero-bytes/7214>\
**Category:** 💻 Desktop\
**Tags:** github\_issue\_exists\
**Created:** [January 6, 2017, 10:09pm UTC](https://help.nextcloud.com/t/files-become-zero-bytes/7214 "2017-01-06T22:09:16Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![feisar](https://help.nextcloud.com/letter_avatar/feisar/32/6_449c533f586939b6e5f246632a46421f.png) [@feisar](https://help.nextcloud.com/u/feisar)\
**Post date:** [January 6, 2017, 10:09pm UTC](https://help.nextcloud.com/t/files-become-zero-bytes/7214/1 "2017-01-06T22:09:16Z")

</div>

Hi,

I recently upgraded from ownCloud 9 to Nextcloud 9 which seemed to go ok but today I noticed that a file I frequently access had become zero bytes in size and I had to restore from a backup 4 days ago (well after the upgrade).

I’m using Linux Mint (ubuntu 14.04) with the Linux ownCloud desktop client from the Suse repos.

This has worried me a little and shaken my confidence in the syncing. I was wondering if this is a known issue and if anyone knows what can cause it to occur.

I’ve run a command to see if there are any other zero byte files in my documents and I’ve found five now - some of which I don’t have backups of far enough back.

Thanks,

---

<div class="post-metadata">

**Author:** ![tflidd](https://help.nextcloud.com/letter_avatar/tflidd/32/6_449c533f586939b6e5f246632a46421f.png) [@tflidd](https://help.nextcloud.com/u/tflidd)\
**Post date:** [January 6, 2017, 11:21pm UTC](https://help.nextcloud.com/t/files-become-zero-bytes/7214/2 "2017-01-06T23:21:11Z")

</div>

That sounds a bit scary. If you still have the webserver logfiles, you can perhaps find out when and who actually made these changes. Do you use the versions-app, there might be the old version you could try to recover that.

Do you use the encryption app?

---

<div class="post-metadata">

**Author:** ![feisar](https://help.nextcloud.com/letter_avatar/feisar/32/6_449c533f586939b6e5f246632a46421f.png) [@feisar](https://help.nextcloud.com/u/feisar)\
**Post date:** [January 7, 2017, 11:14am UTC](https://help.nextcloud.com/t/files-become-zero-bytes/7214/3 "2017-01-07T11:14:59Z")

</div>

No encryption app (I encrypt the block device that NC uses) and no version-app at present. I do have the web logs though…

The last good backup of the file in question was on the evening of the Jan 1st, by the evening of the 2nd it was zero bytes.

So entries from web logs from the 1st and 2nd of Jan should cover it, I have the following:

(49 is my desktop, 34 is my laptop)

192.168.0.34 - me [02/Jan/2017:10:18:02 +0000] “GET /remote.php/webdav/Documents/Passwords/passwords.kdb HTTP/1.1” 200 123515 “-” "Mozilla/5.0 (Linux) mirall/2.2.4"  
192.168.0.34 - me [02/Jan/2017:10:24:07 +0000] “PUT /remote.php/webdav/Documents/Passwords/passwords.kdb HTTP/1.1” 204 1117 “-” "Mozilla/5.0 (Linux) mirall/2.2.4"  
192.168.0.49 - me [02/Jan/2017:10:24:24 +0000] “GET /remote.php/webdav/Documents/Passwords/passwords.kdb HTTP/1.1” 200 4734 “-” “Mozilla/5.0 (Linux) mirall/2.2.4”

I’ll put a script together which runs the following command each day and alerts me if there are any more 0 byte files:

find $dataDir/ -size 0

The only other thing worth mentioning is that I reinstalled the ownCloud client on the 2nd Jan between 10 and 11 am. I think I flipped between a couple of the Suse repos because I wasn’t sure which one to use. Settled on the following:

deb [http://download.opensuse.org/repositories/isv:/ownCloud:/desktop/Ubuntu\_14.04/](http://download.opensuse.org/repositories/isv:/ownCloud:/desktop/Ubuntu_14.04/) /

but did briefly use one that also had qt5 or something in the url

---

<div class="post-metadata">

**Author:** ![tflidd](https://help.nextcloud.com/letter_avatar/tflidd/32/6_449c533f586939b6e5f246632a46421f.png) [@tflidd](https://help.nextcloud.com/u/tflidd)\
**Post date:** [January 7, 2017, 1:47pm UTC](https://help.nextcloud.com/t/files-become-zero-bytes/7214/4 "2017-01-07T13:47:48Z")

</div>

What other files types were concerned by this problem? I suppose the passwords is some sort of container. I had some problems with TrueCrypt containers where I needed to enable that if it updates the changing date of a file if there have been changes.

---

<div class="post-metadata">

**Author:** ![feisar](https://help.nextcloud.com/letter_avatar/feisar/32/6_449c533f586939b6e5f246632a46421f.png) [@feisar](https://help.nextcloud.com/u/feisar)\
**Post date:** [January 7, 2017, 2:14pm UTC](https://help.nextcloud.com/t/files-become-zero-bytes/7214/5 "2017-01-07T14:14:52Z")

</div>

So far I have had it happen to a .txt, .rtf, .odp, .jpg and .kdb but I’m not sure when all happened.

---

<div class="post-metadata">

**Author:** ![tflidd](https://help.nextcloud.com/letter_avatar/tflidd/32/6_449c533f586939b6e5f246632a46421f.png) [@tflidd](https://help.nextcloud.com/u/tflidd)\
**Post date:** [January 7, 2017, 8:16pm UTC](https://help.nextcloud.com/t/files-become-zero-bytes/7214/6 "2017-01-07T20:16:33Z")

</div>

For your .kdb file the client on your laptop wrote a new file. Logging is not enabled by default on the clients, you can however start it with logging. Did you change the files which were set to 0? Or copy their folders?

---

<div class="post-metadata">

**Author:** ![Sanook](https://help.nextcloud.com/user_avatar/help.nextcloud.com/sanook/32/13847_2.png) [@Sanook](https://help.nextcloud.com/u/Sanook)\
**Post date:** [January 11, 2017, 10:06am UTC](https://help.nextcloud.com/t/files-become-zero-bytes/7214/7 "2017-01-11T10:06:12Z")

</div>

> [@feisar](#):
>
> So far I have had it happen to a .txt, .rtf, .odp, .jpg and .kdb but I’m not sure when all happened.

**I’m shocked!**

`find $nextcloud_data_dir -size 0 -type f`

&nbsp;  
I my case it happened on a couple of pdf files an one txt file.

I don’t know why they have a file size of 0 bytes now and when it happened!

☹

---

<div class="post-metadata">

**Author:** ![MichaIng](https://help.nextcloud.com/user_avatar/help.nextcloud.com/michaing/32/2125_2.png) [@MichaIng](https://help.nextcloud.com/u/MichaIng)\
**Post date:** [January 11, 2017, 12:39pm UTC](https://help.nextcloud.com/t/files-become-zero-bytes/7214/8 "2017-01-11T12:39:11Z")

</div>

I also had that for 3 mp3 files some time ago. Versions were not available for them, so this seemed to be not tracked correctly as change. As I realised it some time later I could not find related log messages. I regularly watch out for 0 byte files now, but didn’t found one since that.

---

<div class="post-metadata">

**Author:** ![tflidd](https://help.nextcloud.com/letter_avatar/tflidd/32/6_449c533f586939b6e5f246632a46421f.png) [@tflidd](https://help.nextcloud.com/u/tflidd)\
**Post date:** [January 11, 2017, 12:53pm UTC](https://help.nextcloud.com/t/files-become-zero-bytes/7214/9 "2017-01-11T12:53:33Z")

</div>

Then please open a bug report on [https://github.com/nextcloud/server/issues](https://github.com/nextcloud/server/issues) and fill out the template.

---

<div class="post-metadata">

**Author:** ![MikeLupe](https://help.nextcloud.com/letter_avatar/mikelupe/32/6_449c533f586939b6e5f246632a46421f.png) [@MikeLupe](https://help.nextcloud.com/u/MikeLupe)\
**Post date:** [January 11, 2017, 1:08pm UTC](https://help.nextcloud.com/t/files-become-zero-bytes/7214/10 "2017-01-11T13:08:58Z")

</div>

I had this on NC11 (running since sevrl. weeks) yesterday, for a first and only time when I tried to open a file with Collabora. Collabora got stuck and file went to 0. No idea if this was a Collabora thing or some other issue.

- Debian 8.x / MariaDB 10.x / Apache 2.4.x) / PHP 5.6
- Files not encrypted

As it happend only once, I restored the file and didn’t bother anymore about it. Unfortunately I can’t remember what office format the file was.

I’ll watch if this happens again and will try to document it.

---

<div class="post-metadata">

**Author:** ![Sanook](https://help.nextcloud.com/user_avatar/help.nextcloud.com/sanook/32/13847_2.png) [@Sanook](https://help.nextcloud.com/u/Sanook)\
**Post date:** [January 11, 2017, 1:50pm UTC](https://help.nextcloud.com/t/files-become-zero-bytes/7214/11 "2017-01-11T13:50:41Z")

</div>

> [@tflidd](#):
>
> Then please open a bug report on [https://github.com/nextcloud/server/issue](https://github.com/nextcloud/server/issue) and fill out the template.

 ![](https://help.nextcloud.com/uploads/default/original/2X/0/0ced56bc41fa0614ee9992d4519e366e083d904e.png)

---

<div class="post-metadata">

**Author:** ![MikeLupe](https://help.nextcloud.com/letter_avatar/mikelupe/32/6_449c533f586939b6e5f246632a46421f.png) [@MikeLupe](https://help.nextcloud.com/u/MikeLupe)\
**Post date:** [January 11, 2017, 2:02pm UTC](https://help.nextcloud.com/t/files-become-zero-bytes/7214/12 "2017-01-11T14:02:13Z")

</div>

@Sanook:  
+s

---

<div class="post-metadata">

**Author:** ![Sergey\_Konyukhov](https://help.nextcloud.com/user_avatar/help.nextcloud.com/sergey_konyukhov/32/31354_2.png) [@Sergey\_Konyukhov](https://help.nextcloud.com/u/Sergey_Konyukhov)\
**Post date:** [January 12, 2017, 6:00pm UTC](https://help.nextcloud.com/t/files-become-zero-bytes/7214/13 "2017-01-12T18:00:40Z")

</div>

Same problem with me.

> [@](#):
>
> root@ri48:/home/livello# find /var/www/html/nextcloud/data/ -size 0 -type f | wc -l  
> 91

I found this problem several days ago.

I use little workaround backup nextcloud data folder with command:  
rsync -ah --progress --min-size=1 --update /var/www/html/nextcloud/data .

---

<div class="post-metadata">

**Author:** ![MikeLupe](https://help.nextcloud.com/letter_avatar/mikelupe/32/6_449c533f586939b6e5f246632a46421f.png) [@MikeLupe](https://help.nextcloud.com/u/MikeLupe)\
**Post date:** [January 12, 2017, 11:20pm UTC](https://help.nextcloud.com/t/files-become-zero-bytes/7214/14 "2017-01-12T23:20:07Z")

</div>

I created an issue on github for that one. In a bit diletantic way, as I’m way too tired after 14h of work - but at least it’s in there.

---

<div class="post-metadata">

**Author:** ![tflidd](https://help.nextcloud.com/letter_avatar/tflidd/32/6_449c533f586939b6e5f246632a46421f.png) [@tflidd](https://help.nextcloud.com/u/tflidd)\
**Post date:** [January 13, 2017, 7:43am UTC](https://help.nextcloud.com/t/files-become-zero-bytes/7214/15 "2017-01-13T07:43:43Z")

</div>

> [@MikeLupe](#):
>
> I created an issue on github for that one. In a bit diletantic way, as I’m way too tired after 14h of work - but at least it’s in there.

thanks. ref: [Files getting set to 0 in data folder · Issue #3056 · nextcloud/server · GitHub](https://github.com/nextcloud/server/issues/3056)

---

<div class="post-metadata">

**Author:** ![Sanook](https://help.nextcloud.com/user_avatar/help.nextcloud.com/sanook/32/13847_2.png) [@Sanook](https://help.nextcloud.com/u/Sanook)\
**Post date:** [January 13, 2017, 11:28pm UTC](https://help.nextcloud.com/t/files-become-zero-bytes/7214/16 "2017-01-13T23:28:34Z")

</div>

Owncloud users also reporting the “zero file size bug”:

> **[Problem: many files with 0 bytes](https://central.owncloud.org/t/problem-many-files-with-0-bytes/4256)**
>
> Hello! We are using Community Edition, release 9.1.1. We are observed a big problem: many users have 0 bytes files in the server repository when the source files (in the client) are good size files. We are thinking about that would be a...

---

<div class="post-metadata">

**Author:** ![feisar](https://help.nextcloud.com/letter_avatar/feisar/32/6_449c533f586939b6e5f246632a46421f.png) [@feisar](https://help.nextcloud.com/u/feisar)\
**Post date:** [January 17, 2017, 10:17pm UTC](https://help.nextcloud.com/t/files-become-zero-bytes/7214/17 "2017-01-17T22:17:20Z")

</div>

Running Rsnapshot on the Nextcloud data directory is a good idea, peace of mind that you can revert any file back to a previous state.

I also, now, run this script every night, if any zero byte file exist in an array of given filesystems it emails a list of them out.

```
#!/bin/bash

filesystems[0]="/mnt/local/nextcloud/data/user1/files"
filesystems[1]="/mnt/local/nextcloud/data/user2/files"

emAdy="email@example.com"
emSub="Warning: Nextcloud Contains 0 Byte Files"

for fs in "${filesystems[@]}"; do

        while read -d '' -r; do
    		arr+=( "$REPLY" )
		done < <(find $fs -size 0 -print0)

done

if [[! -z ${arr[@]} ]]; then

	echo ${arr[@]} | mail -s "$emSub" "$emAdy"

fi
```

---

<div class="post-metadata">

**Author:** ![tflidd](https://help.nextcloud.com/letter_avatar/tflidd/32/6_449c533f586939b6e5f246632a46421f.png) [@tflidd](https://help.nextcloud.com/u/tflidd)\
**Post date:** [January 28, 2017, 11:34am UTC](https://help.nextcloud.com/t/files-become-zero-bytes/7214/18 "2017-01-28T11:34:30Z")

</div>

There is a small fix of code that helps to debug this problem:

> <https://github.com/nextcloud/server/issues/3056#issuecomment-274770918>

Stay tuned on the github issue!

---

<div class="post-metadata">

**Author:** ![Sanook](https://help.nextcloud.com/user_avatar/help.nextcloud.com/sanook/32/13847_2.png) [@Sanook](https://help.nextcloud.com/u/Sanook)\
**Post date:** [May 9, 2018, 5:27am UTC](https://help.nextcloud.com/t/files-become-zero-bytes/7214/19 "2018-05-09T05:27:02Z")

</div>

> [@tflidd](#):
>
> Stay tuned on the github issue!

I have installed a fresh version of NC 13 but the problem still persists.

Thanks to the script of @feisar i could find it out.

☹

**So this is a warning to all Nextcloud users: don’t trust the desktop client!**

Edit:

Today i had it again! One file of 65 GB of data had 0 bytes filesize after syncing it with the desktop client.

For those who want to verify that issue:

- Install a Nextcloud instance on localhost in a virtual machine
- Sync a huge amount of data **in one run** with the desktop sync client, lets say 100 GB
- after it run the script of @feisar
- if no errors then 100 GB upload is not enough
- delete everything and retry with more data then 100 GB
- if the srcript found zero byte files, open web browser, locate the file and watch the file size: does not display zero bytes (!) but can’t be opened of course. This could cause preview-plugin or fulltextsearch-plugin to run forever

**With that error, Nextcloud can’t be recommended for business, sorry guys.** @tflidd  
Only for private use to sync and share small amount of data with your peers.

---

<div class="post-metadata">

**Author:** ![JasonBayton](https://help.nextcloud.com/user_avatar/help.nextcloud.com/jasonbayton/32/297_2.png) [@JasonBayton](https://help.nextcloud.com/u/JasonBayton)\
**Post date:** [May 11, 2018, 8:03pm UTC](https://help.nextcloud.com/t/files-become-zero-bytes/7214/20 "2018-05-11T20:03:35Z")

</div>

> [@Sanook](#):
>
> With that error, Nextcloud can’t be recommended for business, sorry guys. @tflidd

The Nextcloud desktop client, right? Because I haven’t seen this affect my array and I don’t use the client.

[Next page](https://help.nextcloud.com/t/files-become-zero-bytes/7214.md?page=2)
