Copying data from one dataset to another

This has been asked REPEATEDLY, so I know I’m going to get the standard “did you google it” reply… Well, I did! I googled the crap out of this one and I’m getting a LOT of hits that have nothing to do with my situation, and some that only partially match.

My company had an ancient windows 2012 (NOT r2) file server. it decided to die on saturday. I’ve been able to restore it’s filesystem to a dataset in truenas.

The restored data is located in /mnt/store-0/olddeadserver/ (which is the dataset)

Within that dataset there are 2 folders I wish to break out into their own datasets, but for permissions purposes, the contents need to be broken up into child datasets.

for this post, those folders are:
/mnt/store-0/olddeadserver/data/share1/(subfolders to be made into individual datasets)
this share1 folder has been created as it’s own dataset: /mnt/store-0/share1/(subfolder datasets)

I’m simply trying to copy files and folders from one dataset to the other thusly:

cp /mnt/store-0/olddeadserver/data/share1/subfolder1 /mnt/store-0/share1/ -var

and I get back the following error (repeated for every file and folder) cp: clearing permissions for '/mnt/store-0/olddeadserver/data/share1/subfolder1/anothersubfolder/adeeperfolder/file.name': operation not permitted.

This is annoying… but the files copy… except… when the error is on a folder, it stops copying files into said folder and moves on leaving an EMPTY FSCKING FOLDER!!!

I’m a little frustrated by this because I have to run the command over and over for every nested folder depth… the old file server was made more than 10 years ago… Its lousy with subfolders!

Rsync is useless, it not only wont copy contents of a folder it cant change the permissions for, it wont create the parent directory so it just wont go any farther.

I KNOW this is caused by using cp to move data arround where ACLs exit… so how the FRACK do I get around that? How am I supposed to move this data???

I would run the cp as root (sudo cp) and use the -p option to preserve permissions. sudo cp -pr <src directory> <dst directory>
cp should handle the ACLs correctly.

I tend to use cp -a source dest as it preserves perms, does no dereference, and, recursive.

In theory, Unix cp -a with the ZFS feature Block Cloning should be the fastest because it’s not copying the data, only the metadata. Whence confirmed the destination is good, erase the source.

Now my experience with the new ZFS feature Block Cloning is quite limited. So, I wrote “in theory”. It might be needed to verify that the block cloning feature is both available, (see below), and working.

> zpool get all rpool | grep clon 
rpool  bcloneused                     0                              -
rpool  bclonesaved                    0                              -
rpool  bcloneratio                    1.00x                          -
rpool  feature@block_cloning          enabled                        local

1 Like

Sorry guys, none of your suggestions worked. only the error changed slightly to
cp: setting permissions for '/mnt/store-0/olddeadserver/data/share1/subfolder1/anothersubfolder/adeeperfolder/file.name': operation not permitted.

It LOOKS like I was able to get through it using this
rsync -ravz --no-perms [source] [dest]

I haven’t found missing files anyway… But then again, I’ve had to run the first command mentioned a dozen times already so I might have just been at the bottom of the tree depth.