Advertisement
v1ral_ITS

Swapfile about and resizeing

May 7th, 2020
1,433
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.88 KB | None | 0 0
  1. Swap is a special area on your computer, which the operating system can use as additional RAM.
  2. Starting with Ubuntu 17.04, the swap partition was replaced by a swap file. The main advantage of the swap file is easy resizing.
  3.  
  4. In the following example, we’ll extend the swap space available in the /swapfile from 4 GB to 8 GB.
  5.  
  6.         Turn off all swap processes
  7.  
  8.         1
  9.  
  10.         sudo swapoff -a
  11.  
  12.         Resize the swap
  13.  
  14.         2
  15.  
  16.         sudo dd if=/dev/zero of=/swapfile bs=1G count=8
  17.  
  18.         if = input file
  19.         of = output file
  20.         bs = block size
  21.         count = multiplier of blocks
  22.  
  23.         Make the file usable as swap
  24.  
  25.         2
  26.  
  27.         sudo mkswap /swapfile
  28.  
  29.         Activate the swap file
  30.  
  31.         3
  32.  
  33.         sudo swapon /swapfile
  34.  
  35.         Check the amount of swap available
  36.  
  37.         4
  38.  
  39.         grep SwapTotal /proc/meminfo
  40.  
  41.  
  42. DONE!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement