ewhac
Contributor
- Joined
- Aug 20, 2013
- Messages
- 177
I'm not quite grokking the semantics of copying datasets around using
As I understand it,
Every time I've tried it,
"cannot receive new filesystem stream: destination 'foo/bar/dataset' exists. must specify -F to overwrite it". Yeah, I know it exists, I'm trying to fill up that dataset with files.
The experiment I tried went as follows:
Okay, not what I expected, but the files are here and, after fixing up some ownership issues, was ready to move them into their final home of
Reading the man page,
To solve the immediate problem, I suppose I could create a snapshot on
zfs send
and recv
. Specifically, I think my familiarity with rsync is causing me confusion when thinking about copying datasets.As I understand it,
zfs send
and recv
operate on snapshots. This seems simple enough: Create snapshot of source dataset, zfs send
it to a stream (over the network), zfs recv
the stream into a destination dataset. That dataset then acquires a new snapshot. "Rollback" the destination dataset to that snapshot. Poof! You've replicated the dataset. Except...Every time I've tried it,
zfs recv
creates new datasets, rather than tacking snapshots onto existing ones. If I specify an existing dataset, an error is reported: "cannot receive new filesystem stream: destination 'foo/bar/dataset' exists. must specify -F to overwrite it". Yeah, I know it exists, I'm trying to fill up that dataset with files.
The experiment I tried went as follows:
- Using the GUI, create a recursive snapshot against the source dataset (
tank/home/user
), named itxfer-test
. - Using the GUI, create a dataset on the destination machine (
tank/recvtest
). - On the source machine:
zfs send -Rv tank/home/user@xfer-test | mbuffer -s 128k -m 1G -O [X.X.X.X]:9090
- On the destination machine:
mbuffer -4 -s 128k -m 1G -I 9090 | zfs receive -Fd tank/recvtest
tank/home/user
to appear underneath tank/recvtest
. Instead, two new datasets appeared -- tank/recvtest/home
and tank/recvtest/home/user
-- with the files appearing under the latter.Okay, not what I expected, but the files are here and, after fixing up some ownership issues, was ready to move them into their final home of
tank/home/user
(same as on the source machine). So I thought to use zfs send
again to ensure all metadata got transferred. I created a new non-recursive snapshot named bouncehouse (containing all the ownership fixes) and attempted to send it over. And that's where I bumped into "dataset exists" errors (note I'm not sending with the -R
flag in this case):Code:
root@freenas# zfs send tank/recvtest/home/user@bouncehouse | zfs recv -nv tank/home/user cannot receive new filesystem stream: destination 'tank/home/user' exists must specify -F to overwrite it warning: cannot send 'tank/recvtest/home/user@bouncehouse': signal received
Reading the man page,
zfs receive -F
says:Code:
-F Force a rollback of the file system to the most recent snapshot before performing the receive operation. If receiving an incremental replication stream (for example, one generated by "zfs send -R {-i | -I}"), destroy snapshots and file systems that do not exist on the sending side.
To solve the immediate problem, I suppose I could create a snapshot on
tank/home/user
(it's effectively empty at the moment) and then supply the -F
flag. But clearly I'm not understanding some underlying concepts about what zfs send/recv are actually doing that would make such a rollback necessary (again, my thinking is probably clouded by trying to think of it in terms of rsync
). Can someone point me in the right direction?