Differences
This shows you the differences between two versions of the page.
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): Any | ||
- | |||
- | ---- | ||
- | |||
- | ===== Create a Swap File with DD ===== | ||
- | |||
- | Create a block file called " | ||
- | |||
- | <code bash> | ||
- | dd if=/ | ||
- | </ | ||
- | |||
- | Explanation: | ||
- | * bs: write 1024 bytes at a time (or 1K) | ||
- | * count: 1024K * 1024K = 1048576K (or 1GB) | ||
- | |||
- | ===== Format the File ===== | ||
- | |||
- | <code bash> | ||
- | mkswap / | ||
- | </ | ||
- | |||
- | ===== Enable the Swap ===== | ||
- | |||
- | <code bash> | ||
- | swapon / | ||
- | </ | ||
- | |||
- | ===== Verify Swap is Used ===== | ||
- | |||
- | <code bash> | ||
- | swapon -s | ||
- | |||
- | Filename Type Size Used Priority | ||
- | / | ||
- | / | ||
- | </ | ||
- | |||
- | ===== Enable this Swap File After a Reboot ===== | ||
- | |||
- | Edit /etc/fstab and add: | ||
- | <code bash> | ||
- | / | ||
- | </ |