Difference between revisions of "Fallocate"

From wikieduonline
Jump to navigation Jump to search
 
(14 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
{{lowercase}}
 +
<code>fallocate</code> preallocate or deallocate space to a [[file]], it is not supported in [[ZFS]]<ref>https://github.com/openzfs/zfs/issues/326</ref>, use <code>[[dd]]</code> instead of.
 +
* Man page: https://man7.org/linux/man-pages/man1/fallocate.1.html
  
fallocate - preallocate or deallocate space to a file
 
  
https://man7.org/linux/man-pages/man1/fallocate.1.html
+
== Examples ==
 +
fallocate -l 1G NEW_filename
 +
fallocate -l 24M NEW_filename
 +
-l --length
  
  
 
  fallocate -l 1G NEW_filename
 
  fallocate -l 1G NEW_filename
  fallocate -l 24M NEW_filename
+
  fallocate: fallocate failed: [[No space left on device]]
  -l --length
+
 
 +
fallocate
 +
  fallocate: no filename specified
  
 
== Options ==
 
== Options ==
Line 37: Line 44:
  
  
== Examples ==
+
== Execution examples ==
  
 
  fallocate
 
  fallocate
Line 44: Line 51:
 
  fallocate -v -l 10G NEW_10G_FILE
 
  fallocate -v -l 10G NEW_10G_FILE
 
  (not output on success)
 
  (not output on success)
 
  
 
== Related commands ==
 
== Related commands ==
 
* <code>[[df]]</code>
 
* <code>[[df]]</code>
 
* <code>[[truncate]]</code>
 
* <code>[[truncate]]</code>
 +
* <code>[[head]]</code>
 +
* <code>[[dd]] if=[[/dev/zero]] of=YOUR_BIG_FILE bs=1 count=0 seek=100G</code>
 +
* <code>[[head -c]] 1G </dev/urandom >myfile</code>
 +
* <code>[[mkswap]]</code>
  
 
== See also ==
 
== See also ==
 +
* {{fallocate}}
 
* {{files}}
 
* {{files}}
 
* {{swap}}
 
* {{swap}}

Latest revision as of 08:22, 18 February 2024

fallocate preallocate or deallocate space to a file, it is not supported in ZFS[1], use dd instead of.


Examples[edit]

fallocate -l 1G NEW_filename
fallocate -l 24M NEW_filename
-l --length


fallocate -l 1G NEW_filename
fallocate: fallocate failed: No space left on device
fallocate
fallocate: no filename specified

Options[edit]

fallocate -h

Usage:
 fallocate [options] <filename>

Preallocate space to, or deallocate space from a file.

Options:
 -c, --collapse-range remove a range from the file
 -d, --dig-holes      detect zeroes and replace with holes
 -i, --insert-range   insert a hole at range, shifting existing data
 -l, --length <num>   length for range operations, in bytes
 -n, --keep-size      maintain the apparent size of the file
 -o, --offset <num>   offset for range operations, in bytes
 -p, --punch-hole     replace a range with a hole (implies -n)
 -z, --zero-range     zero and ensure allocation of a range
 -x, --posix          use posix_fallocate(3) instead of fallocate(2)
 -v, --verbose        verbose mode

 -h, --help           display this help
 -V, --version        display version

For more details see fallocate(1).


Execution examples[edit]

fallocate
fallocate: no filename specified
fallocate -v -l 10G NEW_10G_FILE
(not output on success)

Related commands[edit]

See also[edit]

  • https://github.com/openzfs/zfs/issues/326
  • Advertising: