Deleting files in root

Hey everybody,

I updated from FreeNas 11 to TrueNAS (13.0-U6.1) a few days ago. After learning most of the changes (for example that root no longer works for windows shares) I ran into trouble with the files on my Pool. I can access the old files, copy them, but not delete them. It says I don’t have the rights to it.
Now, I think that the original folder wasn’t set up as a Dataset back in 2017 when I built that storage, so everything might be on root. Is there a way to move those files into a new dataset, or create a dataset out of the existing folder? Or maybe using a different file-sharing like iSCSI (don’t know much about that yet)

I’m not very experienced in this. My first idea would be downgrading again (where I would be able to set up the correct structure fit for TrueNAS), or copying all files, deleting the whole pool and then copying it back (which is hard with 9TB of files and I have another, younger, pool with 30TB where I’m scared it has the same problem)

Thanks in advance!

When you say “root”, do you mean “root dataset”?

If so, you can rename the folder, create a new dataset, and then copy everything to the new dataset.

The process would look something like this:

  1. Create a checkpoint for the pool. Do not make ANY OTHER CHANGES other than this migration process until you’re 100% done:
sudo zpool checkpoint mypool
  1. Rename the folder:
sudo mv /mnt/mypool/data /mnt/mypool/data-temp
  1. Create the new dataset using the GUI. (In this example, we’ll name it “data”.)

  2. Copy everything over to the new dataset, using a tool like rsync:

sudo rsync -vahH --progress --inplace /mnt/mypool/data-temp/ /mnt/mypool/data/

(The trailing forward-slashes at the end of the paths are important. They must be exactly like that.)

  1. Confirm it looks good. Check that your files are accessible in your dataset and via an SMB share, and so on.

  2. Delete the old folder:

sudo rm -rf /mnt/mypool/data-temp
  1. Remove the checkpoint:
sudo zpool checkpoint -d mypool
1 Like

Yes, I think I mean the root dataset. I’m gonna try your approach. Thank you very much!

Be very careful.

You could end up permanently losing everything.

One more question: Does copy (step 4) mean that it will actually be copied? Because the zfs is more 80% full at this point.

Correct.

So now things got much worse.

You’ll have to use “mv” instead of “rsync”, which will delete the source files as they are copied over.

And you won’t be able to leverage a checkpoint or snapshot to safeguard against any mistakes during this migration.

This is why planning for storage and understanding ZFS before building a NAS pays dividends

1 Like

I tried and it told me that “User root is not allowed to execute /bin/mv”

In Core?

Are you logged into an SSH session as “root” or as your normal user? Are you using the root user directly, or invoking “sudo” with your normal user?

I am able to use the mv command with any user, including root, including sudo.

Do you have “Permt Sudo” enabled under the user’s account?

Accounts → Users → edit the user account → check the box “Permit Sudo”

EDIT: I really hope you have a working backup of everything.

That was the problem!

Now I’m moving the folders one by one. It works fine. Thank you very much for your help!

I noticed that I still couldn’t delete some of the folders and files I moved. It worked after I “renewed” the permissions on the new dataset and checked the “apply permissions recursively” box and saved again. Idk if this the proper way, but I don’t mind doing that one more time after everything is moved.