에서 맨 :mkswap
Note that a swap file must not contain any holes. Using cp(1) to
create the file is not acceptable. Neither is use of fallocate(1) on
file systems that support preallocated files, such as XFS or ext4, or
on copy-on-write filesystems like btrfs. It is recommended to use
dd(1) and /dev/zero in these cases. Please read notes from swapon(8)
before adding a swap file to copy-on-write filesystems.
그리고에서 맨 :swapon
You should not use swapon on a file with holes. This can be seen in
the system log as
swapon: swapfile has holes.
The swap file implementation in the kernel expects to be able to write
to the file directly, without the assistance of the filesystem. This
is a problem on preallocated files (e.g. fallocate(1)) on filesystems
like XFS or ext4, and on copy-on-write filesystems like btrfs.
동시에 그것은, 그 다음에 fallocate
보다 빨리 할 수있다 dd
, 그것은 스왑 파일을 생성 및 스왑 관련 도구를 지원하지 적합하지 않습니다.
fallocate
생성 된 파일을 0으로 채우지 않기 때문에 일반적으로 더 빠릅니다. 그렇지 않으면 차이점이 없지만 최종 결과는 같습니다. 참조 : antipaucity.com/2017/08/31/…