SOLVED Copy/Move dataset

Joined
Oct 2, 2014
Messages
925
I have the below configuration + screenshot; i am in the process of testing the last of my 4TB hdds to build my last RAIDz3.

Data1 > [No datasets yet]
Data2 > "Storage"
Data3> "Data" , "Data2" , "Internal"

I want it to look like:
Data1 > "Storage"
Data2 > "Data"
Data3 > "Data2" , "Internal"

Once that is complete i will have x3 RAIDz3's, named: Data1, Data2, Data3. Data1 will be my x7 4TB hdds, and Data2 and Data3 consist of x7 2TB hdds. I currently have data on all the datasets, my hope is to migrate Data2's "storage" dataset to my soon to be created Data1 "same dataset name".

Then move Data3 "Data" dataset to Data2 "same datasetname"

Pretty much i want to copy/move/suffle some datasets around, is this possible?
 

Attachments

  • Screen Shot 2015-04-02 at 10.33.29 AM.png
    Screen Shot 2015-04-02 at 10.33.29 AM.png
    31.2 KB · Views: 1,943

SweetAndLow

Sweet'NASty
Joined
Nov 6, 2013
Messages
6,421
Create the datasets where you want them copy the data into them then delete the old one. When moving or deleting large amount of data be aware of your snapshots because they can end up taking up quite a bit of space.
 
Joined
Oct 2, 2014
Messages
925
I currently have no snapshots since i knew i'd be doing this eventually lol
 

SweetAndLow

Sweet'NASty
Joined
Nov 6, 2013
Messages
6,421
Also create the datasets using the GUI and use the CLI to copy the data to the new location. This will be the fastest. Then once you verify your data and all your new shares you can delete the old datasets in the GUI.
 

mav@

iXsystems
iXsystems
Joined
Sep 29, 2011
Messages
1,428
Or, if you want to move all existing snapshots and properties, you may do something like this:
1. Create final source snapshot:
Code:
zfs snapshot -r Data2/Storage@copy

2. Copy the data:
Code:
zfs send -Rv Data2/Storage@copy | zfs receive -F Data1/Storage

3. Delete created snapshots:
Code:
zfs destroy -r Data1/Storage@copy ; zfs destroy -r Data2/Storage@copy
 
Joined
Oct 2, 2014
Messages
925
Also create the datasets using the GUI and use the CLI to copy the data to the new location. This will be the fastest. Then once you verify your data and all your new shares you can delete the old datasets in the GUI.
Is this a list of CLI commands? Or better question i guess is do you happen to know the commands? I havent tinkered with FreeNAS CLI before
 

SweetAndLow

Sweet'NASty
Joined
Nov 6, 2013
Messages
6,421
Since Darren doesn't have snapshots and hasn't used the CLI I would avoid the zfs snapshot/send/destroy method. I also don't think using zfs destroy on the cli is a good idea.
 

mjws00

Guru
Joined
Jul 25, 2014
Messages
798
No idea what is appropriate for Darren, that is up to him. But to avoid sending the whole thing over the wire will require the CLI. cp, verify, delete is likely harder to screw up.

mav@'s solution is elegant, probably one of the nicest explanations of snapshots, send/receive, cleanup I've ever seen.
 
Joined
Oct 2, 2014
Messages
925
I went ahead and tried the command zfs send -Rv Data2/Storage@copy | zfs receive -F Data1/Storage but it returned

WARNING: could not send Data2/Storage@copy: does not exist
total estimated size is 0
cannot receive: failed to read from stream
 

mav@

iXsystems
iXsystems
Joined
Sep 29, 2011
Messages
1,428
WARNING: could not send Data2/Storage@copy: does not exist

What in this phrase is not clear for you? You can not send source snapshot without creating it first, as I've told.

PS: IIRC destination dataset should also be created in advance.
 
Joined
Oct 2, 2014
Messages
925
What in this phrase is not clear for you? You can not send source snapshot without creating it first, as I've told.

PS: IIRC destination dataset should also be created in advance.
Oh oh oh....i thought since i had no snapshots that command wasnt used. I also created the new dataset. My bad i got the explanation i needed
 
