Cisco Nexus 1000V System Management Configuration Guide, Release 4.2(1)SV1(4b)
Working with Files
Downloads: This chapterpdf (PDF - 215.0KB) The complete bookPDF (PDF - 4.06MB) | Feedback

Table Of Contents

Working with Files

Information About Files

Navigating the File System

Specifying File Systems

Identifying the Directory You are Working From

Changing Your Directory

Listing the Files in a File System

Identifying Available File Systems for Copying Files

Using Tab Completion

Copying and Backing Up Files

Creating a Directory

Removing an Existing Directory

Moving Files

Deleting Files or Directories

Compressing Files

Uncompressing Files

Directing Command Output to a File

Verifying a Configuration File before Loading

Rolling Back to a Previous Configuration

Displaying Files

Displaying File Contents

Displaying Directory Contents

Displaying File Checksums

Displaying the Last Lines in a File

Feature History for File Management


Working with Files


This section includes the following topics:

Information About Files

Navigating the File System

Copying and Backing Up Files

Creating a Directory

Removing an Existing Directory

Moving Files

Deleting Files or Directories

Compressing Files

Uncompressing Files

Directing Command Output to a File

Verifying a Configuration File before Loading

Rolling Back to a Previous Configuration

Displaying Files

Feature History for File Management

Information About Files

The Cisco Nexus 1000V file system provides a single interface to all the file systems the switch uses, including:

Flash memory file systems

Network file systems (TFTP and FTP)

Any other endpoint for reading or writing data (such as the running configuration)

Navigating the File System

This section describes how to navigate the file system and includes the following topics:

Specifying File Systems

Identifying the Directory You are Working From

Changing Your Directory

Listing the Files in a File System

Identifying Available File Systems for Copying Files

Using Tab Completion

Specifying File Systems

