Skip to content

Feature request: moving datasets #13393

@clarfonthey

Description

@clarfonthey

Describe the feature would like to see added to OpenZFS

I would like to see the ability to live move datasets. In other words zfs rename should be able to work for mounted datasets, and zfs set mountpoint=... should be able perform some kind of mount --move operation.

Presumably, this would work recursively, transferring snapshots and child datasets.

How will this feature improve OpenZFS?

It would be extremely desirable to be able to rename or move datasets that are currently in use, for example, moving /var/log from one physical drive to another. Since it's difficult to configure an existing system to unmount these filesystems without booting into another system (it can be done, since it's done at shutdown, but it's a huge pain), letting the user simply move these datasets over would be incredibly useful. Obviously, this substantially increases the complexity of the implementation, but it could be very useful for administering systems.

Additional context

For cross-pool moves:

  1. Set a quota on the old dataset to ensure that it cannot become larger than the space of the target dataset (e.g. moving from a large volume to a smaller one). This could potentially be configurable, with the quota being the size of the data plus some "wiggle room" for extra writes.
  2. Pause all dataset-related operations on the source dataset.
  3. Create the new dataset with the same options as the old one, also with an inability to perform dataset-related operations. Make sure the dataset is unmounted and reserved with an adequate amount of space.
  4. Start copying over data from the old dataset to the new dataset.
  5. During this process, writes to the dataset are still allowed, but they may need to be throttled to ensure that the copying of old data outpaces the writing of new data.
  6. Once the datasets are synced, pause all I/O operations on the old dataset.
  7. If the dataset is mounted, modify all open files to point to the new dataset.
  8. Unmount the old dataset and put the new dataset in its place.
  9. Unpause I/O.
  10. Destroy the old dataset.

For same-pool moves, probably several of the above steps are redundant, but I'm not 100% sure how many of them are.

I think I've seen discussions of this before, but did a quick search and saw no open features here on it. Apologies if there is some existing discussion somewhere else that I didn't find.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: FeatureFeature request or new feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions