1

I have created a swapfile successfully, but when I am trying to:

"sudo swapon /swapfile" 

this is what I see:

"swapon: /swapfile1: skipping"

It appears to have holes.

How can I create a swapfile that doesn't have a hole?

Pilot6
  • 92,041

1 Answers1

2

Swapfile Holes

There is a slight possibility of getting holes in a swapfile when creating it with fallocate.

/var/log/syslog can be searched for the phrase swapon: swapfile has holes to ensure there will be no data loss.

A swap file can alternatively be created using dd:

sudo dd if=/dev/zero of=/swapfile bs=1G count=8

An error when using dd may overwrite your HDD.

C.S.Cameron
  • 20,530
  • 12
  • 78
  • 125