Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

fallocate() command equivalent in OS X?

Tags:

linux

macos

Is there a fallocate() equivalent in OS X?

I would like to aggregate all of those equivalent in OS X questions into some doc/table or whatever for everyone. Anybody knows something familiar?

like image 988
Inoperable Avatar asked Jul 11 '12 14:07

Inoperable


People also ask

What is Fallocate command?

DESCRIPTION top. fallocate is used to manipulate the allocated disk space for a file, either to deallocate or preallocate it. For filesystems which support the fallocate system call, preallocation is done quickly by allocating blocks and marking them as uninitialized, requiring no IO to the data blocks.

How do you Fallocate in Python?

Calls fallocate() on the file object or file descriptor. This allows the caller to directly manipulate the allocated disk space for the file referred to by fd for the byte range starting at offset and continuing for len bytes.


1 Answers

What about using:

mkfile -n 1m test.tmp

It's not the same command but serves the same purpose.

Note that fallocate uses decimal multipliers, whereas mkfile uses binary multipliers.

mkfile man

like image 147
Panthro Avatar answered Sep 29 '22 00:09

Panthro