Storing Copying and Erasing Switch Configuration Files
Displaying Configuration Files
Use the show running-config command to view the running configuration file.
switch# show running-config
Building Configuration ...
interface port-channel 98
interface fc1/1
interface fc1/2
interface mgmt0
ip address 172.22.95.112 255.255.255.0
no shutdown
vsan database
vsan 2
clock summer-time Pacific 1 Sun Apr 02:00 5 Sun Oct 02:00 60
switchname switch112
Use the show startup-config command to view the startup configuration file.
switch# show startup-config
interface port-channel 98
interface fc1/1
channel-group 98 force
no shutdown
interface mgmt0
ip address 172.22.95.112 255.255.255.0
boot system system-237; ep-41
boot kickstart boot-237 ep-41
ip domain-name cisco.com
Downloading Configuration Files to the Switch
You can configure a switch in the Cisco MDS 9000 Family by using configuration files you create or download from another switch. In addition, you can store configuration files on a bootflash device on the supervisor module and you can configure the switch using a configuration stored on an external CompactFlash disk.
Before you begin downloading a configuration file using a remote server, do the following:
Ensure the configuration file to be downloaded is in the correct directory on the remote server.
•Ensure that the permissions on the file are set correctly. Permissions on the file should be set to world-read.
•Ensure the switch has a route to the remote server. The switch and the remote server must be in the same subnetwork if you do not have a router or default gateway to route traffic between subnets.
Check connectivity to the remote server using the ping command.
Using a File From a Remote Server
To configure a switch in the Cisco MDS 9000 Family using a configuration file downloaded from a remote server using TFTP, FTP, SCP, or SFTP, follow these steps:
Step 1 Log into the switch through the console port or through a Telnet or SSH session.
Step 2 Configure the switch using the configuration file downloaded from the remote server using the copy scheme://url system:running-config command, where scheme is TFTP, FTP, SCP, or SFTP and url is the path to the source file on the remote server.
The configuration file downloads and the commands are executed as the file is parsed line by line.
Use the following command to download a configuration file from a remote server to the running configuration:
switch# copy scheme://url system:running-config
Using a File From an External CompactFlash Disk (slot0:)
Note The physical media must be inserted into slot0: after you log into the switch.
To configure a switch in the Cisco MDS 9000 Family using a configuration file stored on an external CompactFlash disk, follow these steps:
Step 1 Log into the switch through the console port or through a Telnet or SSH session.
Step 2 Insert the CompactFlash device into slot0: on the active supervisor module.
Step 3 Locate the configuration file using the cd and dir commands.
Step 4 Configure the switch using the configuration file stored on the external CompactFlash disk using the copy slot0:source file system:running-config command.
The commands are executed as the file is parsed line by line.
Use the following command to download a configuration file from an external CompactFlash to the running configuration:
switch copy slot0:dns-config.cfg system:running-config
Saving Configuration Files to an External Device
You can save a configuration file stored on internal storage to a remote server or to an external flash device on the switch.
Saving to a Remote Server
To save a configuration file to a remote server such as TFTP, FTP, SCP, or SFTP, follow these steps:
Step 1 Log into the switch through the console port or through a Telnet or SSH session.
Step 2 Save the configuration using the copy system:running-config scheme://url command, where scheme is TFTP, FTP, SCP, or SFTP and url is the path to the target file on the remote server.
Use the following command to save a running configuration file to a remote server:
switch# copy system:running-config scheme://url
Use the following command to save a startup configuration file to a remote server:
switch# copy nvram:startup-config scheme://url
Saving to an External CompactFlash Disk (slot0:)
To save a configuration file on an external CompactFlash device, follow these steps:
Step 1 Log into the switch through the console port or through a Telnet session.
Step 2 Save the running-config file using the copy system:running-config slot0:destination file command or the startup-config file using the copy nvram:startup-config destination file.
Use the following command to save a running configuration file to an external CompactFlash disk:
switch# copy system:running-config slot0:dns-config.cfg
Use the following command to save a startup configuration file to an external CompactFlash disk:
switch# copy nvram:startup-config slot0:dns-config.cfg
Saving the Running Configuration
After you have created a running configuration in system memory, you can save it to the startup configuration in NVRAM.
Use the following copy command to save the configuration to NVRAM:
switch# copy system:running-config nvram:startup-config
The copy running-config startup-config command is an alias to the previous command and is used frequently throughout this guide.
To cancel the copy operation initiated by another switch, use the following command:
switch# system startup-config abort
To cancel the operation locally and throughout the fabric, enter Ctrl-c on the console or Telnet session of the initiator switch.
Saving Startup Configurations in the Fabric
You can use Cisco Fabric Services (CFS) to instruct the other switches in the fabric to save their configurations to their local NVRAM.
Save to NVRAM using the following copy command:
switch# copy running-config startup-config fabric
Note If any remote switch in the fabric fails to complete the copy running-config startup-config fabric process, the request is discarded on the initiator switch and the failure errors are displayed in the initiator switch CLI session.
You can use the show cfs application command to verify that the Fabric Startup Configuration Manager (FSCM) application is enabled.
switch# show cfs application
----------------------------------------------
Application Enabled Scope
----------------------------------------------
ntp No Physical-all
fscm Yes Physical-fc
islb No Physical-fc
role No Physical-all
rscn No Logical
radius No Physical-all
fctimer No Physical-fc
syslogd No Physical-all
callhome No Physical-all
fcdomain No Logical
device-alias Yes Physical-fc
Total number of entries = 11
Unlocking the Startup Configuration File
The startup configuration file can be locked by applications on the switch. To display locks on the startup configuration file, use the following command:
switch# show system internal sysmgr startup-config locks
To release a lock on the startup configuration file, use the following command:
switch# system startup-config unlock 10
Copying Configuration Files
The syntax for the copy command follows and is explained in Table 9-1.
switch# copy scheme://server/filename scheme://server/filename
Table 9-1 copy Command Syntax
Scheme
|
Server
|
File Name
|
---|---|---|
bootflash |
sup-active sup-standby sup-1 or module-5 sup-2 or module-6 sup-local sup-remote |
User-specified |
slot0 |
— |
User-specified |
volatile |
— |
User-specified |
nvram |
— |
startup-config or snapshot-config |
system |
— |
running-config |
tftp1 |
IPv4 address, IPv6 address, or DNS name |
User-specified |
ftp |
||
scp (secure copy) |
||
sftp |
||
core |
slot-number |
Process identifier number |
1 When downloading and uploading files, a TFTP limitation restricts a TFTP client to a 32 MB file size and some TFTP servers to a 16-MB file size. |
•This example shows how to copy a file from bootflash in the active supervisor module (sup-1 in slot 5 on Cisco MDS 9506 and Cisco MDS 9509 switches or slot 7 on Cisco MDS 9513 switches) to the bootflash in the standby supervisor module (sup-2 in slot 6 on Cisco MDS 9506 and Cisco MDS 9509 switches or slot 8 on Cisco MDS 9513 switches).
switch# copy bootflash:system_image bootflash://sup-2/system_image
•This example shows how to overwrite the contents of an existing configuration in NVRAM:
switch# copy nvram:snapshot-config nvram:startup-config
Warning: this command is going to overwrite your current startup-config.
Do you wish to continue? {y/n} [y] y
•This example shows how to copy a running configuration to the bootflash: file system:
switch# copy system:running-config bootflash:my-config
•This example shows how to copy a system image file from the SCP server identified by an IPv4 address to bootflash:
switch# copy scp://[email protected]/system-image bootflash:system-image
•This example shows how to copy a script file from the SFTP server identified by an IPv4 address to the volatile: file system:
switch# copy sftp://172.16.10.100/myscript.txt volatile:myscript.txt
Note Use the show version image command to verify if the downloaded images are valid.
Backing Up Configuration Files
All switch configurations reside in the internal system: and nvram: file systems. If your internal file systems are corrupted, you could potentially lose your configuration. Save and back up your configuration files periodically. Also, before installing or migrating to a new software configuration, back up the configuration files.
•This example shows how to create a snapshot of the startup configuration in a predefined location on the switch (binary file):
switch# copy nvram:startup-config nvram:snapshot-config
•This example shows how to back up the startup configuration copy in the bootflash: file system (ASCII file):
switch# copy nvram:startup-config bootflash:my-config
•This example shows how to back up the startup configuration to the TFTP server (ASCII file):
switch# copy nvram:startup-config tftp://172.16.10.100/my-config
•This example shows how to back up the running configuration to the bootflash: file system (ASCII file):
switch# copy system:running-config bootflash:my-config
Rolling Back to a Previous Configuration
Problems, such as memory corruption, can occur that make it necessary for you to recover your configuration from a backed-up version.
This example shows how to roll back to a snapshot copy of a previously saved running configuration (binary file):
switch# copy nvram:snapshot-config nvram:startup-config
Note You can issue a rollback command only when a snapshot is already created. Otherwise, you will receive the No snapshot-config found error message.
Note Each time a copy running-config startup-config command is issued, a binary file is created and the ASCII file is updated. A valid binary configuration file reduces the overall boot time significantly. A binary file cannot be uploaded, but its contents can be used to overwrite the existing startup configuration. The write erase command clears the binary file.
Restoring the Configured Redundancy Mode
Tip If you configure the combined mode as the redundancy mode for power supplies on a Cisco MDS 9509 switch, be careful when using the write erase and reload command sequence before rolling back to a saved configuration because this command sequence causes the switch to revert to factory defaults.
By issuing the write erase command and the reload command, you restore the switch settings to their factory defaults. This sequence also restores the redundancy mode setting for the power supplies back to the redundant mode (default).
Depending on the type of power supply, the input voltage, and the number of modules (line cards) in the chassis, the redundancy mode may prevent the line cards from being powered on after a system reboot . If you use this sequence, the commands that apply to the powered down line cards will not be enforced on the switch (and will not be part of its running configuration).
If using the write erase and reload command sequence before rolling back to a saved configuration, follow these steps:
Step 1 Manually change (if originally configured) the redundant mode configuration to combined mode.
Step 2 Wait until all modules are back online. The module status displays ok in response to the show module command.
Step 3 Roll back to the saved configuration
Accessing File Systems on the Standby Supervisor Module
You can access all file systems on the standby supervisor module (remote) from a session on the active supervisor module. This is useful when copying files to the active supervisor modules requires similar files to exist on the standby supervisor module.
•Use the dir scheme://sup-remote command to list files on the standby supervisor module.
switch# dir bootflash://sup-remote
12198912 Aug 27 16:29:18 2003 m9500-sf1ek9-kickstart-mzg.1.3.0.39a.bin
1864931 Apr 29 12:41:59 2003 dplug2
12288 Apr 18 20:23:11 2003 lost+found/
12097024 Nov 21 16:34:18 2003 m9500-sf1ek9-kickstart-mz.1.3.1.1.bin
41574014 Nov 21 16:34:47 2003 m9500-sf1ek9-mz.1.3.1.1.bin
Usage for bootflash://sup-remote
67747169 bytes used
116812447 bytes free
184559616 bytes total
•Use the delete scheme://sup-remote to remove files from a file system on the standby supervisor module.
switch# delete bootflash://sup-remote/aOldConfig.txt
Deleting Configuration Files
Use the delete command to remove configuration files from the memory locations on the switch.
•This example shows how to delete a file from the bootflash: file system:
switch# delete bootflash:dns_config.cfg
•This example shows how to delete a file from an external CompactFlash (slot0:) file system:
switch# delete slot0:dns_config.cfg
•This example shows how to delete the file named test from the flash card inserted in slot 0.
switch# delete slot0:test
Delete slot0:test? [y/n]: y
•This example shows how to delete the entire my-dir directory and all its contents:
switch# delete bootflash:my-dir
•This example shows how to delete a file in the bootflash: on the standby supervisor module:
switch# delete bootflash://sup-remote/aOldConfig