# 附錄

## **docker使用 btrfs 檔案系統**

**停止Docker。**

**將內容複製/var/lib/docker/到備份位置，然後清空以下內容/var/lib/docker/：**

**sudo cp -au /var/lib/docker /var/lib/docker.bk**\
**sudo rm -rf /var/lib/docker/\***\ <br>

**使用gparted將專用塊設備格式化為Btrfs文件系統。此示例假定您使用兩個名為/dev/sda2。這是一種破壞性操作。**

<img src="https://lh6.googleusercontent.com/WMTAHb2Gu7cgaC_0p1ykzkNCA7A5pEth404Blmk3oT9vtPPyKnjVyaC0G-yA6l2kXUJrdUHZqZoJ6LGSlEf-HCPGc5jO7nMlerPzbcBt_rhcge7NHjDkTXGIR0Xfug31LOoU5G_a" alt="" data-size="original">

**Btrfs還有更多選項，包括條帶化和RAID。請參閱** [**Btrfs文檔**](https://btrfs.wiki.kernel.org/index.php/Using_Btrfs_with_Multiple_Devices)**。**

**在/var/lib/docker/掛載點上掛載新的Btrfs文件系統。您可以指定用於創建Btrfs文件系統的任何塊設備。**

**sudo mount -t btrfs /dev/sda2 /var/lib/docker**\ <br>

**不要忘記通過添加條目來重新啟動更改/etc/fstab。**

**複製的內容/var/lib/docker.bk來/var/lib/docker/。**

**sudo cp -au /var/lib/docker.bk/\* /var/lib/docker/**

**配置Docker以使用btrfs存儲驅動程序。即使/var/lib/docker/現在使用Btrfs文件系統，這也是必需的。編輯或創建文件/etc/docker/daemon.json。如果是新文件，請添加以下內容。如果它是現有文件，則僅添加鍵和值，如果它不是結束花括號（}）之前的最後一行，則小心使用逗號結束該行。**

**{"storage-driver":"btrfs"}**

**啟動Docker。運行後，請驗證是否將btrfs其用作存儲驅動程序。**

```
docker info

Containers: 0
 Running: 0
 Paused: 0
 Stopped: 0
Images: 0
Server Version: 17.03.1-ce
Storage Driver: btrfs
 Build Version: Btrfs v4.4
 Library Version: 101
```

## **開機啟動**

**blkid /dev/sda2**

**vi /etc/fstab**

```
UUID=0a6d0b62-b798-42f0-9428-441a2898e7e5 /var/lib/docker btrfs defaults 0 0

```

<br>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://kawsing.gitbook.io/opensystem/docker-cong-an-zhuang-dao-ying-yong-ru-men-pian/fu-lu.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
