# Moving jails to new partition



## monarckco (Mar 29, 2012)

I ran out of space in my /usr slice so I copied everything to a bigger hard drive using RAID.  
I then followed several tutorials trying to expand /usr with `# growfs` but always got an error.  So I decided to instead create a new partition with the empty space and move data there.  The only problem is that all of the data I need to move there are inside of jails.  What is the best way of tackling this problem?

I tried to create a symlink, but of course that failed since jails can't see outside of themselves.  I also tried copying everything from one of the jails to the new mount location.

`# cp -pRv /usr/jails/jail_1 /mnt/new/jails/`

I also did the above for the basejail, flavours, and new_jail directories originally located in /usr/jails/.  I then edited the /usr/local/etc/ezjail/jail_1 configuration file to point towards the new directory that I copied everything to.  I then tried starting the jail, but got the following error:

```
[cmd="#"]ezjail-admin onestart jail_1[/cmd]
Configuring jails:.
Starting jails: cannot start jail "jail_1": 
jail: execv: /bin/sh: No such file or directory
```

I know that I could delete the newly created partition (240GB), split it up into smaller partitions, and then mount those inside of the jails, but I don't really want to do that.  Any other ideas on how I can use my new space for my jails?


----------



## gentoobob (Apr 6, 2012)

*H*ave you tried just doing a basic partition setup and map fstab /usr directory to it and copy all data over? *S*ee if that works.


----------



## fbsd1 (Apr 7, 2012)

ezjail has some behind the seans control files in /usr/local/etc where info about jails directory location is held. You have to hand edit those files to point to the new locations of where you moved the /jails to. or it maybe in /etc. Just don*'*t remember for sure with out digging into the code.


----------



## monarckco (Apr 9, 2012)

I solved it by mounting the new partition into the jails with 
	
	



```
mount_nullfs
```
It may not be as clean of a solution as actually moving everything into the new, larger partition, but it works and I literally have no time to try other methods.

Hopefully, someone else will find this useful if they're in the same spot that I was.  Thanks for all of the suggestions.


----------

