edit metadata
This commit is contained in:
@@ -4,49 +4,47 @@ tags: [ "basics" ]
|
||||
---
|
||||
# Making a Swap File
|
||||
|
||||
```bash
|
||||
```sh
|
||||
su root
|
||||
cd /var/cache/
|
||||
```
|
||||
|
||||
```bash
|
||||
sudo dd if=/dev/zero of=swapfile bs=1K count=4M
|
||||
dd if=/dev/zero of=swapfile bs=1K count=4M
|
||||
```
|
||||
|
||||
This creates a swapfile of (1k x 4M) 4 Gigs.
|
||||
Change 4M to XM for an XGig swap.
|
||||
|
||||
```bash
|
||||
sudo chmod 600 swapfile
|
||||
```sh
|
||||
chmod 600 swapfile
|
||||
```
|
||||
|
||||
```bash
|
||||
sudo mkswap swapfile
|
||||
```sh
|
||||
mkswap swapfile
|
||||
```
|
||||
|
||||
```bash
|
||||
sudo swapon swapfile
|
||||
```sh
|
||||
swapon swapfile
|
||||
```
|
||||
|
||||
Test it's working with top
|
||||
|
||||
```bash
|
||||
```sh
|
||||
top -bn1 | grep -i swap
|
||||
```
|
||||
|
||||
or:
|
||||
|
||||
```bash
|
||||
echo "/var/cache/swapfile none swap sw 0 0" | sudo tee -a /etc/fstab
|
||||
```sh
|
||||
echo "/var/cache/swapfile none swap sw 0 0" | tee -a /etc/fstab
|
||||
```
|
||||
|
||||
Test it'll work at boot with:
|
||||
|
||||
```bash
|
||||
sudo swapoff swapfile
|
||||
```sh
|
||||
swapoff swapfile
|
||||
```
|
||||
|
||||
```bash
|
||||
sudo swapon -va
|
||||
```sh
|
||||
swapon -va
|
||||
```
|
||||
|
||||
# Partition Swaps
|
||||
@@ -57,13 +55,13 @@ Put this in /etc/fstab:
|
||||
|
||||
Then test it works with:
|
||||
|
||||
```bash
|
||||
sudo swapon -va
|
||||
```sh
|
||||
swapon -va
|
||||
```
|
||||
|
||||
Test other partitions in fstab with:
|
||||
|
||||
```bash
|
||||
sudo mount -a
|
||||
```sh
|
||||
mount -a
|
||||
```
|
||||
|
||||
|
Reference in New Issue
Block a user