The syntax for specifying a file system is <file system name>:[//server/]. Table 6-1 describes file system syntax.

Table 6-1 File System Syntax Components 

File System Name
Server
Description

bootflash

sup-active
sup-local
sup-1
module-1

Internal memory located on the active supervisor used for storing system images, configuration files, and other miscellaneous files. Cisco Nexus 1000V CLI defaults to the bootflash: file system.

sup-standby
sup-remote
sup-2
module-2

Internal memory located on the standby supervisor used for storing system images, configuration files, and other miscellaneous files.

volatile

Volatile random-access memory (VRAM) located on a supervisor module used for temporary or pending changes.


Identifying the Directory You are Working From

Use this procedure to display the directory name of your current CLI location.

BEFORE YOU BEGIN

Before using this command, you must know or do the following:

You are logged in to the CLI.

DETAILED STEPS

Step
Command
Purpose

Step 1 

pwd

Example:
n1000v# pwd
bootflash:

Displays the present working directory.

Changing Your Directory

Use this procedure to change your location in the CLI, from one directory or file system to another.

BEFORE YOU BEGIN

Before using this command, you must know or do the following:

You are logged in to the CLI in any command mode.

Cisco Nexus 1000V CLI defaults to the bootflash: file system.


Tip Any file saved in the volatile: file system is erased when the switch reboots.


DETAILED STEPS

Step
Command
Purpose

Step 1 

pwd

Example:
n1000v# pwd
volatile:
n1000v# 

Displays the directory name of your current CLI location.

Step 2 

cd directory name

Changes your CLI location to the specified directory.

Example:
n1000v# cd bootflash: 

Changes your CLI location to the root directory on the bootflash: file system.

Example:
n1000v# cd bootflash:mydir

Changes your CLI location to the mydir directory that resides in the bootflash: file system.

Example:
n1000v# cd mystorage

Changes your CLI location to the mystorage directory that resides within the current directory.

If the current directory were bootflash: mydir, this command changes the current directory to bootflash: mydir/mystorage.

Listing the Files in a File System

Use this procedure to display the contents of a directory or file.

DETAILED STEPS

Step
Command
Purpose

Step 1 

dir [directory | filename]

Displays the contents of a directory or file.

Example:
DCOS-112-R5# dir lost+found/
      49241     Jul 01 09:30:00 2008  diagclient_log.2613
      12861     Jul 01 09:29:34 2008  diagmgr_log.2580
         31     Jul 01 09:28:47 2008  dmesg
       1811     Jul 01 09:28:58 2008  example_test.2633
         89     Jul 01 09:28:58 2008  libdiag.2633
      42136     Jul 01 16:34:34 2008  messages
         65     Jul 01 09:29:00 2008  otm.log
        741     Jul 01 09:29:07 2008  sal.log
         87     Jul 01 09:28:50 2008  startupdebug
 
 
Usage for log://sup-local
   51408896 bytes used
  158306304 bytes free
  209715200 bytes total
DCOS-112-R5# 
 
 

Identifying Available File Systems for Copying Files

Use this procedure to identify the file systems you can copy to or from.

BEFORE YOU BEGIN

Before using this procedure, you must know or do the following:

You are logged in to the CLI in EXEC mode.

DETAILED STEPS

Step
Command
Purpose

Step 1 

copy ?

 
      

Displays the source file systems available to the copy command.

Step 2 

copy filename ?

Example:
n1000v# copy ?
bootflash: Select source filesystem
core: Select source filesystem
debug: Select source filesystem
ftp: Select source filesystem
licenses Backup license files
log: Select source filesystem
nvram: Select source filesystem
running-config Copy running configuration to 
destination
scp: Select source filesystem
sftp: Select source filesystem
startup-config Copy startup configuration to 
destination
system: Select source filesystem
tftp: Select source filesystem
volatile: Select source filesystem

Displays the destination file systems available to the copy command for a specific file.

Using Tab Completion

Use this procedure to have the CLI complete a partial file name in a command.

 
Command
Purpose

Step 1 

show file filesystem name: partial filename <Tab>

Example:

n1000v# show file bootflash:nexus-1000v-
bootflash:nexus-1000v-dplug-mzg.4.0.4.SV1.
0.42.bin      
bootflash:nexus-1000v-mzg.4.0.4.SV1.0.42.b
in
bootflash:nexus-1000v-kickstart-mzg.4.0.4.
SV1.0.42.bin

When you type a partial filename and then press Tab, the CLI completes the file name if the characters you typed are unique to a single file.

If not, the CLI lists a selection of file names that match the characters you typed.

You can then retype enough characters to make the file name unique; and CLI completes the file name for you.

Step 2 

show file bootflash:c <Tab>
Example:
n1000v# show file bootflash:c<Tab>
-----BEGIN RSA PRIVATE KEY-----
MIICXgIBAAKBgQDSq93BrlHcg3bX1jXDMY5c9+yZSS
T3VhuQBqogvCPDGeLecA+j
...
...
n1000v#

The CLI completes the file name for you.

Copying and Backing Up Files

Use this procedure to copy a file, such as a configuration file, to save it or reuse it at another location. 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 existing configuration files.

BEFORE YOU BEGIN

Before beginning this procedure, you must know or do the following:

You are logged in to the CLI through a Telnet, or SSH connection.

If copying to a remote location, make sure that your device has a route to the destination. Your device and the remote destination must be in the same subnetwork if you do not have a router or default gateway to route traffic between subnets.

Using the ping command, make sure that your device has connectivity to the destination.

Make sure that the source configuration file is in the correct directory on the remote server.

Make sure that the permissions on the source file are set correctly. Permissions on the file should be set to world-read.


Note Use the dir command to ensure that enough space is available in the destination file system. If enough space is not available, use the delete command to remove unneeded files.


File System
Server
File Name

bootflash

sup-active
sup-standby
sup-1 or module-1
sup-2 or module-2
sup-local
sup-remote

User-specified

volatile

User-specified

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 limitation of TFTP restricts file size to 32 MB on the TFTP client and 16 MB on some TFTP servers .


DETAILED STEPS

Step
Command
Purpose

Step 1 

copy [source filesystem:] filename   [destination filesystem:] filename

 
      

Copies a file from the specified source location to the specified destination location.

 
Example:
n1000v# copy system:running-config 
tftp://10.10.1.1/home/configs/switch3-run.cfg 

Saves a copy of the running configuration to a remote switch.

 
Example:
n1000v# copy bootflash:system_image 
bootflash://sup-2/system_image

Copies a file from bootflash in the active supervisor module to bootflash in the standby supervisor module.

 
Example:
n1000v# copy system:running-config 
bootflash:my-config

Copies a running configuration to the bootflash: file system.

 
Example:
n1000v# copy scp://user@10.1.7.2/system-image 
bootflash:system-image

Copies a system image file from the SCP server identified by an IPv4 address to bootflash.

 
Example:

n1000v# copy sftp://172.16.10.100/myscript.txt volatile:myscript.txt

Copies a script file from the SFTP server identified by an IPv4 address to the volatile: file system.

 
Example:

n1000v# copy system:running-config bootflash:my-config

Places a back up copy of the running configuration on the bootflash: file system (ASCII file).

 
Example:
n1000v# copy bootflash:samplefile 
bootflash:mystorage/samplefile 

Copies the file called samplefile from the root directory of the bootflash: file system to the mystorage directory.

 
Example:

n1000v# copy samplefile mystorage/samplefile

Copies a file within the current file system.

 
Example:
n1000v# copy 
tftp://10.10.1.1/home/configs/switch3-run.cfg 
system:running-config

Copies the source file to the running configuration on the switch, and configures the switch as the file is parsed line by line.

Creating a Directory

Use this procedure to create a directory at the current directory level or at a specified directory level.

Step
Command
Purpose

Step 1 

mkdir directory name

dir filename

Creates a directory at the current directory level

example:

n1000v# mkdir bootflash:test

n1000v# 

Creates a directory called test in the bootflash: directory.

example:
n1000v# mkdir test
n1000v#

Creates a directory called test at the current directory level. If the current directory is bootflash:mydir, this command creates a directory called bootflash:mydir/test.

Removing an Existing Directory

Use this section to remove an existing directory from the Flash file system.

BEFORE YOU BEGIN

Before using this command, you must know or do the following:

You are logged in to the CLI.

This command is only valid on Flash file systems.

Before you can remove it, the directory must be empty.

DETAILED STEPS

Step
Command
Purpose

Step 1 

rmdir {bootflash: | debug: | volatile:} directory

Removes a directory.

example:
n1000v# rmdir bootflash:test
n1000v#

Removes the directory called test in the bootflash directory.

example:
n1000v# rmdir test
n1000v#

Removes the directory called test at the current directory level. If the current directory is bootflash:mydir, this command deletes the bootflash:mydir/test directory.

Moving Files

Use this procedure to move a file from one location to another location.

BEFORE YOU BEGIN

Before using this command, you must know or do the following:

You are logged in to the CLI.

The copy will not complete if there is not enough space in the destination directory.


Caution If a file with the same name already exists in the destination directory, that file is overwritten by the moved file.

DETAILED STEPS

Step
Command
Purpose

Step 1 

move {source path and filename}   {destination path and filename}

 
      

Deletes a directory.

Example:
n1000v# move bootflash:samplefile 
bootflash:mystorage/samplefile

Moves the file from one directory to another in the same file system (bootflash:).

Example:
n1000v# move samplefile mystorage/samplefile

Moves the file from one directory to another in the current file system.

Deleting Files or Directories

Use this procedure to delete files or directories on a Flash Memory device.

BEFORE YOU BEGIN


Caution When deleting, if you specify a directory name instead of a file name, the entire directory and its contents are deleted.

When you delete a file, the software erases the file.

If you attempt to delete the configuration file or image specified by the CONFIG_FILE or BOOTLDR environment variable, the system prompts you to confirm the deletion.

If you attempt to delete the last valid system image specified in the BOOT environment variable, the system prompts you to confirm the deletion.

DETAILED STEPS

Step
Command
Purpose

Step 1 

delete [bootflash: | debug: | log: | volatile:] filename or directory name

Example:
n1000v# delete bootflash:dns_config.cfg

Deletes a specified file or directory.

 
Example:
n1000v# delete dns_config.cfg

Deletes the named file from the current working directory.

 
Example:
n1000v# delete bootflash:my-dir

Deletes the named directory and its contents.

Compressing Files

Use this procedure to compress (zip) a specified file using LZ77 coding.

BEFORE YOU BEGIN

You are logged in to the CLI.

DETAILED STEPS

Step
Command
Purpose

Step 1 

show command > [path] filename

 
      
Example:
n1000v# show system internal l2fm 
event-history errors
n1000v# 

Directs show command output to a file.

Step 2 

dir

Example:
n1000v# dir

Displays the contents of the current directory, including the new file created in the first step.

Step 3 

gzip [path] filename

Example:
n1000v# gzip bootflash:errorsfile

n1000v#

Compresses the specified file

Step 4 

dir

Example:
n1000v# dir

Displays the contents of the specified directory, including the newly-compressed file. Shows the difference in the file size of the newly-compressed file.

Example:
n1000v# show system internal l2fm event-history errors >errorsfile
n1000v# dir
       2687     Jul 01 18:17:20 2008  errorsfile
      16384     Jun 30 05:17:51 2008  lost+found/
       4096     Jun 30 05:18:29 2008  routing-sw/
         49     Jul 01 17:09:18 2008  sample_test.txt
    1322843     Jun 30 05:17:56 2008  nexus-1000v-dplug-mzg.4.0.4.SV1.0.42.bin
   21629952     Jun 30 05:18:02 2008  nexus-1000v-kickstart-mzg.4.0.4.SV1.0.42.bin
   39289400     Jun 30 05:18:14 2008  nexus-1000v-mzg.4.0.4.SV1.0.42.bin
 
 
Usage for bootflash://
  258408448 bytes used
 2939531264 bytes free
 3197939712 bytes total
n1000v# gzip bootflash:errorsfile
n1000v# dir
       1681     Jun 30 05:21:08 2008  cisco_svs_certificate.pem
        703     Jul 01 18:17:20 2008  errorsfile.gz
      16384     Jun 30 05:17:51 2008  lost+found/
       4096     Jun 30 05:18:29 2008  routing-sw/
         49     Jul 01 17:09:18 2008  sample_test.txt
    1322843     Jun 30 05:17:56 2008  nexus-1000v-dplug-mzg.4.0.4.SV1.0.42.bin
   21629952     Jun 30 05:18:02 2008  nexus-1000v-kickstart-mzg.4.0.4.SV1.0.42.bin
   39289400     Jun 30 05:18:14 2008  nexus-1000v-mzg.4.0.0.S1.0.34.bin
 
 
Usage for bootflash://
  258408448 bytes used
 2939531264 bytes free
 3197939712 bytes total
n1000v# 
 
 

Uncompressing Files

Use this procedure to uncompress (unzip) a specified file that is compressed using LZ77 coding.

BEFORE YOU BEGIN

You are logged in to the CLI.

DETAILED STEPS

Step
Command
Purpose

Step 1 

gunzip [path] filename

Uncompresses the specified file.

Step 2 

dir

Displays the contents of a directory, including the newly uncompressed file.

Example:
n1000v# gunzip bootflash:errorsfile.gz
n1000v# dir bootflash:
       2687     Jul 01 18:17:20 2008  errorsfile
      16384     Jun 30 05:17:51 2008  lost+found/
       4096     Jun 30 05:18:29 2008  routing-sw/
         49     Jul 01 17:09:18 2008  sample_test.txt
    1322843     Jun 30 05:17:56 2008  nexus-1000v-dplug-mzg.4.0.0.SV1.0.42.bin
   21629952     Jun 30 05:18:02 2008  nexus-1000v-kickstart-mzg.4.0.4.SV1.0.42.bin
   39289400     Jun 30 05:18:14 2008  nexus-1000v-mzg.4.0.0.SV1.0424.bin
 
 
Usage for bootflash://sup-local
  258408448 bytes used
 2939531264 bytes free
 3197939712 bytes total
DCOS-112-R5# 

Directing Command Output to a File

Use this procedure to direct command output to a file.

DETAILED STEPS

Step
Command
Purpose

Step 1 

show running-config > [path | filename]

Directs the output of the command, show running-config, to a path and filename.

 
Example:
n1000v# show running-config > 
volatile:switch1-run.cfg

Directs the output of the command, show running-config, to the file, switch1-run.cfg, on the volatile file system.

 
Example:
n1000v# show running-config > 
bootflash:switch2-run.cfg

Directs the output of the command, show running-config, to the file, switch2-run.cfg, in bootflash.

 
Example:
n1000v# show running-config > 
tftp://10.10.1.1/home/configs/switch3-run.cfg

Directs the output of the command, show running-config, to the file, switch3-run.cfg, on a TFTP server.

 
Example:
n1000v# show interface > samplefile

Directs the output of the command, show interface, to the file, samplefile, at the same directory level, for example, in bootflash.

Verifying a Configuration File before Loading

Use this procedure to verify the integrity of an image before loading it. This command can be used for both the system and kickstart images.

DETAILED STEPS

Step
Command
Purpose

Step 1 

copy source path and file system:running-config

Example:
n1000v# copy 
tftp://10.10.1.1/home/configs/switch3-run.cfg 
system:running-config

Copies the source file to the running configuration on the switch, and configures the switch as the file is parsed line by line.

Step 2 

show version image [bootflash: | modflash: |volatile:]

Example:
n1000v# show version image bootflash:isan.bin
  image name: nexus-1000v-mz.4.0.4.SV1.1.bin
  bios:       version unavailable
  system:     version 4.0(4)SV1(1)
  compiled:   4/2/2009 23:00:00 [04/23/2009 09:55:29]
n1000v#

Validates the specified image.

Rolling Back to a Previous Configuration

Use this procedure to recover your configuration from a previously saved version.

BEFORE YOU BEGIN


Note Each time a copy running-config startup-config command is used, 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.


DETAILED STEPS

Step
Command
Purpose

Step 1 

copy running-config bootflash: {filename}

Example:
n1000v# copy running-config 
bootflash:June03-Running

Reverts to a snapshot copy of a previously saved running configuration (binary file).

 

copy bootflash: {filename} startup-config

 
      
Example:
n1000v# copy bootflash:my-config 

startup-config

Reverts to a configuration copy that was previously saved in the bootflash: file system (ASCII file).

Displaying Files

This section describes how to display information about files and includes the following procedures:

Displaying File Contents

Displaying Directory Contents

Displaying File Checksums

Displaying the Last Lines in a File

Displaying File Contents

Use this procedure to display the contents of a specified file.

BEFORE YOU BEGIN

You are logged in to the CLI.

DETAILED STEPS

Step
Command
Purpose

Step 1 

show file [bootflash: | debug: | volatile:] filename

 
      
Example:
n1000v# show file bootflash:sample_test.txt
config t
Int veth1/1
no shut
end
show int veth1/1
 
n1000v# 

Displays the contents of the specified file.

Displaying Directory Contents

Use this procedure to display the contents of a directory or file system.

BEFORE YOU BEGIN

Before using this command, you must know or do the following:

You are logged in to the CLI.

Step
Command
Purpose

Step 1 

pwd

Example:
n1000v# pwd
bootflash:

Displays the present working directory.

Step 2 

dir

Displays the contents of the directory.

Example:
n1000v# pwd
bootflash: 
n1000v# dir
 
 
Usage for volatile://
          0 bytes used
   20971520 bytes free
   20971520 bytes total
n1000v# 
 
 

Displaying File Checksums

Use this procedure to display checksums for checking file integrity.

Step
Command
Purpose

Step 1 

show file filename [cksum | md5sum]

Example:
n1000v# show file 
bootflash:cisco_svs_certificate.pem cksum
266988670

Provides the checksum or MD5 checksum of the file for comparison with the original file.

Example:

n1000v# show file bootflash:cisco_svs_certificate.pem md5sum

d3013f73aea3fda329f7ea5851ae81ff

n1000v#

Provides the Message-Digest Algorithm 5 (MD5) checksum of the file. MD5 is an electronic fingerprint for the file.

Displaying the Last Lines in a File

Use this command to display the last lines (tail end) of a specified file.

BEFORE YOU BEGIN

You are logged in to the CLI in EXEC mode.

DETAILED STEPS

Step
Command
Purpose

Step 1 

tail {path}[filename] {Number of lines}

Displays the requested number of lines from the end of the specified file.

Allowable range for number of lines: 0 - 80

Example:
n1000v# tail bootflash:errorsfile 5
 
 
20) Event:E_DEBUG, length:34, at 171590 usecs after Tue Jul  1 09:29:05 2008
    [102] main(326): stateless restart
 
 
 
 
n1000v# 
 
 

Feature History for File Management

This section provides the file management feature release history.

Feature Name
Releases
Feature Information

File Management

4.0(4)SV1(1)

This feature was introduced.