Joined
Oct 2, 2014
Messages
925
Ha yea, my stupid behind got it and its working....Thank you! :D
 
Joined
Oct 2, 2014
Messages
925
Well, i got allllll my crap working, so im saving those commands thanks you very much to mav@ for that, and setting my behind straight for not following the order lol
 

maglin

Patron
Joined
Jun 20, 2015
Messages
299
I'm trying to do the same thing moving 1 dataset from one pool to another so I can destroy the source pool and rebuild with a different drive setup and then move the dataset back.

I create the snapshot and it reads the stream but I kept getting this error:
Code:
[maglin@freenas] /nonexistent# zfs send -Rv Test/media_jail@copy | zfs receive -Fv Storage/temp
full send of Test/media_jail@copy estimated size is 15.5G
total estimated size is 15.5G
TIME        SENT   SNAPSHOT
cannot receive: local origin for clone Storage/temp@copy does not exist
warning: cannot send 'Test/media_jail@copy': signal received


I've googled read the zfs man page and came up virturally empty. Can't clone into a different pool. I tried to make a snapshot on the receiving pool but I get a broken pipe error then. I don't want to rebuild this dataset as it's my jail that I spent days getting working the way I wanted it. I'm sure it's something small. Thank you.
 

mav@

iXsystems
iXsystems
Joined
Sep 29, 2011
Messages
1,428
Just as a guess, it seems like your Test/media_jail dataset was sometimes before cloned from snapshot of something else. Replication fails because receiving side has no that snapshot. You should probably either resolve that situation with clone or replicate it too first.
 

mav@

iXsystems
iXsystems
Joined
Sep 29, 2011
Messages
1,428
Just as a guess, it seems like your Test/media_jail dataset was sometimes before cloned from snapshot of something else. Replication fails because receiving side has no that snapshot. You should probably either resolve that situation with clone or replicate it too first.
 

maglin

Patron
Joined
Jun 20, 2015
Messages
299
There was some snapshots of it that I deleted before I made the copy snapshot. I can try to clone it then promote the clone. Then see if I can send and receive the clone on another pool.


Sent from my iPhone using Tapatalk
 

diskdiddler

Wizard
Joined
Jul 9, 2014
Messages
2,377
Or, if you want to move all existing snapshots and properties, you may do something like this:
1. Create final source snapshot:
Code:
zfs snapshot -r Data2/Storage@copy

2. Copy the data:
Code:
zfs send -Rv Data2/Storage@copy | zfs receive -F Data1/Storage

3. Delete created snapshots:
Code:
zfs destroy -r Data1/Storage@copy ; zfs destroy -r Data2/Storage@copy


Thanks - this thread just saved me! Appreciate.
 

djidji perroto

Dabbler
Joined
Mar 24, 2016
Messages
24
I'm having trouble trying to follow the advice in this helpful thread:
  1. create snapshot of SourceDataset in SourcePool via GUI
  2. create TargetDataset on TargetPool via GUI
  3. execute 'zfs send -Rv SourcePool/SourceDataset@snapshotname | zfs receive -Fs TargetPool/TargetDataset' and watched the CLI feedback
When I came back to my desk a couple of hours later, the GUI had logged me off. I fired up CLI once again and tried to execute the same command (hoping that the 's' option of zfs receive would help me here). Unfortunately I got the following error:
Code:
cannot receive new filesystem stream: dataset is busy
warning: cannot send 'SourcePool/SourceDataset@snapshotname': signal received

Checking the Storage/Pools section of the GUI I see only about a quarter of the size has been copied.
Any idea how to restart the job?
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
Any idea how to restart the job?
You should probably work out a few things before trying that...

1. how to use tmux so that your connection to the session isn't important for the session to continue
2. how many snapshots already made it over successfully (zfs list -t snap | grep TargetPool/TargetDataset)
3. decide based on that if it's even worth bothering with resuming an incremental snapshot
4. if it is:
zfs send -Riv SourcePool/SourceDataset@lastsucceededsnapshotname SourcePool/SourceDataset@snapshotname | zfs recv TargetPool/TargetDataset

Obviously do that in a tmux session.
 
Top