Managing swap memory in Linux

Поделиться
HTML-код
  • Опубликовано: 11 сен 2024
  • Managing swap memory in Linux
    In this video, I would like to show you how to both disable and enable swap memory on a Linux system.
    If you prefer to read more about Linux, you can visit my website here:
    gulian.uk/cate...
    CONNECT WITH ME:
    LinkedIn: / petru-gulian
    Support my work: www.buymeacoff...

Комментарии • 10

  • @streamerking13
    @streamerking13 Год назад +1

    Thanks for sharing... awesome video.

  • @boringboringboringboring
    @boringboringboringboring 7 месяцев назад +1

    What kind of distro is it?

    • @GulianTechnology
      @GulianTechnology  7 месяцев назад +1

      I used Ubuntu 22.04 in the above video. However, the same things apply to other distributions as well.

  • @boringboringboringboring
    @boringboringboringboring 7 месяцев назад +1

    Will it work for Manjaro?

    • @GulianTechnology
      @GulianTechnology  7 месяцев назад +1

      Yes. Please check below.
         ~  cat /etc/os-release  ✔  petru@petru-manjaro23
      NAME="Manjaro Linux"
      PRETTY_NAME="Manjaro Linux"
      ID=manjaro
      ID_LIKE=arch
      BUILD_ID=rolling
      ANSI_COLOR="32;1;24;144;200"
      HOME_URL="manjaro.org/"
      DOCUMENTATION_URL="wiki.manjaro.org/"
      SUPPORT_URL="forum.manjaro.org/"
      BUG_REPORT_URL="docs.manjaro.org/reporting-bugs/"
      PRIVACY_POLICY_URL="manjaro.org/privacy-policy/"
      LOGO=manjarolinux
         ~  free -h  ✔  petru@petru-manjaro23
      total used free shared buff/cache available
      Mem: 7.8Gi 1.2Gi 6.2Gi 23Mi 685Mi 6.6Gi
      Swap: 5.0Gi 0B 5.0Gi
         ~  sudo swapoff -a  ✔  petru@petru-manjaro23
      [sudo] password for petru:
         ~  free -h  ✔  3s   petru@petru-manjaro23
      total used free shared buff/cache available
      Mem: 7.8Gi 1.2Gi 6.2Gi 23Mi 688Mi 6.6Gi
      Swap: 0B 0B 0B
         ~  sudo swapon -a  ✔  petru@petru-manjaro23
         ~  free -h  ✔  petru@petru-manjaro23
      total used free shared buff/cache available
      Mem: 7.8Gi 1.2Gi 6.2Gi 23Mi 691Mi 6.6Gi
      Swap: 5.0Gi 0B 5.0Gi
         ~   ✔  petru@petru-manjaro23

    • @boringboringboringboring
      @boringboringboringboring 7 месяцев назад

      Will swap be enabled again after reboot,if I disable swap on Manjaro this way?@@GulianTechnology

    • @GulianTechnology
      @GulianTechnology  7 месяцев назад +1

      @@boringboringboringboring Give it a try and you will find the answer. 🙂

    • @GulianTechnology
      @GulianTechnology  7 месяцев назад

      @@boringboringboringboring [petru@rocky9 ~]$ free -h
      total used free shared buff/cache available
      Mem: 3.6Gi 1.6Gi 936Mi 39Mi 1.3Gi 2.0Gi
      Swap: 4.0Gi 0B 4.0Gi
      [petru@rocky9 ~]$ sudo swapoff -a
      [petru@rocky9 ~]$ free -h
      total used free shared buff/cache available
      Mem: 3.6Gi 1.6Gi 937Mi 39Mi 1.3Gi 2.0Gi
      Swap: 0B 0B 0B
      [petru@rocky9 ~]$ shutdown -r now
      Call to Reboot failed: Interactive authentication required.
      [petru@rocky9 ~]$ sudo shutdown -r now
      [petru@rocky9 ~]$ Connection to 172.16.10.121 closed by remote host.
      Connection to 172.16.10.121 closed.
      pgulian@pgulian-ltm1 ~ % ssh petru@172.16.10.121
      petru@172.16.10.121's password:
      Permission denied, please try again.
      petru@172.16.10.121's password:
      Activate the web console with: systemctl enable --now cockpit.socket
      Last failed login: Wed Jan 31 16:27:19 GMT 2024 from 172.16.10.20 on ssh:notty
      There was 1 failed login attempt since the last successful login.
      Last login: Wed Jan 31 16:26:16 2024 from 172.16.10.20
      [petru@rocky9 ~]$ free -h
      total used free shared buff/cache available
      Mem: 3.6Gi 744Mi 2.6Gi 14Mi 508Mi 2.8Gi
      Swap: 4.0Gi 0B 4.0Gi

    • @GulianTechnology
      @GulianTechnology  7 месяцев назад +1

      @boringboringboringboring If you want to disable the swap permanently, you need to remove/comment the entry from the /etc/fstab file.
      Before:
      [petru@rocky9 ~]$ cat /etc/fstab
      #
      # /etc/fstab
      # Created by anaconda on Thu Oct 19 05:54:58 2023
      #
      # Accessible filesystems, by reference, are maintained under '/dev/disk/'.
      # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info.
      #
      # After editing this file, run 'systemctl daemon-reload' to update systemd
      # units generated from this file.
      #
      /dev/mapper/rl-root / xfs defaults 0 0
      UUID=333e7a34-65cd-45e6-8e17-8111c24d57f0 /boot xfs defaults 0 0
      /dev/mapper/rl-swap none swap defaults 0 0
      [petru@rocky9 ~]$
      [petru@rocky9 ~]$ sudo vim /etc/fstab
      After editing the /etc/fstab file.
      [petru@rocky9 ~]$ cat /etc/fstab
      #
      # /etc/fstab
      # Created by anaconda on Thu Oct 19 05:54:58 2023
      #
      # Accessible filesystems, by reference, are maintained under '/dev/disk/'.
      # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info.
      #
      # After editing this file, run 'systemctl daemon-reload' to update systemd
      # units generated from this file.
      #
      /dev/mapper/rl-root / xfs defaults 0 0
      UUID=333e7a34-65cd-45e6-8e17-8111c24d57f0 /boot xfs defaults 0 0
      #/dev/mapper/rl-swap none swap defaults 0 0
      [petru@rocky9 ~]$