Copy folder form one pool to another via shell - strange behaviour

For some background - have 2 pools with around 12TB in each, one is empty just created and other one is old with around 8TB of data. My intention was to copy all the data to new pool before sorting out and tidying-up old data (basically didn’t want to delete anything by mistake, so wanted to have full additional back-up).

I have used following command in shell - “cp Rp- from /mnt/pool1/nas1/Sorted to /mnt/pool2/nas2/Sorted”.

got error - “from: no such file or directory”

What is confusing:

  1. there are indeed such files and directories in both pools.
  2. it actually started copying the data, I just didn’t realised it at the time (because of said error) and closed shell window and it stopped copying, but in those maybe 5 minutes when shell window was still open it did copy like 260GB of data.

So the questions I have:

  1. what command should I use just to copy this folder?
  2. why did it say “no such file/directory” implying comand failed, but actually started copying data.
  3. is there any parameter that could show the status of data trasnsfer, like speed, completion etc?
  4. Thanks

Did you consider using a replication task?

There are syntax errors in the command line you posted.
Review the MAN cp page for the OS you are using.
“from” and “to” are superflous. “from” is probably generating the error you see. After that it just looked for the next path to process,
cp -Rp not cp Rp-

1 Like

Yes I have, and it looked more complicated than necessary.

In principle I just want to copy one folder exactly as it is in Windows from one “disk” to another. Using SMB Share and copying it via Windows client it just takes forever (for unclear reasons as well, it is not the netwrok issue, but for some reason Trunas server just get’s stuck on single core for each file).

Also - I just interested to know why shell would say “nope”, but then do it anyway. Is this sort of thing common?

Thanks, yes it was cp -Rp, I just typed it wrongly in my question as for some reason I can’t copy out of shell (with ctrl+insert, I can paste with shift+insert)…

Anyway, I am clearly newbie when it comes to shell commands in truenas, but what confused me the most is not that I can’t properly type the command, but that copying process actually started despite error.

I can’t understand how the command should look then?

Should it be just “cp -Rp /mnt/pool1/nas1/Sorted**[space]**/mnt/pool2/nas2/Sorted”?

In which case - I tried it and it still give me error that “/mnt/pool2/nas2/Sorted is not a directory”, despite the fact it 100% is a directory.

CORE or SCALE?

Sorted is a dataset, not a directory. You have to use ZFS replication to duplicate it on another pool, which can be easily done via the WebUI as suggested by @ABain.

Core.

The exact response was “not a file or directory”, so I thought “directory” = folder.

No mean to disrespect, but “easily done” in my book is pressing copy and then pressing paste. I honestly tried to understand how replication is done, but it is way way way way overcomplicated and not what I need, half way trough the tutorial I already lost the plot and could not understand what I am even reading… in short - anything that need such extensive tutorial, setting up admin roles, scheduled snapshots is anything but “easily done”.

I do understand that this may come handy for some advanced users, who need periodic back-ups… I don’t need any of that… in my simple mind I have basically C disk and D disk, I just want to copy 1 folder, once. Replication is non-starter… doing copy over SMB takes like 8 days.

I hope there is simpler way than replication and that doesn’t take 8 days.

Replication happens locally, so much faster than SMB.
You have to:

  1. Create a manual snapshot (Storage > Snapshots) of your dataset /mnt/pool1/nas1/Sorted
  2. Create a new Replication Task (Tasks > Replication Tasks) with source and location set as On this System.
  3. Select your Source (dataset you want to replicate) and Destination Location (where you want the copy to be)
  4. Click Next, set Run Once, unset Make destination Read-only
  5. Start Replication.

This can easily be done from SSH as well, but doing so would not comply with your clicky requirement.

But what you want to copy is not a folder, it’s a dataset… an entire different thing. A dataset is a miniature ZFS system on its own, you cannot easily copy and paste it… if it were a simple folder your previous cp command would have been enough.

Clicky requirement is just illustration…

I think there is one more restriction on setting replication task, because it will take extra space and probably will push storage to 80% utilisation.

I have done cp again today and it just worked, didn’t even changed anything, just pressed-up in shell, then enter on same command and it is copying. Not the fasted thing in the world but 260MB/s is certainly better than 100Mbps over the wire… I just need to remember not to close the browser for like 8 hours now. Probably should have thought about setting-up VM before doing it…

Thanks anyway - replication may come handy later, for now I just need to move data dump to another data dump.

… as any copy command will do?

You should be using SSH and tmux for these tasks.

1 Like

tmux

Come back later…

tmux a

Moving data takes the time it takes, but replication is guaranteed to be the fastest way with ZFS.
It’s not that difficult to set up a replication task in the GUI. Set type to “local”, select source and destination. Run it manually as a one off rather than on schedule.