To copy any file
from a source to a destination, use the copy command in privileged EXEC or
diagnostic mode. Please note that the
copy command
does not yet support the handling of wildcards in order to specify multiple
files as part of source-url.
copy [/erase] [/ verify | /noverify] source-url destination-url
Syntax Description
/erase
|
(Optional) Erases the destination file system before copying.
Note
|
This
option is typically provided on platforms with limited memory to allow for an
easy way to clear local flash memory space.
|
|
/verify
|
(Optional) Verifies the digital signature of the destination file. If
verification fails, the file is deleted from the destination file system. This
option applies to Cisco IOS software image files only.
|
/noverify
|
(Optional) If the file being copied is an image file, this keyword disables the
automatic image verification that occurs after an image is copied.
Note
|
This
keyword is often issued if the
file
verify
auto command is enabled, which automatically
verifies the digital signature of all images that are copied.
|
|
source-url
|
The
location URL (or alias) of the source file or directory to be copied. The
source can be either local or remote, depending upon whether the file is being
downloaded or uploaded.
|
destination-url
|
The
destination URL (or alias) of the copied file or directory. The destination can
be either local or remote, depending upon whether the file is being downloaded
or uploaded.
|
The exact format of
the source and destination URLs varies according to the file or directory
location. You may enter either an alias keyword for a particular file or a
filename that follows the standard Cisco IOS file system syntax (filesystem :[/filepath ][/filename ]).
The table below
shows two keyword shortcuts to URLs.
Table 1. Common Keyword Aliases to URLs
Keyword
|
Source or
Destination
|
running-config
|
(Optional)
Keyword alias for the
system:running-config URL. The
system:running-config keyword represents the
current running configuration file. This keyword does not work in
more and
show
file EXEC command syntaxes.
|
startup-config
|
(Optional) Keyword alias for the
nvram:startup-config URL.
The
nvram:startup-config keyword represents the
configuration file used during initialization (startup). This file is contained
in NVRAM for all platforms except the Cisco 7000 family, which uses the
CONFIG_FILE environment variable to specify the startup configuration. The
Cisco 4500 series cannot use the
copy
running-config
startup-config command. This keyword does not work
in
more and
show
file EXEC command syntaxes.
|
The following
tables list URL prefix keywords by file system type. The available file systems
will vary by platform. If you do not specify a URL prefix keyword, the router
looks for a file in the current directory.
The table below
lists URL prefix keywords for Special (opaque) file systems.
Table 2. URL Prefix Keywords for Special File Systems
Keyword
|
Source or
Destination
|
cns:
|
Source
URL for Cisco Networking Services files.
|
flh:
|
Source
URL for flash load helper log files.
|
logging
|
Source
URL which copies messages from the logging buffer to a file.
|
modem:
|
Destination URL for loading modem firmware on to supported networking devices.
|
null:
|
Null
destination for copies or files. You can copy a remote file to null to
determine its size.
|
nvram:
|
Router
NVRAM. You can copy the startup configuration to NVRAM or from NVRAM.
|
obfl:
|
Source or
destination URL for Onboard Failure Logging files.
|
stby-nvram:
|
Router
NVRAM on the standby hardware. You can copy the startup configuration to NVRAM
or from NVRAM.
|
stby-obfl:
|
Source or
destination URL for Onboard Failure Logging files on the standby hardware.
|
system:
|
Source or
destination URL for system memory, which includes the running configuration.
|
tar:
|
Source
URL for the archive file system.
|
tmpsys:
|
Source or
destination URL for the temporary system files.
|
xmodem:
|
Source or
destination for a file from a network machine that uses the Xmodem protocol.
|
ymodem:
|
Source or
destination for a file from a network machine that uses the Ymodem protocol.
|
The table belows
lists URL prefix keywords for remote file systems.
Table 3. URL Prefix Keywords for Remote File Systems
Keyword
|
Source or
Destination
|
ftp:
|
Source or
destination URL for FTP network server. The syntax for this alias is as
follows:ftp: [[[//username
[:password]@]location]/directory]/filename.
|
http://
|
Source or
destination URL for an HTTP server (also called a web server). The syntax for
this alias is as follows: http:// [[username :password ]@]{hostname |
host-ip }[/
filepath ]/
filename
|
https://
|
Source or
destination URL for a Secure HTTP (HTTPS) server. HTTPS uses Secure Socket
Layer (SSL) encryption. The syntax for this alias is as follows:https:// [[username :password ]@]{hostname |
host-ip }[/
filepath ]/
filename
|
rcp:
|
Source or
destination URL for a remote copy protocol (rcp) network server. The syntax for
this alias is as follows:rcp: [[[//username@ ] location]/directory]/filename
|
scp:
|
Source or
destination URL for a network server that supports Secure Shell (SSH) and
accepts copies of files using the secure copy protocol (scp). The syntax for
this alias is as follows:scp://
username @location [/directory ][/filename ]
|
tftp:
|
Source or
destination URL for a TFTP network server. The syntax for this alias is as
follows:tftp: [[//location]/directory]/filename.
|
The table below
lists URL prefix keywords for local writable storage file systems.
Table 4. URL Prefix Keywords for Local Writable Storage File Systems
Alias
|
Source or
Destination
|
bootflash:
|
Source or
destination URL for boot flash memory.
|
disk0:
and
disk1:
|
Source or
destination URL of disk-based media.
|
flash:
|
Source or
destination URL for flash memory. This alias is available on all platforms. For
platforms that lack a flash: device, note that flash: is aliased to slot0:,
allowing you to refer to the main flash memory storage area on all platforms.
|
harddisk:
|
Source or
destination URL of the active harddisk file system.
|
slavebootflash:
|
Source or destination URL for internal flash memory on the secondary RSP card of a router
configured for HSA.
|
slaveram:
|
NVRAM on a secondary RSP card of a router configured for HSA.
|
slaveslot0:
|
Source or destination URL of the first Personal Computer Memory Card International
Association (PCMCIA) card on a secondary RSP card of a router
configured for HSA.
|
slaveslot1:
|
Source or destination URL of the second PCMCIA slot on a secondary RSP card of a router
configured for HSA.
|
slot0:
|
Source or
destination URL of the first PCMCIA flash memory card.
|
slot1:
|
Source or
destination URL of the second PCMCIA flash memory card.
|
stby-bootflash:
|
Source or
destination URL for boot flash memory in standby RP.
|
stby-harddisk:
|
Source or
destination URL for the standby harddisk.
|
stby-usb
[ 0-1 ] :
|
Source or
destination URL for the Universal Serial Bus (USB) flash drive that has been
plugged into the router and is located on the standby RP.
|
usb [ 0-1
] :
|
Source or
destination URL for the Universal Serial Bus (USB) flash drive that has been
plugged into the router and is located on the active RP.
|
usbflash
0
9
:
|
Source or
destination URL for the Universal Serial Bus (USB) flash drive that has been
plugged into the router.
|
usbtoken
[0
9 ] :
|
Source or
destination URL for the USB eToken that has been plugged into the router.
|
Command Modes
Privileged EXEC
(#)
Diagnostic (diag)
Command History
Release
|
Modification
|
11.3T
|
This
command was introduced.
|
12.3(2)T
|
-
The
http:// and
https://
keywords were added as supported remote source locations (file system URL
prefixes) for files.
-
This command was enhanced to support copying files to servers that support SSH
and the scp.
|
12.2(14)S
|
This
command was integrated into Cisco IOS Release 12.2(14)S.
|
12.2(18)S
|
The
/verify and
/noverify keywords were added.
|
12.0(26)S
|
The
/verify and
/noverify keywords were integrated into Cisco IOS
Release 12.0(26)S.
|
12.3(4)T
|
The
/verify and
/noverify keywords were integrated into Cisco IOS
Release 12.3(4)T.
|
12.3(7)T
|
The
http:// and
https://
keywords were enhanced to support file uploads.
|
12.3(14)T
|
The
usbflash
0
9
: and
usbtoken
0
9
: keywords
were added to support USB storage.
|
12.2(28)SB
|
This
command was integrated into Cisco IOS Release 12.2(28)SB.
|
12.2(25)SG
|
This
command was integrated into Cisco IOS Release 12.2(25)SG.
|
12.4(11)T
|
This
command was integrated into the Cisco 7200VXR NPE-G2 platform.
|
12.2(33)SXH
|
This
command was integrated into Cisco IOS Release 12.2(33)SXH.
|
Cisco
IOS XE Release 2.1
|
The
Cisco ASR1000 series routers became available, and introduced the
copy command
in diagnostic mode.
|
Cisco
IOS XE Release 3.9S
|
The
command was integrated into Cisco IOS XE Release 3.9S.
|
Usage Guidelines
The fundamental
function of the
copy command
is to allow you to copy a file (such as a system image or configuration file)
from one location to another location. The source and destination for the file
is specified using a Cisco IOS File System URL, which allows you to specify any
supported local or remote file location. The file system being used (such as a
local memory source, or a remote server) dictates the syntax used in the
command.
Note
|
The
copy command
copies only one file at a time. The command does not allow you to copy multiple
files.
|
You can enter on
the command line all necessary source- and destination-URL information and the
username and password to use, or you can enter the
copy command
and have the router prompt you for any missing information.
For local file
systems, two commonly used aliases exist for the
system:running-config and
nvram:startup-config files; these aliases are
running-config and
startup-config , respectively.
Any software that
supports RFC1738 does not allow user name, path, or filename with pattern %xy,
where (where x and y are any two hexa values 0-f, 0-F)
Timesaver
|
Aliases are
used to reduce the amount of typing you need to perform. For example, it is
easier to type
copy
run
start (the abbreviated form of the
copy
running-config
startup-config command) than it is to type
copy
system:r
nvram:s
(the abbreviated form of the
copy
system:running-config
nvram:startup-config command). These aliases also
allow you to continue using some of the common commands used in previous
versions of Cisco IOS software.
|
Note
|
When
authorization is turned on for the
copy
(filesystem:[/filepath][/filename])
running-config command, only the
copy command
is authorized. The individual commands available in the copied file are not
authorized.
|
The entire
copying process may take several minutes and differs from protocol to protocol
and from network to network.
The colon is
required after the file system URL prefix keywords (such as
flash ). In
some cases, file system prefixes that did not require colons in earlier
software releases are allowed for backwards compatibility, but use of the colon
is recommended.
In the URL syntax
for
ftp: ,
http: ,
https: ,
rcp: ,
scp: and
tftp: , the
location is either an IP address or a host name. The filename is specified
relative to the directory used for file transfers.
The following
sections contain usage guidelines for the following topics:
Understanding
Invalid Combinations of Source and Destination
Some invalid
combinations of source and destination exist. Specifically, you cannot copy:
-
From a
running configuration to a running configuration
-
From a
startup configuration to a startup configuration
-
From a device
to the same device (for example, the
copy
flash:
flash: command is invalid)
Understanding
Character Descriptions
The table below
describes the characters that you may see during processing of the
copy command.
Table 5. copy Character Descriptions
Character
|
Description
|
!
|
For
network transfers, an exclamation point indicates that the copy process is
taking place. Each exclamation point indicates the successful transfer of ten
packets (512 bytes each).
|
.
|
For
network transfers, a period indicates that the copy process timed out. Many
periods in a row typically mean that the copy process may fail.
|
O
|
For
network transfers, an uppercase O indicates that a packet was received out of
order and the copy process may fail.
|
e
|
For flash
erasures, a lowercase e indicates that a device is being erased.
|
E
|
An
uppercase E indicates an error. The copy process may fail.
|
V
|
A series
of uppercase Vs indicates the progress during the verification of the image
checksum.
|
Understanding
Partitions
You cannot copy
an image or configuration file to a flash partition from which you are
currently running. For example, if partition 1 is running the current system
image, copy the configuration file or image to partition 2. Otherwise, the copy
operation will fail.
You can identify
the available flash partitions by entering the
show
file
system
EXEC command.
Using rcp
The rcp requires
a client to send a remote username upon each rcp request to a server. When you
copy a configuration file or image between the router and a server using rcp,
the Cisco IOS software sends the first valid username it encounters in the
following sequence:
-
The remote
username specified in the
copy command,
if a username is specified.
-
The username
set by the
ip
rcmd
remote-username global configuration command, if
the command is configured.
-
The remote
username associated with the current tty (terminal) process. For example, if
the user is connected to the router through Telnet and was authenticated
through the
username
command, the router software sends the Telnet username as the remote username.
-
The router
host name.
For the rcp copy
request to process, an account must be defined on the network server for the
remote username. If the network administrator of the destination server did not
establish an account for the remote username, this command will not run. If the
server has a directory structure, the configuration file or image is written to
or copied from the directory associated with the remote username on the server.
For example, if the system image resides in the home directory of a user on the
server, specify that username as the remote username.
If you are
writing to the server, the rcp server must be properly configured to accept the
rcp write request from the user on the router. For UNIX systems, add an entry
to the
.rhosts file
for the remote user on the rcp server. Suppose the router contains the
following configuration lines:
hostname Rtr1
ip rcmd remote-username User0
If the router IP
address translates to Router1.company.com, then the
.rhosts file
for User0 on the rcp server should contain the following line:
Router1.company.com Rtr1
Refer to the
documentation for your rcp server for more details.
If you are using
a personal computer as a file server, the computer must support the remote
shell protocol (rsh).
Using FTP
The FTP protocol
requires a client to send a username and password with each FTP request to a
remote FTP server. Use the
ip
ftp
username and
ip
ftp
password global configuration commands to specify
a default username and password for all copy operations to or from an FTP
server. Include the username in the
copy command
syntax if you want to specify a username for that copy operation only.
When you copy a
file from the router to a server using FTP, the Cisco IOS software sends the
first valid username that it encounters in the following sequence:
-
The username
specified in the
copy command,
if a username is specified.
-
The username
set by the
ip
ftp
username command, if the command is configured.
-
Anonymous.
The router sends
the first valid password in the following list:
-
The password
specified in the
copy command,
if a password is specified.
-
The password
set by the
ip
ftp
password command, if the command is configured.
-
The router
forms a password
username @routername .domain . The variable
username is
the username associated with the current session,
routername is
the configured host name, and
domain is the
domain of the router.
The username and
password must be associated with an account on the FTP server. If you are
writing to the server, the FTP server must be properly configured to accept the
FTP write request from the user on the router.
Note
|
The Syslog
message will display 'xxxx' in place of the password entered in the syntax of
the
copy {ftp: } command.
|
If the server has
a directory structure, the configuration file or image is written to or copied
from the directory associated with the username on the server. For example, if
the system image resides in the home directory of a user on the server, specify
that username as the remote username.
Refer to the
documentation for your FTP server for details on setting up the server.
Using HTTP or
HTTPS
Copying a file to
or from a remote HTTP or HTTPS server, to or from a local file system, is
performed using the embedded Secure HTTP client that is integrated in Cisco IOS
software. The HTTP client is enabled by default.
Downloading files
from a remote HTTP or HTTPS server is performed using the HTTP client
integrated in Cisco IOS software.
If a username and
password are not specified in the
copy command
syntax, the system uses the default HTTP client username and password, if
configured.
When you copy a
file from a remote HTTP or HTTPS server, the Cisco IOS software sends the first
valid username that it encounters in the following sequence:
-
The username
specified in the
copy command,
if a username is specified.
-
The username
set by the
ip
http
client
username command, if the command is configured.
-
Anonymous.
The router sends
the first valid password in the following list:
-
The password
specified in the
copy command,
if a password is specified.
-
The password
set by the
ip
http
client
password command, if the command is configured.
-
The router
forms the password
username @routername .domain . The variable
username is
the username associated with the current session,
routername is
the configured host name, and
domain is the
domain of the router.
Storing Images
on Servers
Use the
copy
flash:
destination-url command (for example,
copy
flash:
tftp: ) to copy a system image or boot image from
flash memory to a network server. You can use the copy of the image as a backup
copy. Also, you can also use the image backup file to verify that the image in
flash memory is the same as that in the original file.
Copying from a
Server to Flash Memory
Use the
copy
destination-url
flash:
command (for example,
copy
tftp:
flash: ) to copy an image from a server to flash
memory.
On Class B file
system platforms, the system provides an option to erase existing flash memory
before writing onto it.
Note
|
Verify the
image in flash memory before booting the image.
|
Verifying
Images
When copying a
new image to your router, you should confirm that the image was not corrupted
during the copy process. You can verify the integrity of the image in any of
the following ways:
Caution
|
If the checksum
values do not match, do not reboot the router. Instead, reissue the
copy command
and compare the checksums again. If the checksum is repeatedly wrong, copy the
original image back into flash memory
before you
reboot the router from flash memory. If you have a corrupted image in flash
memory and try to boot from flash memory, the router will start the system
image contained in ROM (assuming booting from a network server is not
configured). If ROM does not contain a fully functional system image, the
router might not function and will need to be reconfigured through a direct
console port connection.
|
-
Use the
/verify keyword.
-
Enable
automatic image verification by default by issuing the
file
verify
auto command. This command will automatically
check the integrity of each file that is copied via the
copy command
(without specifying the
/verify option) to the router unless the
/noverify
keyword is specified.
-
Use the UNIX
'diff' command. This method can also be applied to file types other than Cisco
IOS images. If you suspect that a file is corrupted, copy the suspect file and
the original file to a UNIX server. (The file names may need to be modified if
you try to save the files in the same directory.) Then run the UNIX 'diff'
command on the two files. If there is no difference, then the file has not been
corrupted.
Copying a
Configuration File from a Server to the Running Configuration
Use the
copy {ftp: |
rcp: |
scp: |
tftp:
running-config command to load a configuration file
from a network server to the running configuration of the router. (Note that
running-config is the alias for the
system:running-config keyword.) The configuration
will be added to the running configuration as if the commands were typed in the
command-line interface (CLI). Thus, the resulting configuration file will be a
combination of the previous running configuration and the loaded configuration
file, with the loaded configuration file having precedence.
You can copy
either a host configuration file or a network configuration file. Accept the
default value of
host to copy
and load a host configuration file containing commands that apply to one
network server in particular. Enter
network to
copy and load a network configuration file containing commands that apply to
all network servers on a network.
Copying a
Configuration File from a Server to the Startup Configuration
Use the
copy {ftp: |
rcp: |
scp: |
tftp: }
nvram:startup-config command to copy a
configuration file from a network server to the router startup configuration.
These commands replace the startup configuration file with the copied
configuration file.
Storing the
Running or Startup Configuration on a Server
Use the
copy
system:running-config {ftp: |
rcp: |
scp: |
tftp: }
command to copy the current configuration file to a network server using FTP,
rcp, scp, or TFTP. Use the
copy
nvram:startup-config {ftp: |
rcp: |
scp: |
tftp: }
command to copy the startup configuration file to a network server.
The configuration
file copy can serve as a backup copy.
Saving the
Running Configuration to the Startup Configuration
Use the
copy
system:running-config
nvram:startup-config command to copy the running
configuration to the startup configuration.
Note
|
Some specific
commands might not get saved to NVRAM. You will need to enter these commands
again if you reboot the machine. These commands are noted in the documentation.
We recommend that you keep a listing of these settings so you can quickly
reconfigure your router after rebooting.
|
If you issue the
copy
system:running-config
nvram:startup-config command from a bootstrap
system image, a warning will instruct you to indicate whether you want your
previous NVRAM configuration to be overwritten and configuration commands to be
lost. This warning does not appear if NVRAM contains an invalid configuration
or if the previous configuration in NVRAM was generated by a bootstrap system
image.
On all platforms
except Class A file system platforms, the
copy
system:running-config
nvram:startup-config command copies the currently
running configuration to NVRAM.
On the Class A
flash file system platforms, the
copy
system:running-config
nvram:startup-config command copies the currently
running configuration to the location specified by the CONFIG_FILE environment
variable. This variable specifies the device and configuration file used for
initialization. When the CONFIG_FILE environment variable points to NVRAM or
when this variable does not exist (such as at first-time startup), the software
writes the current configuration to NVRAM. If the current configuration is too
large for NVRAM, the software displays a message and stops executing the
command.
When the
CONFIG_FILE environment variable specifies a valid device other than
nvram: (that
is,
flash: ,
bootflash: ,
slot0: , or
slot1: ), the
software writes the current configuration to the specified device and filename,
and stores a distilled version of the configuration in NVRAM. A distilled
version is one that does not contain access list information. If NVRAM already
contains a copy of a complete configuration, the router prompts you to confirm
the copy.
Using
CONFIG_FILE, BOOT, and BOOTLDR Environment Variables
For the Class A
flash file system platforms, specifications are as follows:
-
The
CONFIG_FILE environment variable specifies the configuration file used during
router initialization.
-
The BOOT
environment variable specifies a list of bootable images on various devices.
-
The BOOTLDR
environment variable specifies the flash device and filename containing the
rxboot image that ROM uses for booting.
-
Cisco 3600
routers do not use a dedicated boot helper image (rxboot), which many other
routers use to help with the boot process. Instead, the BOOTLDR ROM monitor
environment variable identifies the flash memory device and filename that are
used as the boot helper; the default is the first system image in flash memory.
To view the
contents of environment variables, use the
show
bootvar EXEC command. To modify the CONFIG_FILE
environment variable, use the
boot
config global configuration command. To modify the
BOOTLDR environment variable, use the
boot
bootldr global configuration command. To modify
the BOOT environment variable, use the
boot
system global configuration command. To save your
modifications, use the
copy
system:running-config
nvram:startup-config command.
When the
destination of a
copy command
is specified by the CONFIG_FILE or BOOTLDR environment variable, the router
prompts you for confirmation before proceeding with the copy. When the
destination is the only valid image in the BOOT environment variable, the
router also prompts you for confirmation before proceeding with the copy.
Using the Copy
Command with the Dual RSP Feature
The Dual RSP
feature allows you to install two Route Switch Processor (RSP) cards in a
single router on the Cisco 7507 and Cisco 7513 platforms.
On a Cisco 7507 or Cisco 7513 router configured for Dual RSPs, if you copy a file to
nvram:startup-configuration with automatic
synchronization disabled, the system prompts whether you also want to copy the file
to the secondary startup configuration. The default answer is
yes . If automatic synchronization is enabled, the
system automatically copies the file to the secondary startup configuration each
time you use a copy command with
nvram:startup-configuration as the destination.
Using the copy
command with the ASR1000 Series Routers
The
copy command
is available in both privileged EXEC and diagnostic mode on the Cisco ASR1000
series routers. Because the
copy command
is available in diagnostic mode, it can be used to copy all types of files
between directories and remote locations even in the event of an IOS failure.
Examples
The following
examples illustrate uses of the
copy command:
Examples
The following
example shows how to specify image verification before copying an image:
Router# copy /verify tftp://10.1.1.1/cisco/c7200-js-mz disk0:
Destination filename [c7200-js-mz]?
Accessing tftp://10.1.1.1/cisco/c7200-js-mz...
Loading cisco/c7200-js-mz from 10.1.1.1 (via FastEthernet0/0):!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
[OK - 19879944 bytes]
19879944 bytes copied in 108.632 secs (183003 bytes/sec)
Verifying file integrity of disk0:/c7200-js-mz ...................................................
...................................................................................................
...................................................................................................
.......................................Done!
Embedded Hash MD5 :CFA258948C4ECE52085DCF428A426DCD
Computed Hash MD5 :CFA258948C4ECE52085DCF428A426DCD
CCO Hash MD5 :44A7B9BDDD9638128C35528466318183
Signature Verified
Examples
The following
examples use a
copy
rcp: ,
copy
tftp: , or
copy
ftp: command to copy an image file from a server
to flash memory:
Examples
The following
example copies a system image named file1 from the remote rcp server with an IP
address of 172.16.101.101 to flash memory. On Class B file system platforms,
the Cisco IOS software allows you to first erase the contents of flash memory
to ensure that enough flash memory is available to accommodate the system
image.
Router#
copy rcp://netadmin@172.16.101.101/file1 flash:file1
Destination file name [file1]?
Accessing file 'file1' on 172.16.101.101...
Loading file1 from 172.16.101.101 (via Ethernet0): ! [OK]
Erase flash device before writing? [confirm]
Flash contains files. Are you sure you want to erase? [confirm]
Copy 'file1' from server
as 'file1' into Flash WITH erase? [yes/no] yes
Erasing device... eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee...erased
Loading file1 from 172.16.101.101 (via Ethernet0): !
[OK - 984/8388608 bytes]
Verifying checksum... OK (0x14B3)
Flash copy took 0:00:01 [hh:mm:ss]
Examples
The following
example copies a system image into a partition of flash memory. The system will
prompt for a partition number only if there are two or more read/write
partitions or one read-only and one read/write partition and dual flash bank
support in boot ROMs. If the partition entered is not valid, the process
terminates. You can enter a partition number, a question mark (? ) for a directory display of all partitions, or a
question mark and a number (?
number ) for
directory display of a particular partition. The default is the first
read/write partition. In this case, the partition is read-only and has dual
flash bank support in boot ROM, so the system uses flash Load Helper.
Router# copy tftp: flash:
System flash partition information:
Partition Size Used Free Bank-Size State Copy-Mode
1 4096K 2048K 2048K 2048K Read Only RXBOOT-FLH
2 4096K 2048K 2048K 2048K Read/Write Direct
[Type ?<no> for partition directory; ? for full directory; q to abort]
Which partition? [default = 2]
**** NOTICE ****
Flash load helper v1.0
This process will accept the copy options and then terminate
the current system image to use the ROM based image for the copy.
Routing functionality will not be available during that time.
If you are logged in via telnet, this connection will terminate.
Users with console access can see the results of the copy operation.
---- ******** ----
Proceed? [confirm]
System flash directory, partition 1:
File Length Name/status
1 3459720 master/igs-bfpx.100-4.3
[3459784 bytes used, 734520 available, 4194304 total]
Address or name of remote host [255.255.255.255]? 172.16.1.1
Source file name? master/igs-bfpx-100.4.3
Destination file name [default = source name]?
Loading master/igs-bfpx.100-4.3 from 172.16.1.111: !
Erase flash device before writing? [confirm]
Flash contains files. Are you sure? [confirm]
Copy 'master/igs-bfpx.100-4.3' from TFTP server
as 'master/igs-bfpx.100-4.3' into Flash WITH erase? [yes/no] yes
Examples
The following
example copies the file c3600-i-mz from the rcp server at IP address
172.23.1.129 to the flash memory card in slot 0 of a Cisco 3600 series router,
which has only one partition. As the operation progresses, the Cisco IOS
software prompts you to erase the files on the flash memory PC card to
accommodate the incoming file. This entire operation takes 18 seconds to
perform, as indicated at the end of the example.
Router# copy rcp: slot0:
PCMCIA Slot0 flash
Partition Size Used Free Bank-Size State Copy Mode
1 4096K 3068K 1027K 4096K Read/Write Direct
2 4096K 1671K 2424K 4096K Read/Write Direct
3 4096K 0K 4095K 4096K Read/Write Direct
4 4096K 3825K 270K 4096K Read/Write Direct
[Type ?<no> for partition directory; ? for full directory; q to abort]
Which partition? [default = 1]
PCMCIA Slot0 flash directory, partition 1:
File Length Name/status
1 3142288 c3600-j-mz.test
[3142352 bytes used, 1051952 available, 4194304 total]
Address or name of remote host [172.23.1.129]?
Source file name? /tftpboot/images/c3600-i-mz
Destination file name [/tftpboot/images/c3600-i-mz]?
Accessing file '/tftpboot/images/c3600-i-mz' on 172.23.1.129...
Connected to 172.23.1.129
Loading 1711088 byte file c3600-i-mz: ! [OK]
Erase flash device before writing? [confirm]
Flash contains files. Are you sure you want to erase? [confirm]
Copy '/tftpboot/images/c3600-i-mz' from server
as '/tftpboot/images/c3600-i-mz' into Flash WITH erase? [yes/no]
yes
Erasing device... eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee ...erased
Connected to 172.23.1.129
Loading 1711088 byte file c3600-i-mz: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Verifying checksum... OK (0xF89A)
Flash device copy took 00:00:18 [hh:mm:ss]
Examples
The following
examples use
copy commands
to copy image files to a server for storage:
Examples
The following
example copies a system image from flash Memory to an rcp server using the
default remote username. Because the rcp server address and filename are not
included in the command, the router prompts for it.
Router#
copy flash: rcp:
IP address of remote host [255.255.255.255]? 172.16.13.110
Name of file to copy? gsxx
writing gsxx - copy complete
Examples
The following
example shows how to use scp to copy a system image from flash memory to a
server that supports SSH:
Router# copy flash:c4500-ik2s-mz.scp scp://user1@host1/
Address or name of remote host [host1]?
Destination username [user1]?
Destination filename [c4500-ik2s-mz.scp]?
Writing c4500-ik2s-mz.scp
Password:
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Before you can
use the server-side functionality, SSH, authentication, and authorization must
be properly configured so the router can determine whether a user is at the
right privilege level. The scp server-side functionality is configured with
the
ip
scp
server
enable command.
Examples
The following
example copies an image from a particular partition of flash memory to an rcp
server using a remote username of netadmin1.
The system will
prompt if there are two or more partitions. If the partition entered is not
valid, the process terminates. You have the option to enter a partition number,
a question mark (? ) for a
directory display of all partitions, or a question mark and a number (?
number ) for a
directory display of a particular partition. The default is the first
partition.
Router# configure terminal
Router# ip rcmd remote-username netadmin1
Router# end
Router# copy flash: rcp:
System flash partition information:
Partition Size Used Free Bank-Size State Copy-Mode
1 4096K 2048K 2048K 2048K Read Only RXBOOT-FLH
2 4096K 2048K 2048K 2048K Read/Write Direct
[Type ?<number> for partition directory; ? for full directory; q to abort]
Which partition? [1] 2
System flash directory, partition 2:
File Length Name/status
1 3459720 master/igs-bfpx.100-4.3
[3459784 bytes used, 734520 available, 4194304 total]
Address or name of remote host [ABC.CISCO.COM]?
Source file name? master/igs-bfpx.100-4.3
Destination file name [master/igs-bfpx.100-4.3]?
Verifying checksum for 'master/igs-bfpx.100-4.3' (file # 1)... OK
Copy 'master/igs-bfpx.100-4.3' from Flash to server
as 'master/igs-bfpx.100-4.3'? [yes/no] yes
!!!!...
Upload to server done
Flash copy took 0:00:00 [hh:mm:ss]
Examples
The following
example copies the file c3600-i-mz from partition 1 of the flash memory card in
slot 0 to an FTP server at IP address 172.23.1.129:
Router# show slot0: partition 1
PCMCIA Slot0 flash directory, partition 1:
File Length Name/status
1 1711088 c3600-i-mz
[1711152 bytes used, 2483152 available, 4194304 total]
Router# copy slot0:1:c3600-i-mz ftp://myuser:mypass@172.23.1.129/c3600-i-mz
Verifying checksum for '/tftpboot/cisco_rules/c3600-i-mz' (file # 1)... OK
Copy '/tftpboot/cisco_rules/c3600-i-mz' from Flash to server
as 'c3700-i-mz'? [yes/no] yes
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Upload to server done
Flash device copy took 00:00:23 [hh:mm:ss]
Examples
The following
example copies an image from boot flash memory to a TFTP server:
Router#
copy bootflash:file1 tftp://192.168.117.23/file1
Verifying checksum for 'file1' (file # 1)... OK
Copy 'file1' from Flash to server
as 'file1'? [yes/no]y
!!!!...
Upload to server done
Flash copy took 0:00:00 [hh:mm:ss]
Examples
The following
example copies and runs a configuration filename host1-confg from the netadmin1
directory on the remote server with an IP address of 172.16.101.101:
Router#
copy rcp://netadmin1@172.16.101.101/host1-confg system:running-config
Configure using host1-confg from 172.16.101.101? [confirm]
Connected to 172.16.101.101
Loading 1112 byte file host1-confg:![OK]
Router#
%SYS-5-CONFIG: Configured from host1-config by rcp from 172.16.101.101
Examples
The following
example copies a configuration file host2-confg from a remote FTP server to the
startup configuration. The IP address is 172.16.101.101, the remote username is
netadmin1, and the remote password is ftppass.
Router#
copy ftp://netadmin1:ftppass@172.16.101.101/host2-confg nvram:startup-config
Configure using rtr2-confg from 172.16.101.101?[confirm]
Connected to 172.16.101.101
Loading 1112 byte file rtr2-confg:![OK]
[OK]
Router#
%SYS-5-CONFIG_NV:Non-volatile store configured from rtr2-config by
FTP from 172.16.101.101
Examples
The following
example specifies a remote username of netadmin1. Then it copies the running
configuration file named rtr2-confg to the netadmin1 directory on the remote
host with an IP address of 172.16.101.101.
Router# configure terminal
Router(config)# ip rcmd remote-username netadmin1
Router(config)#
end
Router#
copy system:running-config rcp:
Remote host[]? 172.16.101.101
Name of configuration file to write [Rtr2-confg]?
Write file rtr2-confg on host 172.16.101.101?[confirm]
Building configuration...[OK]
Connected to 172.16.101.101
Examples
The following
example copies the startup configuration to a TFTP server:
Router#
copy nvram:startup-config tftp:
Remote host[]? 172.16.101.101
Name of configuration file to write [rtr2-confg]? <cr>
Write file rtr2-confg on host 172.16.101.101?[confirm] <cr>
![OK]
Examples
The following
example copies the running configuration to the startup configuration. On a
Class A flash file system platform, this command copies the running
configuration to the startup configuration specified by the CONFIG_FILE
variable.
copy system:running-config nvram:startup-config
The following
example shows the warning that the system provides if you try to save
configuration information from bootstrap into the system:
Router(boot)# copy system:running-config nvram:startup-config
Warning: Attempting to overwrite an NVRAM configuration written
by a full system image. This bootstrap software does not support
the full configuration command set. If you perform this command now,
some configuration commands may be lost.
Overwrite the previous NVRAM configuration?[confirm]
Enter no to
escape writing the configuration information to memory.
Examples
On some routers,
you can store copies of configuration files on a flash memory device. Five
examples follow:
Examples
The following
example copies the startup configuration file (specified by the CONFIG_FILE
environment variable) to a flash memory card inserted in slot 0:
Router# copy nvram:startup-config slot0:router-confg
Examples
The following
example copies the running configuration from the router to the flash memory PC
card in slot 0:
Router# copy system:running-config slot0:berlin-cfg
Building configuration...
5267 bytes copied in 0.720 secs
Examples
The following
example copies the file named ios-upgrade-1 from the flash memory card in slot
0 to the running configuration:
Router# copy slot0:4:ios-upgrade-1 system:running-config
Copy
'ios-upgrade-1
' from flash device
as 'running-config' ? [yes/no] yes
Examples
The following
example copies the router-image file from the flash memory to the startup
configuration:
Router# copy flash:router-image nvram:startup-config
Examples
The following
example copies the file running-config from the first partition in internal
flash memory to the flash memory PC card in slot 1. The checksum of the file is
verified, and its copying time of 30 seconds is displayed.
Router# copy flash: slot1:
System flash
Partition Size Used Free Bank-Size State Copy Mode
1 4096K 3070K 1025K 4096K Read/Write Direct
2 16384K 1671K 14712K 8192K Read/Write Direct
[Type ?<no> for partition directory; ? for full directory; q to abort]
Which partition? [default = 1]
System flash directory, partition 1:
File Length Name/status
1 3142748 dirt/images/mars-test/c3600-j-mz.latest
2 850 running-config
[3143728 bytes used, 1050576 available, 4194304 total]
PCMCIA Slot1 flash directory:
File Length Name/status
1 1711088 dirt/images/c3600-i-mz
2 850 running-config
[1712068 bytes used, 2482236 available, 4194304 total]
Source file name? running-config
Destination file name [running-config]?
Verifying checksum for 'running-config' (file # 2)... OK
Erase flash device before writing? [confirm]
Flash contains files. Are you sure you want to erase? [confirm]
Copy 'running-config' from flash: device
as 'running-config' into slot1: device WITH erase? [yes/no] yes
Erasing device... eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee ...erased
!
[OK - 850/4194304 bytes]
Flash device copy took 00:00:30 [hh:mm:ss]
Verifying checksum... OK (0x16)
Examples
In the following
example, the file config1 is copied from a remote server to flash memory using
HTTP:
Router# copy
http://
www.example.com:8080/configs/config1 flash:config1
In the following
example, a default username and password for HTTP Client communications is
configured, and then the file sample.scr is copied from a secure HTTP server
using HTTPS:
Router# configure terminal
Router(config)# ip http client username joeuser
Router(config)# ip http client password letmein
Router(config)# end
Router# copy https://www.example_secure.com/scripts/sample.scr flash:
In the following
example, an HTTP proxy server is specified before using the copy http://
command:
Router# configure terminal
Router(config)# ip http client proxy-server edge2 proxy-port 29
Router(config)# end
Router# copy
http://
www.example.com/configs/config3 flash:/configs/config3
Examples
The following example copies the router-image file from the flash memory card inserted in slot
1 of the primary RSP card to slot 0 of the secondary RSP card in the same router:
Router# copy slot1:router-image slaveslot0: