Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Why does this work:

truncate -s 2043G foo

...while this fails:

truncate -s 2044G foo

Why 2043 gigabytes, of all values?

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

You're probably using a filesystem that has a 2TB maximum file size (for example, ext3 with a 4KB or 8KB block size). truncate won't let you specify a target file size greater than the maximum your file system supports; 2044GB is very close to 2TB. I'm not sure why it's not exactly 2048GB that causes the problem; it's probably something internal to ext3's method of storing files

share|improve this answer
add comment

That's a limitation of the file system you use. Here ZFS creates a whopping 7 Exabyte sparse file:

$ truncate -s 7E foo
$ ls -l foo
-rw-r--r--   1 jlliagre 8070450532247928832 Nov  9 16:49 foo
share|improve this answer
    
I figured as much, sorry for not having specified this. –  badp Nov 9 '10 at 16:30
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.