# ZFS: Moving jail from subdirectory to dataset



## freebuser (Jan 15, 2022)

Hi All,

Happy New Year.

Question: 
I have installed a couple of jails in two directories inside a dataset say *tank/jails*/jail1 and *tank/jails*/jail2
*tank/jails* is the dataset and jail1 and jail2 are directories.

Now to make snapshot management easier, I have created all my other jails in separate datasets tank/jails/jailA, tank/jails/jailB.. etc.

How can I move the jails I created under the directories into its own dataset i.e transfer from tank/jail/jail1 to tank/jails/jailC.

jailC is already created.

Thanks.


----------



## Lamia (Jan 15, 2022)

Simply copy the files and folders to the mountpoint of tank/jails/jailC. Make sure your jail.conf is updated to reflect the new location of the jail.

You could use "rsync -aAXv source_dir target_dir".


----------



## chrbr (Jan 15, 2022)

Dear Lamia,
should it be possible to achieve the same goal by

1. Change the zfs mountpoint
2. Change the name in the zfs hierarchy by `zfs rename`?

I must admit that I have not fully understand how zfs behaves or works. If I would be in the situation I would have taken the method you have suggested which matches the workflow of "old" file systems, too.


----------



## Lamia (Jan 15, 2022)

Yes to both.


----------

