Transferring data old disk to new one.

K.J

Explorer
Joined
Apr 3, 2021
Messages
84
Would like your advice.
What is the fastest way to transfer the complete data from an old drive to a new one ?
It seemed to me that via replication tasks would be the quickest way.
Is this a good idea? See pictures.
 

Attachments

  • x.jpg
    x.jpg
    191.4 KB · Views: 495
  • xx.jpg
    xx.jpg
    143.1 KB · Views: 451
Joined
Dec 29, 2014
Messages
1,135
As always, the answer is: it depends. Are you talking about drives in the same machine, or different machines? I would probably go command line in either case, but I am a CLI kind of guy. Replication like rsync or zfs send are certainly options as well.
 

K.J

Explorer
Joined
Apr 3, 2021
Messages
84
Hello @Elliot Dierksen thanks for your response,

These are discs in the same treunas machine.
The old data needs to go from one disk to three disks that are in raidz setup.

Sorry but via cli line is going a bit too far for me.
Am already very happy to have treunas running with help from this great forum.
 
Joined
Dec 29, 2014
Messages
1,135
The CLI isn't as bad as you might think. :smile: If you already have your new pool and appropriate datasets built, you code easily do this.
Code:
cd /mnt/oldpool
find . -print | cpio -pvdm /mnt/newpool

That would create directories, copy files with verification, and attempt to preserve modification times.
 

QonoS

Explorer
Joined
Apr 1, 2021
Messages
87
Should work, just "read only" checkmarked makes no sense to me.
 

K.J

Explorer
Joined
Apr 3, 2021
Messages
84
Hey @QonoS

You say that could not be a problem because via replication tasks make a complete one to one copy ?
Read only should indeed be off. Am the only user on the system.
 

QonoS

Explorer
Joined
Apr 1, 2021
Messages
87
Yes, if I am not mistaken TrueNAS replication uses zfs-send and zfs-receivce "under the hood", which is what the other guys recommended too and generally the best way to move data. You just do not need to fiddle around with CLI/Shell. ;-)

Roughly speaking it works like this: (1) A snapshot - lets call it "snap-mig" - of the original data is made. (2) "snap-mig" is being transfered to the new zpool. For a single dataset it would be like this:
oldpool/dataset1@snap-mig >>> newpool/dataset1
If you have multiple dataset as it seems than this happens for every dataset.

Just try it out. Replication won't harm your original dataset.
 

NugentS

MVP
Joined
Apr 16, 2020
Messages
2,947
The attached script is one I used to "churn" my datastore when I added a special vdev to it. Basically I need to move all the data to a new datastore so the special vdev could start working. Whilst YMMV (and I hope I got it right) it worked and does indicate how to move things around


Code:
zfs snap BigPool/SMB/Archive@migrate
zfs send -R BigPool/SMB/Archive@migrate | zfs recv -F BigPool/SMB/Archive_New
zfs snap BigPool/SMB/Archive@migrate2
zfs send -i @migrate BigPool/SMB/Archive@migrate2 | zfs recv -F BigPool/SMB/Archive_New
zfs destroy -rf BigPool/SMB/Archive
zfs rename -f BigPool/SMB/Archive_New BigPool/SMB/Archive
 
Top