Contact Form

Name

Email *

Message *

Cari Blog Ini

Preface

Move ZFS Datasets Between ZFS Pools

Preface

This community guide article describes how to list existing datasets on a system, describes several high level dataset management tools, and includes several low level commands for copying or renaming datasets.

Exporting a ZFS Pool

You can create a pool and use the `zpool export` option on the system you create the pool on. That will "free up" the ZFS pool to allow you to import it to another system with `zpool import`.

Move Dataset to New Pool on Same Machine

We are moving the node to a new dataset on another pool on the same machine named "transfer". We can do this with `zfs send` and `zfs receive`. ``` zfs send rpool/data | zfs receive transfer/data ```

Move Dataset to New Pool on Another Machine

To move a dataset to a new pool on a different machine, you must first create a snapshot: ``` # create an optional snapshot on the source pool zfs snapshot rpool/data@pre-move # send the snapshot to the target pool zfs send rpool/data@pre-move | ssh 10.0.0.1 'zfs receive transfer/new-data' # destroy the snapshot on the source pool zfs destroy rpool/data@pre-move ```

Expanding Target Pool

If the target pool does not have enough space to hold the data, you can expand it using the `zpool add` command. For example, to add a new disk to the `tank` pool, you would run the following command: ``` zpool add tank /dev/sdc ``` Once the target pool has been expanded, you can resume the `zfs send` and `zfs receive` commands.

Deleting Existing Datasets

If the target pool already contains datasets with the same name as the datasets you are moving, you can delete the existing datasets using the `zfs destroy` command. For example, to delete the `data` dataset on the `transfer` pool, you would run the following command: ``` zfs destroy transfer/data ```

Move ZVol

To move a ZVol you would first create a snapshot of the ZVol then use the `zfs send` and `zfs receive`. ``` # create a snapshot of the ZVol zfs snapshot rpool/zvol1@pre-move # send the snapshot to the target pool zfs send rpool/zvol1@pre-move | ssh 10.0.0.1 'zfs receive transfer/new-zvol1' # destroy the snapshot on the source pool zfs destroy rpool/zvol1@pre-move ```

Rename Dataset

To rename a dataset, you can use the `zfs rename` command. For example, to rename the `data` dataset to `new-data`, you would run the following command: ``` zfs rename rpool/data rpool/new-data ```


Comments