# Input/Output Error Copying to CIFS mount - Disk Space Filled

**URL:** <https://forum.rclone.org/t/input-output-error-copying-to-cifs-mount-disk-space-filled/22163>\
**Category:** Help and Support\
**Created:** [February 8, 2021, 11:42pm UTC](https://forum.rclone.org/t/input-output-error-copying-to-cifs-mount-disk-space-filled/22163 "2021-02-08T23:42:17Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![RCloneUser1](https://forum.rclone.org/letter_avatar_proxy/v4/letter/r/f07891/32.png) [@RCloneUser1](https://forum.rclone.org/u/RCloneUser1)\
**Post date:** [February 8, 2021, 11:42pm UTC](https://forum.rclone.org/t/input-output-error-copying-to-cifs-mount-disk-space-filled/22163/1 "2021-02-08T23:42:17Z")

</div>

#### What is your rclone version (output from `rclone version`)

1.52.2

#### Which OS you are using and how many bits (eg Windows 7, 64 bit)

CentOS 7

#### The command you were trying to run (eg `rclone copy /tmp remote:tmp`)

Start Rclone using the following command

```auto
rcd --log-level DEBUG --rc-no-auth --rc-addr=127.0.0.1:5816 --log-file="REDACTED" --copy-links --local-no-set-modtime

```

After that, perform simple copy commands using RC: [https://rclone.org/rc/#operations-copyfile](https://rclone.org/rc/#operations-copyfile)

#### The rclone config contents with secrets removed.

None.

#### Description of Issue

When copying to a CIFS mounted drive, if the mounted drive runs out of disk space in _the middle of a copy_, the copy will error out (expected).  
However, after that, the destination file will not be able to be accessed through rclone or through the filesystem (cannot touch, rm, etc. the file). Attempting to access the file returns "no such file or directory". The only way to interact with the file is to remount the mounted drive.

Previously added a similar forum post found here: [Input/Output Error Copying to CIFS mount](https://forum.rclone.org/t/input-output-error-copying-to-cifs-mount/19605)  
Using the environment variable suggested by ncw (GODEBUG=asyncpreemptoff=1) fixed the occurrence of the original issue as far as we can tell (copied thousands of files since then).  
However, it appears that the environment variable does not resolve the issue when the mounted drive runs out of space.

Copy of relevant logs are below. The "close ... input/output error" occurs on the original error (drive filling up during the copy). The "no such file or directory" occurs when rclone attempts to access the logs again.

```auto
2021/02/07 10:49:06 NOTICE: Serving remote control on http://127.0.0.1:5815/
2021/02/07 10:49:08 NOTICE: Config file "/home/redacted/.config/rclone/rclone.conf" not found - using defaults
2021/02/07 10:49:38 NOTICE: __600-mb.tmp.txt: Removing partially written file on error: close /mnt/odin/layer-1/layer-2/TestFiles/__ 600-mb.tmp.txt: input/output error
2021/02/07 10:49:39 ERROR : 600-mb.txt: Failed to copy: close /mnt/odin/layer-1/layer-2/TestFiles/__600-mb.tmp.txt: input/output error
2021/02/07 10:50:13 ERROR : 600-mb.txt: Failed to copy: open /mnt/odin/layer-1/layer-2/TestFiles/__600-mb.tmp.txt: no such file or directory

```

---

<div class="post-metadata">

**Author:** ![ncw](https://forum.rclone.org/user_avatar/forum.rclone.org/ncw/32/18_2.png) [@ncw](https://forum.rclone.org/u/ncw)\
**Post date:** [February 9, 2021, 11:13am UTC](https://forum.rclone.org/t/input-output-error-copying-to-cifs-mount-disk-space-filled/22163/2 "2021-02-09T11:13:21Z")

</div>

> [@RCloneUser1](#):
>
> When copying to a CIFS mounted drive, if the mounted drive runs out of disk space in _the middle of a copy_, the copy will error out (expected).  
> However, after that, the destination file will not be able to be accessed through rclone or through the filesystem (cannot touch, rm, etc. the file). Attempting to access the file returns "no such file or directory". The only way to interact with the file is to remount the mounted drive.

This sounds like a CIFS bug to me. Nothing rclone can do should ever cause CIFS to lose track of its files like this.

Can you replicate the problem without rclone? Maybe with `cp`?

---

<div class="post-metadata">

**Author:** ![RCloneUser1](https://forum.rclone.org/letter_avatar_proxy/v4/letter/r/f07891/32.png) [@RCloneUser1](https://forum.rclone.org/u/RCloneUser1)\
**Post date:** [February 9, 2021, 5:04pm UTC](https://forum.rclone.org/t/input-output-error-copying-to-cifs-mount-disk-space-filled/22163/3 "2021-02-09T17:04:30Z")

</div>

We were unable to replicate the issue with "cp" command. The "cp" command does not complete (expected) but it does not end up with the "zombie" file.

We were able to replicate the issue using .Net File.Move command

---

<div class="post-metadata">

**Author:** ![RCloneUser1](https://forum.rclone.org/letter_avatar_proxy/v4/letter/r/f07891/32.png) [@RCloneUser1](https://forum.rclone.org/u/RCloneUser1)\
**Post date:** [February 9, 2021, 6:07pm UTC](https://forum.rclone.org/t/input-output-error-copying-to-cifs-mount-disk-space-filled/22163/4 "2021-02-09T18:07:14Z")

</div>

We are still investigating the issue on our end, currently looking into how the preallocate function fits into how disk full errors are being handled.

We noticed that the preallocate used to check for ENOSPC error but any handling was commented out: [https://github.com/rclone/rclone/blob/master/lib/file/preallocate\_unix.go#L47](https://github.com/rclone/rclone/blob/master/lib/file/preallocate_unix.go#L47)

---

<div class="post-metadata">

**Author:** ![ncw](https://forum.rclone.org/user_avatar/forum.rclone.org/ncw/32/18_2.png) [@ncw](https://forum.rclone.org/u/ncw)\
**Post date:** [February 10, 2021, 4:10pm UTC](https://forum.rclone.org/t/input-output-error-copying-to-cifs-mount-disk-space-filled/22163/5 "2021-02-10T16:10:43Z")

</div>

> [@RCloneUser1](#):
>
> We were unable to replicate the issue with "cp" command. The "cp" command does not complete (expected) but it does not end up with the "zombie" file.

OK

> [@RCloneUser1](#):
>
> We were able to replicate the issue using .Net File.Move command

Interesting...

> [@RCloneUser1](#):
>
> We are still investigating the issue on our end, currently looking into how the preallocate function fits into how disk full errors are being handled.
> 
> We noticed that the preallocate used to check for ENOSPC error but any handling was commented out: [rclone/lib/file/preallocate\_unix.go at master · rclone/rclone · GitHub](https://github.com/rclone/rclone/blob/master/lib/file/preallocate_unix.go#L47)

That code was never actually written, it was only an idea that rclone could be doing something different here.

I had a go at implementing it here - this will abort the transfer before copying anything if preallocate returns a disk full error. Let me know if it fixes your problem!

[v1.55.0-beta.5166.639abfb52.fix-preallocate-disk-full](https://beta.rclone.org/branch/fix-preallocate-disk-full/v1.55.0-beta.5166.639abfb52.fix-preallocate-disk-full/) on branch [fix-preallocate-disk-full](https://github.com/rclone/rclone/tree/fix-preallocate-disk-full) (uploaded in 15-30 mins)

---

<div class="post-metadata">

**Author:** ![RCloneUser1](https://forum.rclone.org/letter_avatar_proxy/v4/letter/r/f07891/32.png) [@RCloneUser1](https://forum.rclone.org/u/RCloneUser1)\
**Post date:** [February 10, 2021, 5:40pm UTC](https://forum.rclone.org/t/input-output-error-copying-to-cifs-mount-disk-space-filled/22163/6 "2021-02-10T17:40:39Z")

</div>

Thanks for the update, ncw. We will try out the updated build and report back here.

---

<div class="post-metadata">

**Author:** ![RCloneUser1](https://forum.rclone.org/letter_avatar_proxy/v4/letter/r/f07891/32.png) [@RCloneUser1](https://forum.rclone.org/u/RCloneUser1)\
**Post date:** [February 15, 2021, 11:51pm UTC](https://forum.rclone.org/t/input-output-error-copying-to-cifs-mount-disk-space-filled/22163/7 "2021-02-15T23:51:03Z")

</div>

Hello @ncw, we cherry-picked your changes into our copy of rclone (to ensure only one change from our current version) and still ran into the issue. Our setup is a little odd so let me know if there are questions on the logs.

To follow up on one thing: we have found that the issue generally occurs if two files start copying at the same time. For example, if there is 1GB free but we send copy an 800MB file and a 500MB file, we run into the error. If there is only a single file that is too large (for example, copying a 1.5GB file to a 1GB drive), Rclone provides a "no space available" response before attempting the copy.

[output.log](https://forum.rclone.org/uploads/short-url/kQIDxhadh65v07vOjrwDCxxAj5d.log) (87.7 KB)

---

<div class="post-metadata">

**Author:** ![ncw](https://forum.rclone.org/user_avatar/forum.rclone.org/ncw/32/18_2.png) [@ncw](https://forum.rclone.org/u/ncw)\
**Post date:** [February 16, 2021, 4:39pm UTC](https://forum.rclone.org/t/input-output-error-copying-to-cifs-mount-disk-space-filled/22163/8 "2021-02-16T16:39:24Z")

</div>

I pushed another commit onto the branch which puts a mutex so rclone doesn't call preallocate simultaneously. This seemed to help in my tests. It still wasn't perfect and the fact that it is needed at all probably indicates concurrency problems with the accounting in the file system. However it did make an improvement with my tests.

[v1.55.0-beta.5167.8c6161fb2.fix-preallocate-disk-full](https://beta.rclone.org/branch/fix-preallocate-disk-full/v1.55.0-beta.5167.8c6161fb2.fix-preallocate-disk-full/) on branch [fix-preallocate-disk-full](https://github.com/rclone/rclone/tree/fix-preallocate-disk-full) (uploaded in 15-30 mins)

---

<div class="post-metadata">

**Author:** ![RCloneUser1](https://forum.rclone.org/letter_avatar_proxy/v4/letter/r/f07891/32.png) [@RCloneUser1](https://forum.rclone.org/u/RCloneUser1)\
**Post date:** [February 16, 2021, 7:24pm UTC](https://forum.rclone.org/t/input-output-error-copying-to-cifs-mount-disk-space-filled/22163/9 "2021-02-16T19:24:51Z")

</div>

Hello @ncw, it does not appear that the latest update resolved the issue.

As you've mentioned (similar to the other CIFS problem we reported), the issue likely resides with CIFS rather than Rclone itself.

[output.log](https://forum.rclone.org/uploads/short-url/tTsapVkWIRcj87P3TwUSg5SHDoA.log) (80.6 KB)

---

<div class="post-metadata">

**Author:** ![ncw](https://forum.rclone.org/user_avatar/forum.rclone.org/ncw/32/18_2.png) [@ncw](https://forum.rclone.org/u/ncw)\
**Post date:** [February 17, 2021, 1:10pm UTC](https://forum.rclone.org/t/input-output-error-copying-to-cifs-mount-disk-space-filled/22163/10 "2021-02-17T13:10:13Z")

</div>

I don't see any `preallocate: file too big for remaining disk space` errors in your log - does preallocate work on CIFS at all?

I'm gonig to merge those fixes as I think they are useful anyway.

---

<div class="post-metadata">

**Author:** ![RCloneUser1](https://forum.rclone.org/letter_avatar_proxy/v4/letter/r/f07891/32.png) [@RCloneUser1](https://forum.rclone.org/u/RCloneUser1)\
**Post date:** [February 17, 2021, 5:48pm UTC](https://forum.rclone.org/t/input-output-error-copying-to-cifs-mount-disk-space-filled/22163/11 "2021-02-17T17:48:32Z")

</div>

That appears to be the issue - attempting fallocate from the command prompt returns "fallocate: fallocate failed: Operation not supported"

---

<div class="post-metadata">

**Author:** ![ncw](https://forum.rclone.org/user_avatar/forum.rclone.org/ncw/32/18_2.png) [@ncw](https://forum.rclone.org/u/ncw)\
**Post date:** [February 17, 2021, 6:19pm UTC](https://forum.rclone.org/t/input-output-error-copying-to-cifs-mount-disk-space-filled/22163/12 "2021-02-17T18:19:59Z")

</div>

Ah. That is not going to work then!

I fixed another bug in the preallocate code but you probably aren't interested in that now since CIFS doesn't support preallocate.

[v1.55.0-beta.5215.ffda2aede.fix-preallocate-disk-full](https://beta.rclone.org/branch/fix-preallocate-disk-full/v1.55.0-beta.5215.ffda2aede.fix-preallocate-disk-full/) on branch [fix-preallocate-disk-full](https://github.com/rclone/rclone/tree/fix-preallocate-disk-full) (uploaded in 15-30 mins)

---

<div class="post-metadata">

**Author:** ![system](https://forum.rclone.org/uploads/default/original/2X/3/39ad3235f6ffec76ccd0c81616bd55697b4c300d.png) [@system](https://forum.rclone.org/u/system)\
**Post date:** [April 19, 2021, 2:20pm UTC](https://forum.rclone.org/t/input-output-error-copying-to-cifs-mount-disk-space-filled/22163/13 "2021-04-19T14:20:02Z")

</div>

Closed on April 19, 2021, 2:20pm UTC

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
