Moving ZFS dataset into an other

Status
Not open for further replies.

bfasauer

Dabbler
Joined
Jan 5, 2014
Messages
25
Hello,
after building my first FreeNAS I started to set up ZFS datasets. Now I wonder if I can move existing ZFS datasets into another already existing ZFS dataset with all its data (change the hierarchy)?

For better understanding:

Now:
/mnt/volume1/dataUser1/
/mnt/volume1/dataUser2/
/mnt/volume1/dataUser3/

Wanted:
/mnt/volume1/data/
/mnt/volume1/data/dataUser1/
/mnt/volume1/data/dataUser2/
/mnt/volume1/data/dataUser3/

Is this possible without having to set up new 'dataUserX'-datasets and deleting the existing ones?

Thanks a lot for answers!
 

Dusan

Guru
Joined
Jan 29, 2013
Messages
1,165
Is this possible without having to set up new 'dataUserX'-datasets and deleting the existing ones?
It is possible :). Run this in the CLI to move the datasets:
[panel]zfs rename -p volume1/dataUser1 volume1/data/dataUser1
zfs rename volume1/dataUser2 volume1/data/dataUser2
zfs rename volume1/dataUser3 volume1/data/dataUser3[/panel]
 

raidflex

Guru
Joined
Mar 14, 2012
Messages
531
This should be a sticky if it is not already in the wiki. Great info.

Sent from my SCH-I535 using Tapatalk
 

diedrichg

Wizard
Joined
Dec 4, 2012
Messages
1,319
Yes. Yes, I'm resurrecting this 3-year-old thread because it seriously just saved me HOURS of work! I had searched prior to making some dataset replications but didn't find this thread. I was then forced to do snapshots/send/receive to clone my datasets from \child to parent\child. I was then stuck with a dataset that was the same size as my free space. Clearly I couldn't do a snapshot/send/receive, I would have used every bit of free space and may have not been able to delete the parent dataset if it had even completed. I then ran across this thread and it seriously took only 3 seconds for the "relocation" to occur. Thank you, thank you, thank you @Dusan (if you're still around).
 
Last edited:
Status
Not open for further replies.
Top