I am trying to create 1GB swap file without success on my Ubuntu 22.04.
I use the following commands:
sudo rm /swapfile1sudo dd if=/dev/zero of=/swapfile1 bs=1KB count=1MB status=progresssudo chmod 0600 /swapfile1sudo mkswap /swapfile1sudo swapon /swapfile1
The output I get:
905663000 bytes (906 MB, 864 MiB) copied, 5 s, 181 MB/s1000000+0 records in1000000+0 records out1000000000 bytes (1.0 GB, 954 MiB) copied, 5.46825 s, 183 MB/sSetting up swapspace version 1, size = 953.7 MiB (999993344 bytes)no label, UUID=4c4c204b-57ff-484d-848b-d719e0260156swapon: /swapfile1: skipping - it appears to have holes.
Context
When looking at my free space, I see:
$ df /Filesystem 1K-blocks Used Available Use% Mounted onrpool/ROOT/ubuntu_emx73f 879401216 225886848 653514368 26% /
Note that I use the Full Disk Encryption of Ubuntu (not sure if this is relevant)
Also, replacing dd
with fallocate
does not solve the problem