Force configuration restore
The
cfg-restore
command fails if a reboot is required. The
Configuration restoration is not allowed as the configuration has reboot required commands
error is displayed, along with lines requiring a reboot. The force option in the
cfg-restore
command allows a user to force a reboot. The command is:
cfg-restore {flash | tftp | sftp} <FILE-NAME> force
.
Before reboot,
config
is the active configuration. After the device reboots, the backup file becomes the new active configuration.
id | act pri sec | name ---+-------------+--------------- 1 | * * * | config 2 | | def 3 | | golden_config 4 | | 5 | |
switch(config)# cfg-restore flash golden_config Current running-configuration will be replaced with 'golden_config'. Continue (y/n)? y Configuration restore is in progress, configuration changes are temporarily disabled. Configuration restoration is not allowed as the configuration has reboot required commands. switch(config)# show cfg-restore status Status : Failed Config File Name : golden_config Source : Flash Time Taken : 5 Seconds Last Run : Mon Oct 30 23:03:19 2017 Recovery Mode : Enabled Failure Reason : Reboot required commands present. Command : console terminal none Number of Add Commands : 0 Number of Remove Commands : 1 Time Taken for Each Phase : Calculating diff : 3 Seconds Adding commands : 0 Seconds Removing commands : 0 Seconds switch# cfg-restore flash golden_config force Device may be rebooted if the configuration file has reboot required or system-wide change commands. Do you want to continue (y/n)? Current running-configuration will be replaced with 'golden_config'. Continue (y/n)? Configuration restore is in progress, configuration changes are temporarily disabled. Successfully applied configuration 'golden_config' to running configuration. Rebooting switch...In the preceding output,
Command : console terminal none
shows that
cfg-restore
failed because a reboot is required.
After the switch reboots and comes up, the
golden_config
becomes the active configuration.
NOTE:
In case of a switch reboot, the switch comes up with the configuration associated with the primary or secondary.
id | act pri sec | name ---+-------------+------------------------------------------------ 1 | * * | config 2 | | def 3 | * | golden_config 4 | | 5 | | switch# show cfg-restore status Status : Success Config File Name : default Source : Flash Time Taken : 1 Seconds Last Run : Mon Oct 23 07:17:03 2017 Recovery Mode : Enabled Failure Reason : - Number of Add Commands : 0 Number of Remove Commands : 5 Time Taken for Each Phase : Calculating diff : 1 Seconds Adding commands : 0 Seconds Removing commands : 0 Seconds
NOTE:
Time taken for adding and deleting commands is zero, as the switch reboots. It is similar to downloading a startup-configuration to the device.