Skip to content
Advertisement

mkswap fails to create a file

I was attempting to create a swap file:

  mkswap -f /var/swap

I get “/var/swap No such file or directory”

Am I supposed to create the file first? The documentation I found does not say that, so I am concerned.

Advertisement

Answer

Yes, you’ll need to create the file first. dd is the standard choice:

dd if=/dev/zero of=/var/swap bs=1024 count=131072
mkswap /var/swap
swapon

this’d create a 128meg swap file.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement