guys i need to enable swap on my ubuntu system and i want to avoid swap on SSD or format my hard disk that doesn't contain the swap partition. So i was trying to create a file swap and use it but, following the ubuntu guide: https://help.ubuntu.com/community/SwapFaq i'm not able to figure out the problem. First of all i can't allocate the file with fallocate because it says operation not permitted, then i create a file with dd with all zeros but after setting the right permission and after calling mkswap, the command swapon fails saying: kipping - it appears to have holes. I want to use file swap to avoid create partition on a disk with already a whole partition, and i want it on the hard disk not on the SSD. Can you help me please? those are the steps that i did
The problem is that swapon got interrupted because the file appears to have holes. It is created using dd.
To resume what is the problem: my system has no swap at all. I want to add a new one on secondary hard disk, instead of primary SSD, but i want to avoid format it and create the partition. That is why i create the swap file. But when i try to active it with the command "swapon" i receive the error: it appears to have holes.
sudo fallocate ...
. This will grab all the disk blocks in one contiguous block. Creating the file withdd
allocates disk blocks a few at a time, with no guarantee of contiguous groups of blocks, thus, the complaint about "holes". – waltinator Mar 27 '21 at 17:29