Skip to content

Commit fcae078

Browse files
committed
updated guide to increase the swap size
1 parent 720d993 commit fcae078

File tree

1 file changed

+26
-6
lines changed

1 file changed

+26
-6
lines changed

docs/100-hardware/post_installation.md

+26-6
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,41 @@ title: Post installation guide
44

55
# Linux SWAP size increase
66

7-
TODO
7+
When compiling the workspace on a machine with multiple cores, the memory gets full quite fast, which leads to freezing of the whole OS.
8+
One solution is to build with less threads using the `-j` compile flag (e.g. `catkin build -j4`)
9+
Other solution is to increase the size of the swap file, which extends the available memory for the build process.
10+
11+
Perform these steps to increase the size of the swap file.
812

913
```bash
10-
~/git/uav_core/miscellaneous/scripts/set_swap.sh
11-
```
12-
OR
13-
```bash
14+
# Turn swap off
15+
# This moves stuff in swap to the main memory and might take several minutes
1416
sudo swapoff -a
17+
18+
# Create an empty swapfile
19+
# Note that "1M" is basically just the unit and count is an integer.
20+
# Together, they define the size. In this case 16GiB.
1521
sudo dd if=/dev/zero of=/swapfile bs=1G count=16
22+
23+
# Set the correct permissions
1624
sudo chmod 600 /swapfile
17-
sudo mkswap /swapfile
25+
26+
# Set up a Linux swap area
27+
sudo mkswap /swapfile
28+
29+
# Turn the swap on
1830
sudo swapon /swapfile
31+
32+
# Check if the swap is now the desired size
1933
grep SwapTotal /proc/meminfo
2034
```
2135

36+
To make the changes permanent (persist on restarts), add this line to the end of your `/etc/fstab`:
37+
38+
```bash
39+
/swapfile none swap sw 0 0
40+
```
41+
2242
# Disabling automatic sleep/hibernation
2343

2444
TODO

0 commit comments

Comments
 (0)