ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Simple Linux Swap File Creation

    Scheduled Pinned Locked Moved IT Discussion
    linuxswapswapfilememory
    18 Posts 7 Posters 2.1k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • scottalanmillerS
      scottalanmiller @black3dynamite
      last edited by

      @black3dynamite said in Simple Linux Swap File Creation:

      @scottalanmiller said in Simple Linux Swap File Creation:

      @black3dynamite said in Simple Linux Swap File Creation:

      When I was using Ubuntu Desktop, I used swapfile instead of a swap partition just so I don't have to waste disk space.

      Ubuntu has moved to it as the default, now.

      When did that start?

      Not all that long ago. two versions back, maybe.

      1 Reply Last reply Reply Quote 0
      • dbeatoD
        dbeato @black3dynamite
        last edited by

        @black3dynamite said in Simple Linux Swap File Creation:

        @scottalanmiller said in Simple Linux Swap File Creation:

        @black3dynamite said in Simple Linux Swap File Creation:

        When I was using Ubuntu Desktop, I used swapfile instead of a swap partition just so I don't have to waste disk space.

        Ubuntu has moved to it as the default, now.

        When did that start?

        Ubuntu 16.04
        https://wiki.ubuntu.com/BionicBeaver/ReleaseNotes

        0_1522965521598_DeepinScreenshot_select-area_20180405175825.png

        1 Reply Last reply Reply Quote 3
        • LakshmanaL
          Lakshmana @scottalanmiller
          last edited by

          @scottalanmiller said in Simple Linux Swap File Creation:

          A simple process for making a swapfile to add swap space to a Linux instance.

          sudo fallocate -l 2G /swapfile
          sudo chmod 600 /swapfile
          sudo mkswap /swapfile
          sudo swapon /swapfile
          sudo echo "/swapfile swap swap defaults 0 0">>/etc/fstab
          

          Or to copypasta as a single line:

          fallocate -l 2G /swapfile && chmod 600 /swapfile && mkswap /swapfile && swapon /swapfile  && echo "/swapfile swap swap defaults 0 0">>/etc/fstab
          

          This can be done in Noobs OS for raspberry tooo?

          scottalanmillerS 1 Reply Last reply Reply Quote 0
          • scottalanmillerS
            scottalanmiller @Lakshmana
            last edited by

            @lakshmana Should work on any Linux.

            1 Reply Last reply Reply Quote 0
            • black3dynamiteB
              black3dynamite @scottalanmiller
              last edited by

              @scottalanmiller said in Simple Linux Swap File Creation:

              A simple process for making a swapfile to add swap space to a Linux instance.

              sudo fallocate -l 2G /swapfile
              sudo chmod 600 /swapfile
              sudo mkswap /swapfile
              sudo swapon /swapfile
              sudo echo "/swapfile swap swap defaults 0 0">>/etc/fstab
              

              Or to copypasta as a single line:

              fallocate -l 2G /swapfile && chmod 600 /swapfile && mkswap /swapfile && swapon /swapfile  && echo "/swapfile swap swap defaults 0 0">>/etc/fstab
              

              sudo swapon /swapfile wasn't working for me. In /var/log/messages, I was getting these messages.
              0_1533087006259_6ac4c960-792b-46e4-bd30-3f7bc8b697c2-image.png

              This works for me:

              sudo dd if=/dev/zero of=/swapfile count=2048 bs=1MiB
              sudo chmod 600 /swapfile
              sudo mkswap /swapfile
              sudo swapon /swapfile
              sudo echo "/swapfile swap swap defaults 0 0">>/etc/fstab
              
              1 Reply Last reply Reply Quote 0
              • jmooreJ
                jmoore @scottalanmiller
                last edited by

                @scottalanmiller I think I did something similar a few months back to increase performance. Not sure it did much but I guess it hasn't hurt

                scottalanmillerS 1 Reply Last reply Reply Quote 0
                • scottalanmillerS
                  scottalanmiller @jmoore
                  last edited by

                  @jmoore said in Simple Linux Swap File Creation:

                  @scottalanmiller I think I did something similar a few months back to increase performance. Not sure it did much but I guess it hasn't hurt

                  It reduces performance, but increases capacity.

                  dafyreD jmooreJ 2 Replies Last reply Reply Quote 1
                  • dafyreD
                    dafyre @scottalanmiller
                    last edited by

                    @scottalanmiller said in Simple Linux Swap File Creation:

                    @jmoore said in Simple Linux Swap File Creation:

                    @scottalanmiller I think I did something similar a few months back to increase performance. Not sure it did much but I guess it hasn't hurt

                    It reduces performance, but increases capacity.

                    Does using a swapfile vs a swap partition reduce performance to the point it is significantly noticeable?

                    scottalanmillerS 1 Reply Last reply Reply Quote 0
                    • scottalanmillerS
                      scottalanmiller @dafyre
                      last edited by

                      @dafyre said in Simple Linux Swap File Creation:

                      @scottalanmiller said in Simple Linux Swap File Creation:

                      @jmoore said in Simple Linux Swap File Creation:

                      @scottalanmiller I think I did something similar a few months back to increase performance. Not sure it did much but I guess it hasn't hurt

                      It reduces performance, but increases capacity.

                      Does using a swapfile vs a swap partition reduce performance to the point it is significantly noticeable?

                      No, that's why it's done now. Swap should be used SO little, and flexibility trumps the tiny performance increase.

                      1 Reply Last reply Reply Quote 0
                      • jmooreJ
                        jmoore @scottalanmiller
                        last edited by

                        @scottalanmiller Well that explains it lol. It was a long time ago now so don't remember what my logic was, or if there was any at all

                        1 Reply Last reply Reply Quote 0
                        • JaredBuschJ
                          JaredBusch
                          last edited by

                          Just manually installed CentOS 8 for the first time on my local system to test something, and they still use a swap partition by default.

                          Warns you if you delete it.

                          d695d123-0afc-48a5-9a19-cdb145a7de05-image.png

                          black3dynamiteB 1 Reply Last reply Reply Quote 0
                          • black3dynamiteB
                            black3dynamite @JaredBusch
                            last edited by

                            @JaredBusch said in Simple Linux Swap File Creation:

                            Just manually installed CentOS 8 for the first time on my local system to test something, and they still use a swap partition by default.

                            Warns you if you delete it.

                            d695d123-0afc-48a5-9a19-cdb145a7de05-image.png

                            I automatically ignore Fedora and CentOS warning about that.

                            black3dynamiteB JaredBuschJ 2 Replies Last reply Reply Quote 0
                            • black3dynamiteB
                              black3dynamite @black3dynamite
                              last edited by

                              @black3dynamite said in Simple Linux Swap File Creation:

                              @JaredBusch said in Simple Linux Swap File Creation:

                              Just manually installed CentOS 8 for the first time on my local system to test something, and they still use a swap partition by default.

                              Warns you if you delete it.

                              d695d123-0afc-48a5-9a19-cdb145a7de05-image.png

                              I ignore Fedora and CentOS warning about that.

                              1 Reply Last reply Reply Quote 0
                              • JaredBuschJ
                                JaredBusch @black3dynamite
                                last edited by

                                @black3dynamite said in Simple Linux Swap File Creation:

                                I automatically ignore Fedora and CentOS warning about that.

                                I ignored it also. just pointing out the default behavior.

                                1 Reply Last reply Reply Quote 0
                                • 1 / 1
                                • First post
                                  Last post