Copies a file from the specified file system or relative to the current working directory to another file on the specified file system or relative to the current working directory.
old_name | Specifies the name of the file that you want to copy. |
new_name | Specifies the name of the newly copied configuration or policy file. |
N/A.
Use this command to copy a file from the specified file system or relative to the current working directory to another file on the specified file system or relative to the current working directory. This command provides the functionality to replicate an existing file by creating a new entry in the file system, reading the content of the existing file and writing that content to the new one. If given a different name, the new file can be created in the same directory as the existing file.
When you copy a configuration or policy file from the system, make sure youspecify the appropriate file extension. For example, when you want to copy a policy file, specify the filename and .pol.
When you copy a file on the switch, the switch displays a message similar to the following:
Copy config test.cfg to config test1.cfg on switch? (y/n)
Enter y to copy the file. Enter n to cancel this process and not copy the file.
When you enter y, the switch copies the file with the new name and keeps a backup of the original file with the original name. After the switch copies the file, use the ls command to display a complete list of files. In this example, the switch displays the original file named test.cfg and the copied file named test_rev2.cfg.
The following is sample output from the ls command:
... -rw-r--r-- 1 root root 100980 Sep 23 09:16 test.cfg -rw-r--r-- 1 root root 100980 Oct 13 08:47 test_rev2.cfg ...
When you enter n, the switch displays a message similar to the following:
Copy cancelled.
For the memorycard option, the source and/or destination is a compact flash card or USB 2.0 storage device. You must mount the compact flash card or USB storage device for this operation to succeed. The cp command copies a file from the switch to the compact flash card, the USB storage device, or a file already on one of those devices. If you copy a file from the switch to the removable storage device, and the new filename is identical to the source file, you do not need to re-enter the filename.
Filenames are case-sensitive. In this example, you have a configuration file named Test.cfg. If you attempt to copy the file with the incorrect case, for example test.cfg, the switch displays a message similar to the following:
Error: cp: /config/test.cfg: No such file or directory
Since the switch is unable to locate test.cfg, the file is not copied.
This section provides information about the characters supported by the switch for local filenames.
When naming a local file, remember the requirements listed above.
Core dump files have a .gz file extension. The filename format is: core.process-name.pid.gz where process-name indicates the name of the process that failed and pid is the numerical identifier of that process.
By making a copy of a core dump file, you can easily compare new debug information with the old file if needed.
When you configure and enable the switch to send core dump (debug) information to the internal memory card, specify the internal-memory option and associated internal-memory name options to copy an existing core dump file.
If you have an external compact flash card or a USB 2.0 storage device installed, you can copy the core dump file to that location. When you send core dump information to a removable storage device, specify the memorycard option and associated memorycard name options to copy an existing core dump file.
For information about configuring and sending core dump information to the internal memory card, see the configure debug core-dumps and save debug tracefiles memorycard commands.
For more detailed information about core dump files, see Troubleshooting.
The following example makes a copy of a configuration file named test.cfg and gives the copied file a new name of test_rev2.cfg:
cp test.cfg test_rev2.cfg
The following example makes a copy of a configuration file named primary.cfg on the switch and stores the copy on the removable storage device with the same name, primary.cfg:
cp primary.cfg /usr/local/ext
The above command performs the same action as entering:
cp primary.cfg /usr/local/ext OR cp primary.cfg /usr/local/ext/primary.cfg
This command was first available in ExtremeXOS 11.0.
The memorycard option was added in ExtremeXOS 11.1.
The internal-memory option was added in ExtremeXOS 11.4.
Support for USB 2.0 storage devices was added in ExtremeXOS 12.5.3.
Pathname support was added in ExtremeXOS 15.5.1.
This command is available on the Summit X450-G2, X460-G2, X670-G2, X770, and ExtremeSwitching X440-G2, X620, X690, X870 series switches.