Clone one zpool to another

Status
Not open for further replies.

Pete248

Dabbler
Joined
Sep 6, 2012
Messages
16
I have a zpool "pool1" with a dataset "data" and periodic snapshots:

data@auto-20150120.1900-4w
data@auto-20150120.2000-4w
data@auto-20150121.0103-6m
data@auto-20150121.0800-4w
data@auto-20150121.0900-4w
data@auto-20150121.1000-4w
data@auto-20150121.1100-4w
data@auto-20150121.1200-4w
data@auto-20150121.1300-4w
data@auto-20150121.1400-4w
data@auto-20150121.1500-4w
data@auto-20150121.1600-4w
...

I've added a second zpool "pool2" (newer, bigger harddrives) and like to copy the dataset including all off the periodic snapshots to pool2. In the end I want to use pool1 for other stuff and use pool2 the way I used pool1 before.

I already know, there are the zfs send / zfs receive commands for this, but I'm struggling with the correct syntax.

I've tried
zfs send -R pool1/data@auto* | zfs receive pool2
but got
zfs: No match.

With
zfs send -R pool1/data | zfs receive pool2
I've got
Error: Unsupported flag with filesystem or bookmark.

zfs send pool1/data@auto-20150121.1600-4w | zfs receive pool2/data
works but it would be a hazzle to copy every single snapshot individually.

Any help would be appreciated
 
Last edited:

Pete248

Dabbler
Joined
Sep 6, 2012
Messages
16
Ok, got it ...

I have to use the last snapshot with the -R switch:

zfs send -R pool1/data@auto-20150121.1600-4w | zfs receive -F pool2/data

Currently it is creating all the snapshots starting with the oldest. :smile:

Still one question remaining: When all snapshots are transferred but pool1 already got some new snapshots, can I reissue the command with the now lastest snapshot? Will that just transfer the missing snapshots or start the whole transfer from scratch, deleting all existing snapshots on pool2 while transferring them again?
 

Pete248

Dabbler
Joined
Sep 6, 2012
Messages
16
Once again answering my own question ...

For the additional transfers I have to use

zfs send -RI pool1/data@auto-20150121.1600-4w pool1/data@auto-20150122.1200-4w | zfs receive -F pool2/data

That means after the -RI you specify the latest snapshot you already received and the newest, that exists on you source. Every snapshot between is copied and the newest will become that current dataset.
 
Status
Not open for further replies.
Top