如何在Windows XP中复制大文件?
我在 Windows XP 中有一个大文件 - 38GB。 (虚拟机映像)
我似乎无法复制它。
在桌面上拖动 - 出现“系统资源不足,无法完成请求的服务”的错误
使用 Java - FileChannel.transferTo(0, fileSize, dest) 对于所有文件均失败 > 2GB
使用 Java - FileChannel.transferTo() 在 100Mb 块中失败后 ~18Gb
java.io.IOException: Insufficient system resources exist to complete the requested service
at sun.nio.ch.FileDispatcher.write0(Native Method)
at sun.nio.ch.FileDispatcher.write(FileDispatcher.java:44)
at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:72)
at sun.nio.ch.IOUtil.write(IOUtil.java:28)
at sun.nio.ch.FileChannelImpl.write(FileChannelImpl.java:198)
at sun.nio.ch.FileChannelImpl.transferToTrustedChannel(FileChannelImpl.java:439)
at sun.nio.ch.FileChannelImpl.transferTo(FileChannelImpl.java:510)
我的意思是 - 计算机有 3GB RAM。 100GB 缓冲区应该足够了!?!?
显然,DOS 命令“copy”和“xcopy”也失败。
(编辑)我尝试过 COPY & XCOPY - 这些失败并出现相同的错误。 XCOPY 似乎也花了很长时间。
我听说过 Robocopy,但它不复制单个文件?
我真的感觉 Windows 现在已经输了。微软肯定听说过大于几 GB 的文件吗?
谢谢!
I have a large file in windows XP - its 38GB. (a VM image)
I cannot seem to copy it.
Dragging on the desktop - gives error of "Insufficient system resources exist to complete the requested service"
Using Java - FileChannel.transferTo(0, fileSize, dest) fails for all files > 2GB
Using Java - FileChannel.transferTo() in chunks of 100Mb fails after ~18Gb
java.io.IOException: Insufficient system resources exist to complete the requested service
at sun.nio.ch.FileDispatcher.write0(Native Method)
at sun.nio.ch.FileDispatcher.write(FileDispatcher.java:44)
at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:72)
at sun.nio.ch.IOUtil.write(IOUtil.java:28)
at sun.nio.ch.FileChannelImpl.write(FileChannelImpl.java:198)
at sun.nio.ch.FileChannelImpl.transferToTrustedChannel(FileChannelImpl.java:439)
at sun.nio.ch.FileChannelImpl.transferTo(FileChannelImpl.java:510)
I mean - the computer has 3GB of RAM. A 100GB buffer should be enough!?!?
Apparently the DOS commands "copy" and "xcopy" also fail.
(edit) I've tried COPY & XCOPY - these fail with the same error. XCOPY seems to take a really really long time about it too.
I've heard of Robocopy, but it doesn't copy single files?
I'm really feeling that Windows is for the lose right now. Surely microsoft have heard of files larger than a few GB?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
在 Java 中,不要尝试在一次操作中复制整个文件。
transferTo()
方法适用于文件块;并不是作为高级文件复制方法。调用transferTo()
在循环中,并假设count
字节的数据将位于 RAM 中(即降低该参数以便舒适地安装在 RAM 中)。transferTo()
JavaDoc 中关于它“比简单循环更高效”的评论指的是通道到通道通信比通道到用户空间通信可以得到更多优化的事实。至频道。它并不意味着所有循环都可以避免。In Java, don't try to copy the whole file in a single operation. The
transferTo()
method works on chunks of a file; wasn't intended as a high-level file copy method. InvoketransferTo()
in a loop, and assume thatcount
bytes of data will be in RAM (i.e., lower that parameter to be comfortable fitting in RAM).The comment in the
transferTo()
JavaDoc about it being "more efficient than a simple loop" refers to the fact that channel-to-channel communication can be optimized more than channel-to-user-space-to-channel. It doesn't mean that all looping can be avoided.我是一名 Vmware ESX 用户,我有 30 个生产虚拟机,最大的为 232GB。我将虚拟机实例备份到内部 SATA 驱动器上,然后每周将它们复制到外部 eSata 一次。我使用 teracopy(免费),它在 3GB 的 XP 机器上平均运行速度为 45MB/s。
希望有帮助
赛伦
I am a Vmware ESX user, I have 30 production VM's with the largest being 232GB. I backup my VM instances onto an internal SATA drive and then copy these off once a week to an external eSata. I use teracopy (free), it runs on average at 45MB/s on an XP machine with 3GB.
Hope that helps
Sailen
嗯 - 我还没有找到有效的方法。
Windows 中的任何打包工具都不会复制该文件。拖放、COPY、XCOPY、java - 都无法复制文件。
我想复制该文件的原因是为了在操作系统升级之前进行备份。
最后我启动到 knoppix 并复制它。
Well - I've not managed to find a way that works.
None of the packaged tools in windows will copy the file. Drag and drop, COPY, XCOPY, java - all fail to copy the file.
The reason I wanted to copy the file was for a backup before doing an OS upgrade.
In the end i booted into knoppix and copied it.
看看这个修补程序,值得一试,因为我所看到的一切都表明这是一个解决你的问题。
编辑:您还可以按照指出的那样尝试 XCOPY /Z 这里。
Take a look at this Hotfix, worth a try as everything I have seen points to this as being a cure for your issue.
EDIT: You can also try XCOPY /Z as pointed out here.
也可能是硬件问题。。
我怀疑你没有太多时间,但是你可以尝试更笨的流解决方案并且不要设置大缓冲区(8-16MB 应该足够了):
There may be a hardware issue as well..
I suspect you don't have much time, however you may try dumber stream solution and don't set large buffers (8-16MB should be enough):
您确定文件系统实际上能够处理这么大的文件(例如 FAT32 就不能)?查看此链接了解详细信息 http://www.ntfs.com/ntfs_vs_fat.htm
系统是32位还是64位?在 32 位上,复制大于 2-4Gb 的文件时可能会遇到问题。
另外,你说 rsync 对你来说很糟糕。我对此有非常好的体验,以接近本机的速度在两个硬盘驱动器之间进行复制。我有很多小文件..你似乎有大块文件。
您也可以尝试将大斑点分成较小的斑点:)
are you sure the filesystem is actually able to cope with such big files (FAT32 cannot for example)? Take a look on this link for details http://www.ntfs.com/ntfs_vs_fat.htm
The system is 32 or 64 bit? On 32-bit you may have problems copy-ing files larger that 2-4Gb.
Also, you said that rsync scucks for you. I've had a very nice experience with it, copying between 2 hard drives at near-native speed. I've had lots of small files..you seem to have on big blob instead.
You may also try splitting the big blob into smaller blobs:)
这确实有效!只需确保您的 src 和 dst 是 FileChannel 对象(分别为输入、输出)
This does work! just make sure your src and dst are FileChannel objects (input, output respectively)
另一个可能的答案是 Files.copy (java NIO 2),例如:
Another possible answer is Files.copy (java NIO 2), e.g.: