iocage is a jail or container manager tool for FreeBSD. It is also available on FreeNAS based NAS system. It comes with some of best features and technologies the FreeBSD operating system has to offer. 

 

Step 1 – Login to FreeNAS server

 

Use the ssh command:

 

ssh user@freenas-box-name
ssh vyga@nas04

 

Become a root user using sudo command:

 

$ sudo -i

 

Find our your FreeNAS server IP address and interface name, enter:

 

# ifconfig

 

Please note down your real network interface. You must activate i.e. set a zpool active for iocage usage. My zpool name is rootadminz (use zpool list to get a list of zpool), so I run:

 

# iocage activate rootadminz

 

Step 2 – Fetch a version of FreeBSD for jail usage

 

Type the following command (this need to be done once only):

# iocage fetch

 

Step 3 – Create FreeNAS Jails with iocage command

 

Create a jail named backup with 192.168.2.30/24 IP address for jail interface named igb1:

# iocage create -n backupjail ip4_addr="igb1|192.168.2.30/24" -r 11.1-RELEASE

 

List the jails

 

To list newly created jail run:

# iocage list

 

Start the jail named backup

 

# iocage start {jailNameHere}
# iocage start backupjail

 

How to automatically start jail when FreeNAS reboots

 


# iocage set boot=on backupjail

 

How to login to my jails

 

The syntax is:

# iocage console {yourJailNameHere}
# iocage console backupjail

 

Once logged in install the pkg command on backupjail:

# pkg

 

Step 4 – Useful jail management commands

 

Let us see some useful iocage commands.

 

Show resource usage of all jails

 

# iocage df

 

Run a command inside a specified jail

 

# iocage exec {jailNameHere} {FreeBSDCOmmandHERE}
# iocage exec backupjail ifconfig

 

How to stop the specified jails or ALL

 

# iocage stop ALL
# iocage stop backupjail

 

Restart the specified jails or ALL

 

# iocage restart ALL
# iocage restart backupjail

 

Destroy/delete/remove specified jail(s)

 

This will destroy all data, so be careful:

# iocage destroy backupjail

 

Run freebsd-update to update a specified jail to the latest patch level

 

# iocage update backupjail

 

Ця відповідь Вам допомогла? 0 Користувачі, які знайшли це корисним (0 Голосів)