fallocate failed: Operation not supported

When running,

fallocate -l 10G /path/to/file

I'm returned the following error:

fallocate: file: fallocate failed: Operation not supported

Creating the file using dd (if=/dev/zero or if=/dev/urandom) works, but if I'm trying to create large files, tens of GBs in size, it takes several hours to complete.

Running Ubuntu 14.04. Using an ext4 partition, specifying a file-type doesn't appear to alter the outcome.

Working fine on my CentOS6 machines, just not Ubuntu.


If sparse files are ok for you (e.g. you want to create an image in order to populate it with a file system), they are created in no time at all

100GB take 3 milliseconds:

# time dd if=/dev/zero of=tmptst.dat bs=1G seek=100 count=0
0+0 records in
0+0 records out
0 bytes (0 B) copied, 0,00037726 s, 0,0 kB/s

real    0m0.003s
user    0m0.000s
sys 0m0.002s

The resulting file:

# ls -lh tmptst.dat
-rw-r--r-- 1 root root 100G 2015-01-22 16:39 tmptst.dat

Its real size at the moment: 0 Bytes

# ls -lsh tmptst.dat
0 -rw-r--r-- 1 root root 100G 2015-01-22 16:39 tmptst.dat

I also ran into this problem.

A symbolic link in the directory path seems to be the problem. try the same command on /tmp and it should work.

I was able to get around the problem by adding a '-x' to the fallocate command. This forced 'posix mode', and it supposed to take longer.

Even though the filesystem was ext4 the symbolic link was causing the 'not supported on this filesystem' error. In fact if I went directly to the directory name ( without any symbolic links ), the fallocate() call did work.

A1: don't have symbolic links anywhere in the full path name of the file you are creating.

A2: use the '-x', even though it takes longer.

b\375


If you do not care about the content but just need some data,

First do,

dd if=/dev/urandom of=tmp.txt bs=1M count=1

It will create,

-rw-r--r-- 1 root root 1.0M Oct 17 00:30 tmp1.txt.

Then, if you like to create a 10M file, use the above generated file for append repeatedly,

for i in {1..10}; do dd if=tmp.txt of=tmp1.txt bs=1M oflag=append conv=notrunc; done;