linux_wiki:swap_files

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
linux_wiki:swap_files [2015/02/03 23:41]
billdozor created
linux_wiki:swap_files [2019/05/25 23:50] (current)
Line 1: Line 1:
 ====== Swap Files ====== ====== Swap Files ======
  
-Description: Swap can be increased by resizing partitions, adding new partitions formatted as swap, or by creating swap files. Swap files are useful if you need to utilize existing volumes and cannot resize the swap partition.+**General Information**
  
-==== Create a Swap File with DD ====+Swap can be increased by resizing partitions, adding new partitions formatted as swap, or by creating swap files. Swap files are useful if you need to utilize existing volumes and cannot resize the swap partition. 
 + 
 +**Checklist** 
 +  * Distro(s): Any 
 + 
 +---- 
 + 
 +===== Create a Swap File with DD =====
  
 Create a block file called "swapfile" in /home/ that is 1GB. Create a block file called "swapfile" in /home/ that is 1GB.
  
 <code bash> <code bash>
-dd if=/dev/zero of=/home/swap bs=1024 count=1024k+dd if=/dev/zero of=/home/swapfile bs=1024 count=1048576
 </code> </code>
  
-==== Format the File ====+Explanation: 
 +  * bs: write 1024 bytes at a time (or 1K) 
 +  * count: 1024K * 1024K = 1048576K (or 1GB) 
 + 
 +===== Format the File =====
  
 <code bash> <code bash>
Line 17: Line 28:
 </code>  </code> 
  
-==== Enable the Swap ====+===== Enable the Swap =====
  
 <code bash> <code bash>
Line 23: Line 34:
 </code> </code>
  
-==== Verify Swap is Used ====+===== Verify Swap is Used =====
  
 <code bash> <code bash>
 swapon -s swapon -s
 +
 +Filename Type Size Used Priority
 +/dev/mapper/vgroot-lvswap               partition 4194300 124872 -1
 +/home/swapfile                          file 1048572 0 -2
 </code> </code>
  
-==== Enable this Swap File After a Reboot ====+===== Enable this Swap File After a Reboot =====
  
 Edit /etc/fstab and add: Edit /etc/fstab and add:
  • linux_wiki/swap_files.1423024869.txt.gz
  • Last modified: 2019/05/25 23:50
  • (external edit)