Reputation: 137
On a ZFS-enabled system I have these datasets up and running: mydataset under /mnt/mydataset, set1 under /mnt/mydataset/set1 and set2 under /mnt/mydataset/set2. There is also existing data in a regular directory under /mnt/mydataset/existing.
I whish to change the 'existing' directory into a dataset such as to enjoy zfs features like snapshots. When I create dataset /mnt/mydataset/existing, it shadows out the existing data. When I remove the newly created dataset, the old data reappears (tried this on other data, obviously).
Is there a way to add a dataset such that the existing data is comprised right away?
The obvious solution seems to be adding a dataset first and copying the existing data into it second. However, the data in question relates to a couple of jails running services in production and I am hesitant to stop them and the jails for the operation.
Upvotes: 2
Views: 4688
Reputation: 617
Moving files between ZFS file systems (that's what you called dataset) is always a full copy, even if both file systems are on the same pool. The same applies to copy from file systems to outside or from outside to file system. The only move operation that is instant (like renaming) is inside the same file system.
Although unfortunate in general, there exists an elegant alternative for those cases where you want to transmit the whole file system (not just individual files), which seems to apply to your case. It is using ZFS snapshots and incremental send/recv to transmit all content of the file system to the new one, then after it is finished (hours later), transmit the data that was since changed (takes minutes), then after that the data since changed (now may take seconds), all until you are up to date except for a very small delay. Then you shut down your applications on both sides so that nothing is changed anymore, retransmit the last difference (very quick) and then start the application on the target side again.
This way you still have downtime, but it is very short. The downside is that you have to have the additional storage space available.
Upvotes: 2