Reputation: 3513
Rails 3.2.20, Ruby 1.9.3p194, Apache 2.2.22, Passenger 3.0.21.
File are uploaded to /tmp
(that what I think when looking at the logs:
Parameters: {
...
@tempfile=#<File:/tmp/RackMultipart20150317-1329-19lcteh>>
...
}
)
Big file uploads (for instance for a 1.8Go file) raise the exception Errno::ENOSPC: No space left on device - write
with the log trace:
/usr/local/lib/ruby/1.9.1/fileutils.rb:1372 :in `copy_stream`
/usr/local/lib/ruby/1.9.1/fileutils.rb:1372 :in `block (2 levels) in copy_file`
/usr/local/lib/ruby/1.9.1/fileutils.rb:1371 :in `open`
/usr/local/lib/ruby/1.9.1/fileutils.rb:1371 :in `block in copy_file`
/usr/local/lib/ruby/1.9.1/fileutils.rb:1370 :in `open`
/usr/local/lib/ruby/1.9.1/fileutils.rb:1370 :in `copy_file`
/usr/local/lib/ruby/1.9.1/fileutils.rb:477 :in `copy_file`
/usr/local/lib/ruby/1.9.1/fileutils.rb:396 :in `block in cp`
/usr/local/lib/ruby/1.9.1/fileutils.rb:1515 :in `block in fu_each_src_dest`
/usr/local/lib/ruby/1.9.1/fileutils.rb:1531 :in `fu_each_src_dest0`
/usr/local/lib/ruby/1.9.1/fileutils.rb:1513 :in `fu_each_src_dest`
/usr/local/lib/ruby/1.9.1/fileutils.rb:395 :in `cp`
[GEM_ROOT]/gems/paperclip-4.2.0/lib/paperclip/io_adapters/abstract_adapter.rb:41 :in `copy_to_tempfile`
[GEM_ROOT]/gems/paperclip-4.2.0/lib/paperclip/io_adapters/uploaded_file_adapter.rb:8 :in `initialize`
I don't understand why because the partition where is the /tmp
directory has plenty of available space:
Filesystem Size Used Avail Use% Mounted on
rootfs 9.9G 4.9G 4.6G 52% /
There is no file size limit in the Apache configuration.
Upvotes: 0
Views: 1195
Reputation: 2145
I add a quick look at the paperclip source. It seems the file content is copied, so it is present 2 time on the disk. (The error trace also shows it)
So to be able to hadle 1.8G file you need at least 3.6G of free space. If at the same time a 500M file is uploaded (or if there is another copy some where) you don't have anought disk space.
To be able to size the needed storage, you will need to track how your framework is handling uploaded files.
Upvotes: 2