Moving directories between datasets

Status
Not open for further replies.

pincorrect

Dabbler
Joined
Jan 2, 2017
Messages
38
I have copied data from an ancient (0.7) FreeNAS server to my 9.10 server. I would like to move some of the directories I copied to a different dataset in the same pool. From a shell, I see the pool is mounted as /mnt/my-pool, and the datasets are /mnt/my-pool/ds-1, /mnt/my-pool/ds-2, etc. (not the actual names). The data I copied is in /mnt/my-pool/ds-1/dir-1, /mnt/my-pool/ds-1/dir-2, etc. Can I move dir-1 to /mnt/my-pool/ds-2 simply by using a mv command in a shell?

Second question. I had trouble getting rsync to work, so I moved the files to the new server using scp. On the old system, the owner/group for the files were bill/house. I also had a user bill on the new system (but actually not the house group, the default group for bill on the new system was my-house). I ran the scp from a root shell from the console, and specified the -p option to scp. But it made root the owner of the copied files, with the group my-house. The group is fine, but I should probably change the owners to bill. Can I use the chown command to do this, or is it better to do it in the FreeNAS gui? Are there extended acl's that chown would not fix? I have other users on the new FreeNAS, and I want to give them rights also.
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
Can I move dir-1 to /mnt/my-pool/ds-2 simply by using a mv command in a shell?
Generally, yes. Datasets are treated as independent filesystems, so mv in this will copy everything over, then remove the originals.
 

pincorrect

Dabbler
Joined
Jan 2, 2017
Messages
38
If ZFS acts like other *nix file system, the mv (move) command should be nearly instantaneous, as it only needs to unlink the "dir-1" object from the "ds-1" directory and link it to the "ds-2" directory, without copying or removing any of the files under dir-1. But I did not know if there were any subtleties about permissions or other stuff that would need to be dealt with. The two datasets in question have basically the same set of permission settings. It does look like the files copied from the old server with scp don't have the right permissions, as they are now owned by root. So I will need to fix that up.
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
If ZFS acts like other *nix file system, the mv (move) command should be nearly instantaneous, as it only needs to unlink the "dir-1" object from the "ds-1" directory and link it to the "ds-2" directory
Datasets aren't directories, they're separate filesystems. So, no, it wouldn't be near-instantaneous.
 

pincorrect

Dabbler
Joined
Jan 2, 2017
Messages
38
Thanks. Got it. As long as it’s safe to move the files between the datasets using the mv command in a shell on the server, it will be better than moving them via a client pc.

But before I move them, should I fix up the ownership and permissions of the files, as the scp command left them? And is that ok to do with chown and chmod, or should I do it from the FreeNAS gui?
 
Status
Not open for further replies.
Top