Uploaded image for project: 'Commons IO'
  1. Commons IO
  2. IO-586

FileUtils.copyFile fails with java.io.IOException: No such device

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Information Provided
    • 2.6
    • None
    • Utilities
    • None

    Description

      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:

       

       

      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"));
          }
      }
      

      below is the stacktrace:

      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)
      

      Here's our server's file system configuration:

      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
      

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            loonydevil Andy
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: