Sample Header Ad - 728x90

Truncate command not creating a hole

-1 votes
1 answer
148 views
I am trying to create a file with hole using the truncate command. I read up in some posts and one of the answers in this post says to use truncate command. Filesystem used is btrfs. This is the command
$: truncate -s 16K holes

$: du holes
$: 16      holes
$:  stat holes
File: holes
  Size: 16384           Blocks: 32         IO Block: 4096   regular file
As can be seen, its allocating 16 blocks...my understanding was that it will allocate 0 blocks as mentioned that answer as well. Did I make a mistake in understanding what truncate is doing?
Asked by Shivanshu Arora (11 rep)
Oct 5, 2023, 02:17 AM
Last activity: Oct 5, 2023, 04:48 PM