Difference between revisions of "Multiple Boot Environments"

From PC-BSD Wiki
Jump to: navigation, search
(18 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 +
<translate>
 +
 +
<!--T:1-->
 
<noinclude>{{NavHeader|back=Dual Booting|forward=Upgrading PC-BSD®}}</noinclude>
 
<noinclude>{{NavHeader|back=Dual Booting|forward=Upgrading PC-BSD®}}</noinclude>
  
 +
<!--T:2-->
 
Beginning with version 9.1, PC-BSD® supports multiple boot environments (BEs) ''' ''on systems that were formatted with ZFS during installation.'' ''' In 9.1, this feature is managed from the command line. Version 9.2 will provide a graphical interface for managing boot environments.
 
Beginning with version 9.1, PC-BSD® supports multiple boot environments (BEs) ''' ''on systems that were formatted with ZFS during installation.'' ''' In 9.1, this feature is managed from the command line. Version 9.2 will provide a graphical interface for managing boot environments.
  
With multiple boot environments, the process of updating software becomes a low risk operation as you can backup your current boot environment before making any software updates to your system. If needed, you also have the option of booting into a backup boot environment. For example:  
+
<!--T:3-->
 +
With multiple boot environments, the process of updating software becomes a low-risk operation as you can backup your current boot environment before upgrading or making software updates to your system. If needed, you also have the option of booting into a backup boot environment. For example:
  
* if you are making software changes to a boot environment, you can take a snapshot of that environment at any stage during modifications by using the '''beadm create''' command. A snapshot is a read-only image of a boot environment at a given point in time. A snapshot is not bootable but you can create a boot environment, based on that snapshot, by using the '''beadm create-e''' command followed by the '''beadm activate''' command to specify that this boot environment will become the default boot environment on the next reboot.
+
<!--T:4-->
 +
* if you are making software changes to a boot environment, you can take a snapshot of that environment at any stage during modifications by using the '''beadm create''' command. A snapshot is a read-only image of a boot environment at a given point in time. A snapshot is not bootable but you can create a boot environment, based on that snapshot, by using the '''beadm create -e''' command followed by the '''beadm activate''' command to specify that this boot environment will become the default boot environment on the next reboot.
  
 +
<!--T:5-->
 
* you can create custom names for each snapshot to identify when or why that snapshot was created. You can use the '''beadm list -s''' command to view the available snapshots for a boot environment.
 
* you can create custom names for each snapshot to identify when or why that snapshot was created. You can use the '''beadm list -s''' command to view the available snapshots for a boot environment.
  
 +
<!--T:6-->
 
* you can save multiple boot environments on your system and perform various updates on each of them as needed. For example, you can clone a boot environment by using the '''beadm create''' command. A clone is a bootable copy of a boot environment. You can install, test, and update different software packages on the original boot environment and on its clone.
 
* you can save multiple boot environments on your system and perform various updates on each of them as needed. For example, you can clone a boot environment by using the '''beadm create''' command. A clone is a bootable copy of a boot environment. You can install, test, and update different software packages on the original boot environment and on its clone.
  
* although only one boot environment can be active at a time, you can mount an inactive boot environment using the '''beadm mount''' command. You could then update specific packages on the mounted environment.
+
<!--T:7-->
 +
* although only one boot environment can be active at a time, you can mount an inactive boot environment using the '''beadm mount''' command. You could then '''chroot''' into the mount point in order to update specific packages on the mounted environment.
  
=== Understanding Boot Environments ===
+
<!--T:8-->
 +
* you can move a boot environment to another machine, physical or virtual, in order to check hardware support.
  
''' ''Read this section before using multiple boot environments'' ''' so that you understand what will and will not be preserved when booting into an alternate BE.
+
<!--T:9-->
 +
{{warning|icon64=for boot environments to work properly, ''' ''do not change the default ZFS layout during installation.'' ''' The default ZFS layout ensures that when you create multiple boot environments, the ''/usr/pbi/'', ''/usr/local/'', ''/usr/home/'', ''/usr/ports/'', ''/usr/src/'' and ''/var/'' directories remain untouched. This way, if you rollback to a previous boot environment, you will not lose data in your home directories, any installed applications, or downloaded src or ports.}}
  
 +
=== Managing Boot Environments === <!--T:10-->
  
=== Managing Boot Environments ===
+
<!--T:11-->
 +
Boot environments 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.
  
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.
+
<!--T:12-->
 
+
{{txtbox|box='''beadm create beforeupgrade'''
'''beadm create beforeupgrade'''  
+
Created successfully}}
Created successfully
+
  
 +
<!--T:13-->
 
To view all BEs, use the '''list''' command
 
To view all BEs, use the '''list''' command
  
'''beadm list'''
+
<!--T:14-->
BE            Active Mountpoint Space Policy Created
+
{{txtbox|box='''beadm list'''
default      NR    /          6.05G static 2012-07-09 05:06
+
BE            Active Mountpoint Space Policy Created
beforeupgrade -      -            1K static 2012-07-10 12:25
+
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:
+
|txt=
 +
The possible flags in the "Active" field are as follows:
  
 +
<!--T:15-->
 
* '''R:''' active on reboot
 
* '''R:''' active on reboot
  
 +
<!--T:16-->
 
* '''N:''' active now
 
* '''N:''' active now
  
* '''-:''' inactive
+
<!--T:17-->
 +
* '''-:''' 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:
+
<!--T:18-->
 +
In this example, the current BE is called ''default'', it is active now, and at next reboot; and it is mounted. The newly created ''beforeupgrade'' BE exists, but is inactive and unmounted. To activate the new BE:
  
'''beadm activate beforeupgrade'''
+
<!--T:19-->
Activated successfully
+
{{txtbox|box='''beadm activate beforeupgrade'''
'''beadm list'''
+
Activated successfully
BE            Active Mountpoint Space Policy Created
+
'''beadm list'''
default      N      /          64.5K static 2012-07-09 05:06
+
BE            Active Mountpoint Space Policy Created
beforeupgrade R      -          6.05G static 2012-07-10 12:25
+
default      N      /          64.5K static 2012-07-09 05:06
 +
beforeupgrade R      -          6.05G static 2012-07-10 12:25}}
  
 +
<!--T:20-->
 
The flags now indicate that the system is currently booted into ''default'', but at next boot the system will boot into ''beforeupgrade''. Only one boot environment can be active at a time.
 
The flags now indicate that the system is currently booted into ''default'', but at next boot the system will boot into ''beforeupgrade''. Only one boot environment can be active at a time.
  
<noinclude>{{refheading}}<noinclude>
+
<!--T:21-->
 
<noinclude>
 
<noinclude>
 +
<!-- {{refheading}} --><!-- uncomment when citelink is used on the page -->
 
[[category:handbook]]
 
[[category:handbook]]
 
[[category:Advanced Installation Topics]]
 
[[category:Advanced Installation Topics]]
 +
[[category:Multiple Boot Environments]]
 
</noinclude>
 
</noinclude>
 +
</translate>

Revision as of 07:14, 16 April 2013

(Sorry for the inconvenience)

Contents

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

With multiple boot environments, the process of updating software becomes a low-risk operation as you can backup your current boot environment before upgrading or making software updates to your system. If needed, you also have the option of booting into a backup boot environment. For example:

  • if you are making software changes to a boot environment, you can take a snapshot of that environment at any stage during modifications by using the beadm create command. A snapshot is a read-only image of a boot environment at a given point in time. A snapshot is not bootable but you can create a boot environment, based on that snapshot, by using the beadm create -e command followed by the beadm activate command to specify that this boot environment will become the default boot environment on the next reboot.
  • you can create custom names for each snapshot to identify when or why that snapshot was created. You can use the beadm list -s command to view the available snapshots for a boot environment.
  • you can save multiple boot environments on your system and perform various updates on each of them as needed. For example, you can clone a boot environment by using the beadm create command. A clone is a bootable copy of a boot environment. You can install, test, and update different software packages on the original boot environment and on its clone.
  • although only one boot environment can be active at a time, you can mount an inactive boot environment using the beadm mount command. You could then chroot into the mount point in order to update specific packages on the mounted environment.
  • you can move a boot environment to another machine, physical or virtual, in order to check hardware support.


WARNING For boot environments to work properly, do not change the default ZFS layout during installation. The default ZFS layout ensures that when you create multiple boot environments, the /usr/pbi/, /usr/local/, /usr/home/, /usr/ports/, /usr/src/ and /var/ directories remain untouched. This way, if you rollback to a previous boot environment, you will not lose data in your home directories, any installed applications, or downloaded src or ports.

Managing Boot Environments

Boot environments 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 it 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. Only one boot environment can be active at a time.

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox