FreeBSD copy system to iocage jail
Uiterlijk
Create a New Jail and cpdup (Recommended)
This method creates a fresh, empty jail and copies your current system files into it, excluding virtual filesystems and host-specific configuration. Create a blank, thick jail:
- Replace <release> with your version (e.g., 14.0-RELEASE)
iocage create -r <release> -n new_jail_name
Ensure the new jail dataset is mounted:
- Find the jail dataset
iocage list [-l]
- Usually: zroot/iocage/jails/<UUID>/root
Use cpdup to copy the system (avoids special files): Install cpdup if you don't have it (pkg install cpdup).
cpdup / /iocage/jails/new_jail_name/root/
Clean up the Jail:
You must remove host-specific configuration from the jail so it boots correctly.
- Edit fstab to prevent mounting host disks
vi /iocage/jails/new_jail_name/fstab
- Remove /dev/proc, etc.
Start the jail:
iocage start new_jail_name