Skip to contentSkip to conversation

ftruncate64

DISCUSSION Anton Petrusevich 2 participants 2 messages Feb 25, 2004 – Mar 3, 2004

lore
Share & tools
lore
#0 lore raw

Hi guys,

That looks funny:

casus@jabbervorx:~$ dd if=/dev/zero of=hole bs=1k count=1 seek=2047M
1+0 records in
1+0 records out
1024 bytes transferred in 0,000133 seconds (7696845 bytes/sec)
casus@jabbervorx:~$ dd if=/dev/zero of=hole bs=1k count=1 seek=2048M
dd: advancing past 2199023255552 bytes in output file `hole': File too large

strace shows the errorneous call:
ftruncate64(1, 2199023255552) = -1 EFBIG (File too large)

This behavour is observed with 2.4.23 and 2.6.3-rc1 kernels. And with 2.4.20-28.9smp redhat kernel too. But not with RHEL3 kernels. Looks like RedHat silently fixed that bug.

Signature · 1 line
Anton Petrusevich
#1 lore raw
Quoted 1 line · Anton Petrusevich

ftruncate64(1, 2199023255552) = -1 EFBIG (File too large)

Depends on your fs, some fs's will allow you to create much larger files that others:

cw@pain:~$ truncate -c -s100t big-file
cw@pain:~$ ls -lh big-file
-rw-r--r--    1 cw       cw           100T Mar  3 02:05 big-file

Note, you might need a 64-bit system to be able to write to all of that because the index into the buffer-cache is an unsigned long. For me on my notebook I can't write past 8T.

--cw