# Управление пулами ZFS

Поскольку `ZFS` - это детище `Sun Microsystems`, впоследствии портированное во многие операционные системы, то управление пулами будет аналогичным.

## Создание пулов

Создание пула из одного диска

```bash
zpool create zroot da0
```

Создание пула из двух дисков с увеличением дискового пространства (`stripe`)

```bash
zpool create zroot da0 da1
```

Создание пула из двух дисков с дублированием данных (`mirror`)

```bash
zpool create zroot mirror da0 da1
```

## Изменение названия пула

Если пул используется как загрузочный, то операции необходимо выполнять загрузившись с другого носителя.Экспорт под старым названием

```bash
zpool export oldname
```

Импортирование с переименованием

```bash
zpool import oldpool newpool
```

Если точка монтирования пула указана как `/`, то можно воспользоваться флагом `-R` `/path/to/altroot`. Возможно также понадобится флаг `-f`, если пул использовался в другой операционной системе.

```bash
zpool import -R /mnt -f oldpool newpool
```

Экспорт переименованного пула

```bash
zpool export newpool
```

И напоследок, импорт пула под новым именем

```bash
zpool import newpool
```

## Восстановление работоспособности пула

Замена диска

```bash
 zpool replace zroot da0
```

Дополнительным параметром можно указать какой диск использовать для замены

```bash
 zpool replace zroot da0 da2
```

## Ссылки

<https://ru.wikipedia.org/wiki/ZFS>\
<https://forums.freebsd.org/threads/46300/>


---

# 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://b.om.ua/filesystems/zfs/zfs-pool-management.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.
