[ 
https://issues.apache.org/jira/browse/IO-586?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Sebb resolved IO-586.
---------------------
    Resolution: Information Provided

The code no longer uses FileChannel.transferFrom.
It uses java.nio.file.Files.copy instead since version 2.7

If the problem persists in 2.7 please raise another issue.

> 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
>            Priority: Major
>
> 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
(v8.3.4#803005)

Reply via email to