Copy folder in dataset to another pool

revengineer

Contributor
Joined
Oct 27, 2019
Messages
193
I am sure this has been covered but I do not seem to be able to find the right search terms. So, I appreciate help on the following: I need to copy just one folder/directory contained within a dataset to another dataset stored with another pool. Both datasets are accessible via SMB shares. The use of ZFS send/receive does not seem appropriate here because I only see to copy a fraction of the dataset.

In principle, I could do the copy from a Windows machine with both shares mounted. However, this would involve the network and be terribly slow.

In theory, "cp -R" from /mnt/media/dataset/folder to /mnt/media2/dataset/folder would do the trick, but I am not sure this would retain the Windows permission.

Again, help is greatly appreciated.

Thank you in advance!
 

Samuel Tai

Never underestimate your own stupidity
Moderator
Joined
Apr 24, 2020
Messages
5,399
cp -Rp. From the man page for cp:

Code:
     -p    Cause cp to preserve the following attributes of each source file
           in the copy: modification time, access time, file flags, file mode,
           ACL, user ID, and group ID, as allowed by permissions.

           If the user ID and group ID cannot be preserved, no error message
           is displayed and the exit value is not altered.

           If the source file has its set-user-ID bit on and the user ID
           cannot be preserved, the set-user-ID bit is not preserved in the
           copy's permissions.  If the source file has its set-group-ID bit on
           and the group ID cannot be preserved, the set-group-ID bit is not
           preserved in the copy's permissions.  If the source file has both
           its set-user-ID and set-group-ID bits on, and either the user ID or
           group ID cannot be preserved, neither the set-user-ID nor set-
           group-ID bits are preserved in the copy's permissions.
 

revengineer

Contributor
Joined
Oct 27, 2019
Messages
193
Top