os:linux:create_swap_file
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
os:linux:create_swap_file [2018-02-07 10:03] – root | os:linux:create_swap_file [2024-06-26 11:58] (current) – change permissions on swap file Manuel Frei | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Linux: Create Swap File ====== | + | ====== Linux - Create Swap File ====== |
===== Short ===== | ===== Short ===== | ||
Line 5: | Line 5: | ||
< | < | ||
fallocate -l 1G /swapfile | fallocate -l 1G /swapfile | ||
+ | chmod 0600 /swapfile | ||
mkswap /swapfile | mkswap /swapfile | ||
swapon /swapfile | swapon /swapfile | ||
- | vi /etc/fstab | + | vim /etc/fstab |
</ | </ | ||
< | < | ||
- | swapfile swap swap defaults | + | /swapfile |
</ | </ | ||
+ | |||
===== Long ===== | ===== Long ===== | ||
Line 30: | Line 32: | ||
< | < | ||
root@server: | root@server: | ||
- | mkswap: /swapfile: insecure permissions 0644, 0600 suggested. | ||
Setting up swapspace version 1, size = 1024 MiB (1073737728 bytes) | Setting up swapspace version 1, size = 1024 MiB (1073737728 bytes) | ||
no label, UUID=2903a264-5dc1-484c-8e1d-b0b6f687e65a | no label, UUID=2903a264-5dc1-484c-8e1d-b0b6f687e65a | ||
Line 46: | Line 47: | ||
add: | add: | ||
< | < | ||
- | / | + | / |
</ | </ | ||
+ | |||
+ | ===== Show Status ===== | ||
+ | |||
+ | < | ||
+ | swapon --summary | ||
+ | </ | ||
+ | |||
+ | Example. | ||
+ | < | ||
+ | root@server: | ||
+ | Filename | ||
+ | / | ||
+ | </ | ||
+ |
os/linux/create_swap_file.1517994228.txt.gz · Last modified: 2018-02-07 10:03 by root