> For the complete documentation index, see [llms.txt](https://idminer.gitbook.io/robotis/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://idminer.gitbook.io/robotis/part-1-turtlebot3/15.-ros2/15.1.-she-ding/15.1.2.-tb3-sbc-chan-ban-dian-nao-she-ding/untitled-4.md).

# 15.1.2.4. 添加 swap space

1\. 新增一個檔案，將它用於 swap

```
$ sudo fallocate -l 1G /swapfile
```

2\. 授予對檔案的 **read-write** 權限

```
$ sudo chmod 600 /swapfile
```

3\. 使用 **mkswap** 設置 Linux swap 區域。

```
$ sudo mkswap /swapfile
```

4\. 新增 swap 檔案後，啟用此檔案來使用它。

```
$ sudo swapon /swapfile
```

5\. 使用 **nano** 指令打開 **/etc/fstab** 檔案，因為 swap 區域會在 **/etc/fstab** 中列出。

```
$ sudo nano /etc/fstab
```

6\. 複製下面的句子，然後將其粘貼到您打開的檔案中。

```
/swapfile swap swap defaults 0 0
```

7\. 使用 **free** 語法來驗證 swap 區域是否已經分配。它將會顯示一個由 6 x 3 (column x row) 的數據所組成的表。

```
$ sudo free -h
```
