This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
swapfile [2024/04/30 21:06] – wigums | swapfile [2024/07/23 16:19] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
i dont bother with swap as ive ALMOST never needed it. if you find yourself in a situation where you do need swap just spin up a swapfile. | i dont bother with swap as ive ALMOST never needed it. if you find yourself in a situation where you do need swap just spin up a swapfile. | ||
- | create a file with the size of swap space you want. Let’s say that I want to add 1 GB of swap space to my system. Use the fallocate command to create a file of size 1 GB. | + | create a file with the size of swap space you want. Let’s say that I want to add 32 GB of swap space to my system. Use the fallocate command to create a file of size 32 GB. |
- | < | + | < |
It is recommended to allow only root to read and write to the swap file. | It is recommended to allow only root to read and write to the swap file. | ||
Line 10: | Line 10: | ||
< | < | ||
- | mkswap /swapfile | ||
You need to tell Linux that this file will be used as swap space. You can do that with mkswap | You need to tell Linux that this file will be used as swap space. You can do that with mkswap | ||
- | mkswap /swapfile | + | < |
- | < | + | You should see an output like this: |
+ | |||
+ | < | ||
no label, UUID=7e1faacb-ea93-4c49-a53d-fb40f3ce016a</ | no label, UUID=7e1faacb-ea93-4c49-a53d-fb40f3ce016a</ | ||
+ | |||
+ | Now your system knows that the file swapfile can be used as swap space. You need to enable the swap file so that your system can start using this file as swap. | ||
< | < | ||
+ | |||
+ | when youre done just do | ||
+ | |||
+ | < | ||
+ | |||
+ | if you want to reclaim your disk space just rm it | ||
+ | |||
+ | < | ||