linux_wiki:swap_files

Differences

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

Link to this comparison view

linux_wiki:swap_files [2016/03/18 23:10]
billdozor [Swap Files]
linux_wiki:swap_files [2019/05/25 23:50]
Line 1: Line 1:
-====== Swap Files ====== 
  
-**General Information** 
- 
-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): All 
- 
----- 
- 
-===== Create a Swap File with DD ===== 
- 
-Create a block file called "swapfile" in /home/ that is 1GB. 
- 
-<code bash> 
-dd if=/dev/zero of=/home/swapfile bs=1024 count=1048576 
-</code> 
- 
-Explanation: 
-  * bs: write 1024 bytes at a time (or 1K) 
-  * count: 1024K * 1024K = 1048576K (or 1GB) 
- 
-===== Format the File ===== 
- 
-<code bash> 
-mkswap /home/swapfile 
-</code>  
- 
-===== Enable the Swap ===== 
- 
-<code bash> 
-swapon /home/swapfile 
-</code> 
- 
-===== Verify Swap is Used ===== 
- 
-<code bash> 
-swapon -s 
- 
-Filename Type Size Used Priority 
-/dev/mapper/vgroot-lvswap               partition 4194300 124872 -1 
-/home/swapfile                          file 1048572 0 -2 
-</code> 
- 
-===== Enable this Swap File After a Reboot ===== 
- 
-Edit /etc/fstab and add: 
-<code bash> 
-/home/swapfile    none    swap   sw    0    0 
-</code> 
  • linux_wiki/swap_files.txt
  • Last modified: 2019/05/25 23:50
  • (external edit)