Optimum way to copy files between local datasets inside same pool (TrueNas 12.0-U7)

estebanraso

Cadet
Joined
Oct 6, 2018
Messages
5
Hi. I want to copy the content:
  • from the folder "/mnt/BACKUP/iocage/jails/plex/root/Plex Media Server"
  • to another folder located in "/mnt/BACKUP/iocage/jails/plexmediaserver/root/Plex Media Server".
  • Both inside the same POOL.

1642987650816.png


¿Wich is the optimum way to do so? it's only 7GB of data.

I'm using TrueNas 12.0-U7
 

Kris Moore

SVP of Engineering
Administrator
Moderator
iXsystems
Joined
Nov 12, 2015
Messages
1,471
Lots of ways to skin that cat.

You could do something like:

cp -r '/mnt/BACKUP/iocage/jails/plex/root/Plex Media Server/' '/mnt/BACKUP/iocage/jails/plexmediaserver/root/Plex Media Server/'

Alternatively, you can use rsync as well. Quick google will give you all kinds of examples of this.
 

estebanraso

Cadet
Joined
Oct 6, 2018
Messages
5
Lots of ways to skin that cat.

You could do something like:

cp -r '/mnt/BACKUP/iocage/jails/plex/root/Plex Media Server/' '/mnt/BACKUP/iocage/jails/plexmediaserver/root/Plex Media Server/'

Alternatively, you can use rsync as well. Quick google will give you all kinds of examples of this.
I know, I've searched a little. BUT each way has it's own peculiarities.

  • I've read rsync uses the network, wich should be not necessary in this case because it's local. I don't know what advantaje it has over a simple copy.
  • cp command doesn't copy hidden files I've also read.
  • I don't know how any of these methods affect the permissions neither.
I was hoping someone with more experience could make that desition for me. Taking all positives and negatives into account for my specific task.
 

jgreco

Resident Grinch
Joined
May 29, 2011
Messages
18,680
I've read rsync uses the network,

People write dumb things all the time. If you specify a network target, then, well, yes, obviously rsync will go over the network. If you do not specify a network target, then, well, why the hell would rsync go over the network? :smile:

rsync's advantage is that it can be told to optimize for all sorts of interesting cases, such as minimizing bandwidth, or disk I/O, or various levels of paranoia, transformations, inclusions, exclusions, and all sorts of amazing crap. It is a Swiss army knife of sorts.

cp command doesn't copy hidden files I've also read.

The second dumb thing you've read, alas. :-( May I suggest you please consider the places you've been finding these informative bits to be ... well, bad places for information.

For a UNIX newbie, if you try to "cp * target/" then it is actually the shell expansion of "*" which does not capture dot-files ("hidden" files). cp itself doesn't give a damn.

I don't know how any of these methods affect the permissions neither.

However you tell them to. Both cp and rsync can preserve or discard source file permissions.

The main problem with tools is that there's a bunch of finicky details about the exact flags you want to use, and this really depends on the job. There are also numerous tools to do this kind of thing; Kris is right:

Lots of ways to skin that cat.

I personally tend to use tar, just because it tends to preserve permissions/ownerships in ways I appreciate, and rsync is a relatively new tool (only 25 years old or so).
 
Top