SOLVED rename and move dataset with odd characters

Status
Not open for further replies.

nojohnny101

Wizard
Joined
Dec 3, 2015
Messages
1,478
I have search the internet extensively but believe my problem is unique. I'll try to keep it short but I need to provide a little background.

I recently expanded my main pool from 4x3tb RAIDz2 to a 6x3tb RAIDz2. I am now replication via snapshots from the backup freenas system that I have to the main box with the new setup.

The problem I'm having is I want to restore my original structure tree but am having trouble doing so.

Here is what I get when I replicate on of my datasets from the backup box to the new box:

main box.png

I want it to look like this:

axio>axio>nicole

So I want to do multiple things. Rename the dataset "backup/nicole" to "nicole" and then move it out of the dataset "backup" to the "axio" dataset.

I am getting errors when using the "zfs rename" command because it thinks the "/" in the name is a file path and thus doesn't exist.

Would really appreciate sorting this out.
 
Last edited:

Bidule0hm

Server Electronics Sorcerer
Joined
Aug 5, 2013
Messages
3,710
Have you tried to use "backup\/nicole"?
 

nojohnny101

Wizard
Joined
Dec 3, 2015
Messages
1,478
I have, still gives me "does not exist"

here is the command I'm using:

Code:
zfs rename axio/backup/backup\/nicole axio/backup/nicole
 

depasseg

FreeNAS Replicant
Joined
Sep 16, 2014
Messages
2,874
What's the output of zfs list?

I just did a quick test and it worked, but I created the nested dataset in freenas, it wasn't replicated into it. maybe that makes a difference in the zfs listing structure.
 

nojohnny101

Wizard
Joined
Dec 3, 2015
Messages
1,478
well I think you are on to something @depasseg

here is the output:
zfs list output.png
 

nojohnny101

Wizard
Joined
Dec 3, 2015
Messages
1,478
ok so I redid the command referencing the output list and it worked. As I referenced above, I also wanted to move the data so it is just: axio>nicole.

It seems I did this, but I'm confused how easy it was. It just seems like it changed a "reference" or "pointer", not the actual data?

here is the result:
zfs list output change.png
 

depasseg

FreeNAS Replicant
Joined
Sep 16, 2014
Messages
2,874
I'm not exactly sure how it works, but I think your guess of pointer-like renaming is close. Glad you are in business.
 

titan_rw

Guru
Joined
Sep 1, 2012
Messages
586
Datasets behave a lot like separate filesystems. Where they are located "/mnt/tank/dataset" is just a mount point. The mount point can be changed basically instantly without actually reading / writing data.
 

depasseg

FreeNAS Replicant
Joined
Sep 16, 2014
Messages
2,874
He was changing the dataset name/structure, not the mount point. But that is a good point about how easy that is to change as well. :smile:
 

nojohnny101

Wizard
Joined
Dec 3, 2015
Messages
1,478
thanks guys. purely academic question then, why would someone use the mv or cp commands to move/copy data within a dataset? seems like changing the name and hence the mount point?

and @depasseg it seems i did change the mount point with the "zfs rename" command, if you compare the results. both the mount point and the NAME changed.
 

depasseg

FreeNAS Replicant
Joined
Sep 16, 2014
Messages
2,874
mv and cp work the same way, but they are working within the file system. If you mv /home/johntravolta/myawesomestuff/ to /home/johntravolta/zeddsdead/ the filesystem is just changing the directory name. However, because we were dealing with datasets, then we needed to use the zfs tools to move/rename the dataset. And yes, renaming the dataset will automatically change the mount point.
 

nojohnny101

Wizard
Joined
Dec 3, 2015
Messages
1,478
great! funny I never found this explanation in other threads on here when people asked about moving data between datasets. seems like the simple rename command is much simpler than the other suggestions which ranged from zfs send / zfs receive to rsync and others....

thanks!
 

Bidule0hm

Server Electronics Sorcerer
Joined
Aug 5, 2013
Messages
3,710
Excepted if the other dataset already have some data...
 

nojohnny101

Wizard
Joined
Dec 3, 2015
Messages
1,478
Excepted if the other dataset already have some data...

yes I suppose that would be a situation where "zfs rename" would not be applicable.
 
Status
Not open for further replies.
Top