# moving jails to a new server - EZJAIL



## dvl@ (Mar 30, 2012)

I had a server die (some months back).  Fortunately, the HDD is fine and I've been able to copy the /usr/jails directory to a new server.  This new server has never run jails before. The problem: symlinks are missing from the jails, e.g. bin -> /basejail/bin, boot -> /basejail/boot. I hope that explains it enough.  Those symlinks are created by the *ezjail-admin create* command (I'm sure).

I am creating my jails with this command:
[cmd=]ezjail-admin create -f bacula -x mysql41.example.org 10.35.0.100[/cmd]

Note that I'm using the -x option because the "ezjail already exists at the jail root" as shown in man ezjail-admin.

So, I'm a bit stuck here, wondering, I think I need to do my cp again, this time with symlinks.


----------



## dvl@ (Mar 30, 2012)

Hold! I think I have a manual solution.  Creating a few symlinks.  I'm documenting it now.


----------



## dvl@ (Mar 30, 2012)

Yes.  A number of symlinks need to be created.  This list may be incomplete, but it does get the jail running.


```
cd /usr/jails/YOURBROKENJAIL
ln -s /basejail/bin
ln -s /basejail/boot
ln -s /basejail/lib
ln -s /basejail/libexec
ln -s /basejail/rescue
ln -s /basejail/sbin
ln -s usr/src/sys

cd usr
ln -s /basejail/usr/bin
ln -s /basejail/usr/games
ln -s /basejail/usr/include
ln -s /basejail/usr/lib
ln -s /basejail/usr/lib32
ln -s /basejail/usr/libdata
ln -s /basejail/usr/libexec
ln -s /basejail/usr/ports
ln -s /basejail/usr/sbin
ln -s /basejail/usr/share
ln -s /basejail/usr/src
```


----------



## fbsd1 (Apr 7, 2012)

You can not just move the /usr/jails directory tree to an different box. ezjail has some control files hidden in /etc or /usr/local/etc that need to be moved also.


----------



## gkontos (Apr 7, 2012)

fbsd1 said:
			
		

> You can not just move the /usr/jails directory tree to an different box. ezjail has some control files hidden in /etc or /usr/local/etc that need to be moved also.



[CMD=""]# tar czf myjails.tgz /jails [/CMD]
[CMD=""]# scp jails.tgz toor@newbox:/usr[/CMD]
[CMD=""]# tar zxf myjails.tgz[/CMD]


----------



## dvl@ (Apr 9, 2012)

fbsd1 said:
			
		

> You can not just move the /usr/jails directory tree to an different box. ezjail has some control files hidden in /etc or /usr/local/etc that need to be moved also.



This differs from advice I've heard before in that you can move jails from one server to another.


----------

