This article explains how to rollback a software upgrade using a snapshot.
Before performing a software upgrade, you can create a snapshot of the running software in your device. This file will be stored in an alternate partition in the hard disk.
The following example uses an ACX4000 running 12.3X54-D10.6:
> show version
Hostname: london
Model: acx4000
JUNOS Crypto Software Suite [12.3X54-D10.6]
JUNOS Base OS Software Suite [12.3X54-D10.6]
JUNOS Kernel Software Suite [12.3X54-D10.6]
JUNOS Base OS boot [12.3X54-D10.6]
JUNOS Packet Forwarding Engine Support (ACX) [12.3X54-D10.6]
JUNOS Online Documentation [12.3X54-D10.6]
JUNOS Routing Software Suite [12.3X54-D10.6]
You can also create a snapshot with the command, 'request system snapshot slice alternate'
. This can be done as well with a USB:
> request system snapshot slice alternate
Verifying compatibility of destination media partitions...
Running newfs (886MB) on internal media / partition (da0s2a)...
Running newfs (93MB) on internal media /config partition (da0s2e)...
Copying '/dev/da0s1a' to '/dev/da0s2a' .. (this may take a few minutes)
Copying '/dev/da0s1e' to '/dev/da0s2e' .. (this may take a few minutes)
The following filesystems were archived: / /config
Once you have created the snapshot, you can proceed with upgrade. In old releases, you cannot see the snapshot. But in recent releases, you can check the snapshot using the command 'show system snapshot'
. The following is an example where the ACX has been upgraded to 16.1R7.7:
> show version
Hostname: london
Model: acx4000
Junos: 16.1R7.7
JUNOS Base OS boot [16.1R7.7]
JUNOS Base OS Software Suite [16.1R7.7]
Check the snapshot to see the one created in 12.3:
> show system snapshot
Doing the initial labeling...
Information for snapshot on internal (da0s1)
Creation date: Feb 23 00:35:42 2011
JUNOS version on snapshot:
jbase : ppc-12.3X54-D10.6
jcrypto: ppc-12.3X54-D10.6
jdocs : 12.3X54-D10.6
jkernel: ppc-12.3X54-D10.6
jpfe : ACX-12.3X54-D10.6
jroute : ppc-12.3X54-D10.6
From this point, if you want to rollback, you need to boot from the alternate partition. In other platforms, you can use the command
'request system reboot slice alternate media internal
' to reboot from the alternate partition. However, in the ACX this is not possible. Therefore, you have to use the shell to make the ACX boot from the alternate partition.
-
First you need to login into the shell with root access:
> start shell user root
Password:
%
-
Once in the shell, you can swap the active partition with the following commands:
% fdisk -a da0
Partition 2 is marked active
Do you want to change the active partition? [n] y
Supply a decimal value for "active partition" [2] 1
Are you happy with this choice [n] y
%
-
Once partition '2', which is the ID for the alternate partition becomes active, you can proceed with the reboot. This can be done from the shell using the command, 'Reboot'
.
% reboot
Once the ACX boots, you will see that the router has booted with the version of the snapshot:
> show version
Hostname: london
Model: acx4000
JUNOS Crypto Software Suite [12.3X54-D10.6]
JUNOS Base OS Software Suite [12.3X54-D10.6]
JUNOS Kernel Software Suite [12.3X54-D10.6]
JUNOS Base OS boot [12.3X54-D10.6]
JUNOS Packet Forwarding Engine Support (ACX) [12.3X54-D10.6]
JUNOS Online Documentation [12.3X54-D10.6]
At this point, the ACX is running with the alternative partition as active. If you want to remain in the version of the snapshot and continue working with the primary partition, copy the snapshot to the primary partition to the primary partition using the command 'request system snapshot slice alternate
'.
> request system snapshot slice alternate
Verifying compatibility of destination media partitions...
Running newfs (886MB) on internal media / partition (da0s2a)...
Running newfs (93MB) on internal media /config partition (da0s2e)...
Copying '/dev/da0s1a' to '/dev/da0s2a' .. (this may take a few minutes)
Copying '/dev/da0s1e' to '/dev/da0s2e' .. (this may take a few minutes)
The following filesystems were archived: / /config
Once the snapshot has been copied in the primary partition, swap the active partition again.
> start shell user root
Password:
% fdisk -a da0
Partition 1 is marked active
Do you want to change the active partition? [n] y
Supply a decimal value for "active partition" [1] 1
Are you happy with this choice [n] y
% reboot
> show version
Hostname: london
Model: acx4000
JUNOS Crypto Software Suite [12.3X54-D10.6]
JUNOS Base OS Software Suite [12.3X54-D10.6]
JUNOS Kernel Software Suite [12.3X54-D10.6]
JUNOS Base OS boot [12.3X54-D10.6]
JUNOS Packet Forwarding Engine Support (ACX) [12.3X54-D10.6]
JUNOS Online Documentation [12.3X54-D10.6]
JUNOS Routing Software Suite [12.3X54-D10.6]
At this point, the ACX has returned from 16.1R7.7 to 12.3X54, and is running from the primary partition.