Swapfile command dosent exist for me

i am trying to change the swap size from 4gb to 8gb i followed arch wiki the last command i have to run is “sudo /swapfile none swap defaults 0 0” in /etc/fstab but it says command dosent exist (btw im using nano to run the command in the specific file)

As best I know ‘swapfile’ isn’t a command in any Linux distro I’ve used.

ok, step by step:

  1. remove the old swapfile
    1.1) sudo swapoff
    1.2) sudo rm </pathTo/swapfile>
  2. generate a new swapfile
    2.1) sudo mkswap -U clear --size 4G --file /swapfile
    Swap - ArchWiki
    2.2) sudo swapon /swapfile

Cachy doesn’t by default use a swapfile so to speak. It uses zram.

Also that “sudo /swapfile …” is not a command that you run or put in to the fstab file.

in the fstab file it should just a be a line like this:

/swapfile none swap defaults 0 0

it reverts back to 4gb when restarting

btw this was sent on accident

have you copied this line sudo mkswap -U clear --size 4G --file /swapfile?
anyway you must adopt this command for your needs

i did copy it

it’s dangerous to copy a command and don’t know what does it do :wink:

a very short intrusion in to the command line, it follows mostly this pattern:
<command> <option1> <option2> <optionN> <target>

tom@donar ~ # LC_ALL=C mkswap -h

Usage:
 mkswap [options] device [size]

Set up a Linux swap area.

Options:
 -c, --check               check bad blocks before creating the swap area
 -f, --force               allow swap size area be larger than device
 -q, --quiet               suppress output and warning messages
 -p, --pagesize SIZE       specify page size in bytes
 -L, --label LABEL         specify label
 -v, --swapversion NUM     specify swap-space version number
 -U, --uuid UUID           specify the uuid to use
 -e, --endianness=<value>  specify the endianness to use (native, little or big)
 -o, --offset OFFSET       specify the offset in the device
 -s, --size SIZE           specify the size of a swap file in bytes
 -F, --file                create a swap file
     --verbose             verbose output
     --lock[=<mode>]       use exclusive device lock (yes, no or nonblock)
 -h, --help                display this help
 -V, --version             display version

For more details see mkswap(8).

i read the arch wiki page about swap again but i read it more carefully this time and i did it :DDDDDDDDDDDDDDDDDDD