You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Andy (JIRA)" <ji...@apache.org> on 2018/10/04 10:32:00 UTC

[jira] [Created] (IO-586) FileUtils.copyFile fails with java.io.IOException: No such device

Andy created IO-586:
-----------------------

             Summary: FileUtils.copyFile fails with java.io.IOException: No such device
                 Key: IO-586
                 URL: https://issues.apache.org/jira/browse/IO-586
             Project: Commons IO
          Issue Type: Bug
          Components: Utilities
    Affects Versions: 2.6
            Reporter: Andy


When trying to copy file on CEPH filesystem, FileUtils.copyFile fails with exception. I don't see any workaround except of replacing that call and rebuilding the project.

*Test Case*:

Here's a simple class to reproduce the issue:

 

 
{code:java}
import org.apache.commons.io.FileUtils;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.nio.file.Files;

public class Test3 {
    public static void main(String[] args) throws IOException {
        PrintWriter writer = new PrintWriter("file.txt", "UTF-8");
        writer.println("test input " + Math.random());
        writer.close();
        FileUtils.copyFile(new File("file.txt"), new File("file-copy.txt"));
    }
}
{code}
below is the stacktrace:
{code:java}
Exception in thread "main" java.io.IOException: No such device at sun.nio.ch.FileChannelImpl.map0(Native Method) at sun.nio.ch.FileChannelImpl.map(FileChannelImpl.java:926) at sun.nio.ch.FileChannelImpl.transferFromFileChannel(FileChannelImpl.java:634) at sun.nio.ch.FileChannelImpl.transferFrom(FileChannelImpl.java:708) at org.apache.commons.io.FileUtils.doCopyFile(FileUtils.java:1131) at org.apache.commons.io.FileUtils.copyFile(FileUtils.java:1076) at org.apache.commons.io.FileUtils.copyFile(FileUtils.java:1028) at ztst.Test3.main(Test3.java:17)
{code}
Here's our server's file system configuration:
{code:java}
1. a squashfs (read only) image stored on a ceph's rbd
2. a directory on cephfs (read/write)

1 is the lower layer and 2 is the upper layer of an unionfs mount with the following options:

cow
max_files=32768
allow_other
use_ino
direct_io
statfs_omit_ro
nonempty
{code}
 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)