Difference between revisions of "Multiple Boot Environments"

From PC-BSD Wiki
Jump to: navigation, search
(Mounting BEs)
(Mounting BEs)
Line 40: Line 40:
=== Mounting BEs ===
=== Mounting BEs ===
Once a BE is created, you do not have to boot into it in order to access its contents. Instead, you can mount it in order to access the files on the BE.
As an example, create a BE before doing some housecleaning in your user account's home directory. If you delete some files from the command line then decide that you wish you hadn't, you can mount the previous BE to retrieve a copy of the deleted file, as demonstrated in the following example.
First create the BE as the superuser:
'''beadm create backup_july9'''
Created successfully
'''beadm list'''
BE            Active Mountpoint Space Policy Created
default      NR    /          6.05G static 2012-07-09 05:06
backup_july9  -      -            1K static 2012-07-10 12:35
Leave the superuser account and '''cd''' into your home directory to delete some stuff.
'''ls Documents'''
file1.odt  resume.odt
'''rm -Rf Documents'''
Decide that you really wish you had not deleted your resume along with the folder. Become the superuser and mount the BE you created before performing the deletes:
'''beadm mount backup_july9 /mnt'''

Revision as of 09:22, 11 July 2012

(Sorry for the inconvenience)

Beginning with version 9.1, PC-BSD supports multiple boot environments on systems that were formatted with ZFS during installation. In 9.1, this feature is configured from the command line. Version 9.2 will provide a graphical interface for managing boot environments (BEs).

Multiple boot environments is a feature originally created by Solaris. By default, a ZFS system is considered to be a BE, since you can boot into it. Multiple boot environments allow you to create additional BEs, or bootable, point-in-time snapshots of the ZFS filesystem. By booting into an alternate BE, you return to that point in time in the filesystem. For example, if you create a BE before upgrading, you could configure the system to boot into that BE should the upgrade fail and you wish to return to what the filesystem looked like before the upgrade. Alternately, you could create a snapshot BE to install and configure some software that you wish to test. Simply boot into that BE and perform your test installations. When you are finished your tests, set the system to boot back into the original BE.

BE's are managed with the beadm command which must be run as the superuser. The following example creates a BE named beforeupgrade. The new BE is a clone of the current BE, the ZFS environment that you booted into.

beadm create beforeupgrade 
Created successfully

To view all BEs, use the list command

beadm list
BE            Active Mountpoint Space Policy Created
default       NR     /          6.05G static 2012-07-09 05:06
beforeupgrade -      -             1K static 2012-07-10 12:25

The possible flags in the Active field are as follows:

  • R: active on reboot
  • N: active now
  • -: inactive

In this example, the current BE is called default, it is active now and at next reboot, and is mounted. The newly created beforeupgrade BE exists, but is inactive and unmounted. To activate the new BE:

beadm activate beforeupgrade
Activated successfully
beadm list
BE            Active Mountpoint Space Policy Created
default       N      /          64.5K static 2012-07-09 05:06
beforeupgrade R      -          6.05G static 2012-07-10 12:25

The flags now indicate that the system is currently booted into default, but at next boot the system will boot into beforeupgrade.

Note that only boot environment can be active at a time.

Mounting BEs


Personal tools