How do i add file swap space to ubuntu?



  • Create a file for your swap space, using fallocate. fallocate man page: http://bit.ly/2qcsRnB

    $ sudo fallocate -l 1G /swapspace
    

    Make that file into a linux swap area. mkswap man page: http://bit.ly/2pFr5Kt

    $ sudo mkswap /swapspace
    Setting up swapspace version 1, size = 1024 MiB (1073737728 bytes)
    no label, UUID=a80e9iedb-bdaf-4f44-9882-6e877bc79643
    

    Secure & Activate the swap space. swapon man page: http://bit.ly/2r977c9

    $ sudo chmod 600 /swapspace
    $ sudo swapon /swapspace
    

    Make it permanent to ensure swap is enabled on reboot. Edit /etc/fstab and a line.

    /swapspace            none swap    sw              0       0
    

Log in to reply
 

© Lightnetics 2024