Linux: Ubuntu 20.04.4 LTS 修改交换空间大小Linux: Ubuntu 20.04.4 LTS 修改交换空间大小Linux: Ubuntu 20.04.4 LTS 修改交换空间大小Linux: Ubuntu 20.04.4 LTS 修改交换空间大小
  • 首页
  • 博客
  • 书签
  • 文件
  • 分析
  • 登录

Linux: Ubuntu 20.04.4 LTS 修改交换空间大小

发表 admin at 2022年10月22日
类别
  • Linux
标签

In sleep mode, the content of ram is kept as it is, and the computer works on a very low power mode, so as to keep the ram content intact (as ram will lose the data if power supply is cut to it). But in hibernation, the ram content is stored in the swap space, so power can be completely cut off. Hence it is recommended to have swap size as large as the ram size.

  1. First, find the swap file, disable and delete it
     swapon --show
     NAME      TYPE SIZE USED PRIO
     /swapfile file   2G   0B   -2
    
     sudo swapoff /swapfile  
     sudo rm  /swapfile
    
  2. Create new swap space of size 16 GB (16 * 1024 = 16384). bs is the block size. Basically bs * count = bytes to be allocated (in this case 16 GB). Here bs = 1M (M stands for mega, so we are assigning 1MB block size) and we are allocating 16384 * 1MB (=16GB) to swap.
     sudo dd if=/dev/zero of=/swapfile bs=1M count=16384
    
  3. Give it the read/write permission for root
     sudo chmod 600 /swapfile
    
  4. Format it to swap
     sudo mkswap /swapfile
    
  5. Turn on swap again
     sudo swapon /swapfile
    
  6. Now reboot the PC for the above changes to take place.

发表回复 取消回复

您的电子邮箱地址不会被公开。 必填项已用*标注

类别

  • Cat
  • Python
  • MySQL
  • Django
  • Html/CSS
  • JavaScript
  • Vue
  • RegExp
  • php
  • Practice
  • Virtualization
  • Linux
  • Windows
  • Android
  • NAS
  • Software
  • Hardware
  • Network
  • Router
  • Office
  • WordPress
  • SEO
  • English
  • Games
  • Recipes
  • living
  • Memorandum
  • Essays
  • 未分类

归档

©2015-2023 艾丽卡 Blog support@alaica.com
      ajax-loader