File System Commands

cd

To change the current working directory, use cd command in XR EXEC mode.

cd filesystem:

Syntax Description

filesystem :

(Optional) Location of the new working directory. Include the file system alias for the filesystem argument, followed by a colon and optionally, the name of a directory.

Command Default

The default file directory is disk0:/usr.

Command Modes

XR EXEC mode.

Command History

Release

Modification

Release 7.0.12

This command was introduced.

Usage Guidelines

The current working directory is the directory used when EXEC commands that have an optional argument are entered without that argument. Use cd command to define the working directory. For example, when the dir command is entered without specifying the filesystem argument, the files in the current working directory are displayed.

Use cd command without an argument to set the working directory back to the default directory, disk0:/usr.

Examples

The following example shows how to change the current working directory to the root directory on the hard disk. In this example, the pwd command confirms that the working directory has changed to the root directory on the hard disk.


RP/0/RP0/CPU0:router# cd harddisk:
RP/0/RP0/CPU0:router# pwd
		
harddisk:
				

The following example shows how to change the current working directory to the default file directory by specifying the cd command without a location. In this example, the pwd command confirms that the working directory has changed to the default file directory.


RP/0/RP0/CPU0:router# cd
RP/0/RP0/CPU0:router# pwd
		
disk0:/usr
		

cfs check

To clear any inconsistencies between running configuration and binary startup configuration maintained on the disk use cfs check command in XR EXEC mode.

cfs check

Syntax Description

This command has no keywords or arguments.

Command Default

No default behavior or values.

Command Modes

XR EXEC mode

Command History

Release

Modification

Release 7.0.1

This command was introduced.

Release 24.2.11

This command was modified to increase the commit count from 20 to 40.

Usage Guidelines

Use this command to clear any inconsistencies between running configuration and binary startup configuration maintained on the disk.

On executing this command the existing binary startup configuration maintained on the disk will be discarded and the entire binary startup configuration will be recreated from system's running configuration. This will clear any inconsistency between the two.


Note


While this command runs, redundancy of the designated shelf controller (DSC) is disabled.



Note


Executing this command will take a lock to the configuration database, which will prevent any commit operation until this operation completes.


Task ID

Task ID

Operations

root-lr

read, write

Examples

The following example shows how to perform a CFS check:


Router# cfs check
 
Creating any missing directories in Configuration File system...OK
Initializing Configuration Version Manager...OK
Syncing commit database with running configuration...OK
Re-initializing cache files...OK
Updating Commit Database.  Please wait...[OK]
  

clear configuration ascii inconsistency

To perform an ASCII backup of the system's running configuration and to clear inconsistencies between running configuration and ASCII backup copy maintained on the disk, use the clear configuration ascii inconsistency command in XR EXEC mode.

clear configuration ascii inconsistency

Syntax Description

This command has no keywords or arguments.

Command Default

No default behavior or values.

Command Modes

XR EXEC mode

Command History

Release

Modification

Release 6.5.1

This command was introduced.

Release 24.2.11

This command was modified to include resetting the ASCII backup timer.

Usage Guidelines

Use this command to perform a forced ASCIl backup and reset the periodic ASCII backup timer. Once the backup is complete, the router will automatically initiate the next periodic ASCII backup operation only after 55 minutes from the time the clear configuration ascii inconsistency command is executed.

On executing this command, the ASCII backup will synchronize with the latest running configuration up to the point of the last commit made before executing the command. This clears any inconsistencies between the running configuration and the ASCII backup copy stored on disk. Additionally, this command will reset the periodic ASCII backup timer.

Task ID

Task ID

Operations

config-services

execute

Examples

The following example shows how to perform an ASCII backup and reset the ASCII backup timer to zero:

Router# clear configuration ascii inconsistency
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Warning: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!! It is recommended to run this command only when all nodes in router      !!!!
!!!! are in IOS-XR RUN state. To determine node state, run following command: !!!!
!!!! 'show platform'.                                                         !!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Warning: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Proceed with the command ?[confirm] y
 Ascii configuration backup is in progress...
Configuration ascii backup complete

copy

To copy a file from a source (such as a network server) to a destination (such as a flash disk), use copy command in XR EXEC mode.

copy source { location node-id destination location { node-id | all } | running-config [atomic] }

Syntax Description

source

Filename including the directory path or network location of the file. The possible sources are:

directory-path —Directory path of the file from which the file is copied.

access-list { ipv4 | ipv6 }—Copies an access list (EXEC mode only).

config: —Copies from disk0: file system.

disk0: —Copies from disk0: file system.

ftp: —Copies from an FTP network server. The syntax is ftp:[[[//username [:password]@] location]/directory]/filename.

harddisk: —Copies from the hard disk drive file system (if present).

http: —Copies from one webserver to another over a network. The syntax is http://username: password@ ip-address: port/ directory-path

https: —Copies from the https: file system. The syntax is https://username: password@ ip-address: port/ directory-path

sftp: —Copies from an SFTP network server. The syntax is sftp:[[[//username [:password]@] location]/directory]/filename.

scp: —Copies from an SCP network server. The syntax is scp:[[[//username [:password]@] location]/directory]/filename.

prefix-list {ipv4 | ipv6} —Copies from a prefix list (EXEC mode only).

rootfs: —Copies from the rootfs: file system.

running-config —Copies from the current system configuration.

tftp: —Copies from a TFTP network server. The syntax is tftp:[[//location]/directory]/filename

xml-schema —Copies the XML schema files as a tar ball file (.tar.gz) [EXEC mode only].

destination

Filename including the directory path or network location of the file.

location node-id

Specifies a node. The node-id argument is expressed in the rack/ slot notation.

location all

Copies to all nodes.

running-config

Applies the source configuration file to the running configuration of the system.

atomic

(Optional) Applies the changes to the running configuration only if there are no errors

Command Default

None

Command Modes

XR EXEC mode

Command History

Release

Modification

Release 7.10.1

This command was modified to support public key authentication.

Release 7.9.1

This command was modified to support SFTP and SCP options.

Release 7.0.12

This command was introduced.

Usage Guidelines

Source and destination can each be a configuration file, a text file, or a file system. Enter source and destination URL information, usernames, and passwords and issue the copy command. The networking device prompts for any missing information.

The exact format of the source and destination arguments vary according to the file or directory location. Enter the device or network location for the file system type.

Filenames can include the following characters:

! # $ % + 0 1 2 3 4 5 6 7 8 9 @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ ] ^ _ a b c d e f g h i j k l m n o p q r s t u v w x y z { } ~

The following characters can be used with the stated limitations:

  • ` needs backslash before this character

  • – cannot be the first character

  • . cannot be the last character

  • = cannot be the filename without other characters

The following characters cannot be used in filenames:

" ( ) * , / : < > ? \ | ' & ;

The maximum length allowed for a filename is 254 characters including the path. If a filename longer than 254 characters is specified, the filename is truncated to 254 characters.

To copy a file from a source on the router to a destination on the router, specify a source location node-id and a destination location node-id . To copy the file to all nodes, use the location all keywords.

In the alias syntax for the ftp: , rcp: , tftp: , sftp: , and scp: keywords, the location is either an IP address or a hostname. The filename is specified relative to the directory used for file transfers.

When no alias is specified, the networking device looks for a file in the current directory. To view the current directory, enter the pwd command.


Note


During processing of the copy command, you might see the “C” character. For all files being copied, “C” indicates that the copy process is taking place. The entire copying process might take several minutes and differs from protocol to protocol and from network to network.


Table 1. Network Protocols Supported by Cisco IOS XR Software

Prefix

Name

Description

tftp:

Trivial File Transfer Protocol

TFTP is a simplified version of FTP that allows files to be transferred from one computer to another over a network, usually without the use of client authentication (for example, username and password).

ftp:

File Transfer Protocol

FTP is an application protocol, part of the TCP/IP protocol stack, and is used for transferring files between network nodes. FTP requires a username and password.

rcp:

Remote Copy Protocol

The rcp protocol allows users to copy files to and from a file system residing on a remote host or server on the network. The rcp protocol uses TCP to ensure the reliable delivery of data. The rcp protocol downloads require a username.

http:

Hypertext Transfer Protocol

HTTP protocol allows users to transfer files from one webserver to another over a network. The user authentication depends on the webserver configuration.

sftp:

Secure File Transfer Protocol

SFTP is an application protocol is used for secure transferring files between the router and and an archieve server. SFTP requires a username and password.

scp:

Secure Copy Protocol

SCP is an application protocol is used for secure transferring files between the router and and an archieve server. SFTP requires a username and password.

Additional usage guidelines are in the following sections.

Invalid Combinations of Source and Destination

Some combinations of source and destination are invalid. Specifically, you cannot copy the following:

  • From a running configuration to a running configuration

  • From a network device to a network device (for example, copy ftp: rcp: )

Using TFTP

TFTP is a simplified version of FTP that allows files to be transferred from one computer to another over a network, usually without the use of client authentication (for example, username and password).

The syntax is as follows:

copy tftp://hostname /ipaddress/directory-path pie name target-device [location {node-id | all}]

Example:

Router# copy tftp://1.1.1.1/images/software.pie disk1:

Note


Some Cisco IOS XR images may be larger than 32 MB, and the TFTP services provided by some vendors may not support a file this large. If you do not have access to a TFTP server that supports files larger than 32 MB, download the software image using FTP or rcp as described in the following sections.


Using FTP

FTP servers require a username and password for each client request. Cisco IOS XR software sends the first valid username in the following list:

  1. The username and password specified in the copy command, if a username is specified.

    The syntax is as follows:

    copy ftp:// username : password @ hostname or ipaddress/directory-path/pie-name target-device [location {node-id | all}]

    Example:
    
    Router# copy ftp://john:secret@10.1.1.1/images/software.pie disk1:
    
  2. An “anonymous” username and password. The anonymous password is “root@ip address,” where “ip address” is the IP address of the local networking device.

  3. A password “username@iosname.domain” formed by the networking device. The variable “username” is the username associated with the current session, “iosname” is the configured hostname, and “domain” is the domain of the networking device.

The username and password must be associated with an account on the FTP server. If you are writing to the network server, the FTP server must be properly configured to accept the FTP write request from the user on the networking device.

If the network server has a directory structure, the configuration file or image is written to or copied from the directory associated with the username on the network server. For example, if the system image resides in the home directory of a user on the network server, specify the name of that user as the remote username.

Refer to the documentation for your FTP server for more details.

Using rcp

The rcp protocol requires a username upon each request. When you copy a configuration file or image between the networking device and an rcp server, the Cisco IOS XR software sends the first valid username in the following list:

  1. The remote username specified in the copy command, if one is specified.

  2. The username set by the rcp client username command, if the command is configured.

  3. The networking device hostname.

For the rcp copy request to process successfully, 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 does not run successfully. If the network 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 network server. For example, if the system image resides in the home directory of a user on the network server, specify the name of that user as the remote username.

If you are writing to the network server, the rcp server must be properly configured to accept the rcp write request from the user on the networking device. For UNIX systems, add an entry to the .rhosts file for the remote user on the rcp server. Suppose the networking device contains the following configuration lines:


hostname Rtr1
ip rcp remote-username User0
    

If the IP address of the networking device translates to company.com, then the .rhosts file for User0 on the rcp server should contain the following line:


company.com Rtr1
    

See the documentation for your rcp server for more details.

If you are using a personal computer as a file server, the computer must support remote shell (rsh) protocol.

Using xml-schema

Use the xml-schema keyword to obtain the most up-to-date XML schemas (.xsd files) from the router. Using this keyword is useful to prevent the use of outdated schemas in the event that router software updates include schema updates. The tar ball file includes all active schema files. It does not include schemas that are activated by specific package installation envelopes (PIEs) if those PIEs are not installed and activated on the router.

Using HTTP(s)

HTTP(s) allows files to be transferred from one webserver to another over a network. The user authentication depends on the webserver configuration. The following copy operations are supported:

  • Copy a file from webserver to device via HTTP

  • Copy a file from webserver to device via HTTPS

  • Copy a file from device to webserver via HTTP


Note


Copying a file from device to webserver via HTTP is not supported.

Copying a file from sys-admin via HTTP(s) is not supported.


The syntax is as follows:

copyhttps://username: password@ ip-address: port target-device [location {node-id | all}]

Example:

The following example shows how to copy a file from http server, where user credentials are not required, and server listens to the default port.

Router# copy http://1.1.1.1/images/software.pie disk1:
The following example shows how to copy a file from http server, where user credentials are required, and server listens to the default port.

Router# copy http://user:cisco@1.1.1.1/images/software.pie disk1:

UserID: user
Password: cisco
The following example shows how to copy a file from http server, where user credentials are required, and server listens to a specific port.

Router# copy http://user:cisco@1.1.1.1:45/images/software.pie disk1:


UserID: user
Password: cisco
Specific listen port: 45

Copying to the Running Configuration

When you use the copy command to copy a configuration file to the running-config destination, the configuration in the file is applied to the running configuration of the system. This is a configuration operation. By default, the copy is carried out in a best-effort manner. This means that if some configuration lines from the file cannot be applied, the remaining configuration is still integrated into the system. In this case, a partial configuration is committed. When the atomic keyword is used, partial configurations are not committed. This means that even if one error occurs in the parsing or committing phase, no changes are made to the system. To view any errors when applying the configuration, use the show configuration failed command.

Task ID

Task ID

Operations

filesystem

execute

Examples

The following example shows how to copy a file from a FTP server to disk1:


Router#copy ftp://john:secret@10.1.1.1/images/comp-cisco8k-full.pie disk1:

The following example shows how to copy a file from an rcp server to disk1:


Router#copy rcp://john@10.1.1.1/images/comp-cisco8k-full.pie disk1:

The following example shows how to copy a configuration file to running-config destination:

Router#copy running-config disk0:/running-config.txt
Thu Apr 20 15:53:49.116 UTC
Destination file name (control-c to cancel): [/disk0:/running-config.txt]?
Building configuration.
188 lines built in 1 second
[OK]

Examples

The following example shows how to copy a file from a SCP and SFTP server using public key authentication:

Router#copy running-config scp://root@192.0.4.2//var/opt/run_conf_scp.txt
Router#copy running-config sftp://root@192.0.4.2//var/opt/run_conf_sftp.txt

delete

To delete files, use delete command in the appropriate mode.

delete [/ noprompt] [/ ena] filesystem: filename location {node-id | all}

Syntax Description

/noprompt

(Optional) Causes no prompt for confirmation before deleting the specified files.

/ena

(Optional) Deletes all files from and below the current working directory.

filesystem :

(Optional) Location of the file to be deleted. Include the file system alias for the filesystem argument, followed by a colon, and, optionally, the name of a directory.

filename

Filename of the file to be deleted.

harddisk

Deletes the harddisk

location {node-id | all}

Deletes a file from a designated node. The node-id argument is entered in the rack/ slot notation. The all keyword specifies to delete the file from all nodes.

Command Default

A filename must be specified. If a filename is entered without a file system or directory path, the present working directory is used.

Command Modes

XR EXEC mode.

.

Command History

Release

Modification

Release 7.0.12

This command was introduced.

Usage Guidelines

When a file is deleted, it is removed from the system and cannot be restored (undeleted).

Use the dir command to display the list of files on a storage device.

Examples

The following example shows how to delete a file:


RP/0/RP0/CPU0:router# delete rbtest 
		
Delete disk1:/rbtest[confirm]y
		                    

dir

To display a list of files on a file system or in a specific directory, use the dir command in XR EXEC mode .

dir [/ all | / ena | / recurse] [filesystem: ] [filename] location {node-id | all}

Syntax Description

/all

(Optional) Lists deleted files, undeleted files, and files with errors.

/ena

(Optional) Recognizes subdirectories.

/recurse

(Optional) Recursively lists subdirectories.

filesystem :

(Optional) Name of the directory containing the files to be displayed. Include the file system alias for the filesystem argument, followed by a colon, and, optionally, the name of a directory.

filename

(Optional) Name of the files to display. The files can be of any type. You can use wildcards in the filename. A wildcard character (*) matches all patterns. Strings following a wildcard are ignored.

location {node-id | all}

(Optional) Specifies the node from which to display a list of files. The node-id argument is entered in the rack/ slot notation. The all keyword specifies to display files on all nodes.

Command Default

When dir command is entered without keywords or arguments, the contents of the present working directory are displayed.

Command Modes

XR EXEC mode.

.

Command History

Release

Modification

Release 7.0.12

This command was introduced.

Usage Guidelines

If you enter the dir command without specifying a directory, the contents of the present working directory are displayed. The all keyword displays all files, including deleted files. The size associated with the directory name is the total size for all files in that directory.

Examples

The following example shows how to display the contents of a directory:


RP/0/RP0/CPU0:router# dir harddisk:/log
		
Directory of harddisk:/log
		
5527        drwx  4096        Thu Aug 28 11:21:48 2008  boot_28_Aug_2008_11_21_49
5533        drwx  4096        Thu Aug 28 11:38:54 2008  boot_28_Aug_2008_11_38_54
5538        drwx  4096        Fri Sep  5 13:28:54 2008  boot_05_Sep_2008_13_28_54
5543        drwx  4096        Mon Sep  8 08:55:52 2008  boot_08_Sep_2008_06_59_08
--More--
				

mkdir

To create a new directory on a file system, use the mkdir command in the appropriate mode.

mkdir filesystem: [location {node-id | all}]

Syntax Description

filesystem:

File system on which to create a new directory.

location{node-id | all}

(Optional) Specifies the node where the file system is located. The node-id argument is expressed in the rack/ slot notation. Use the all keyword to indicate all nodes.

Command Default

No default behavior or values

Command Modes

System Admin EXEC

Command History

Release

Modification

Release 7.0.12

This command was introduced.

Usage Guidelines

After you issue the mkdir command, Cisco IOS XR software prompts you to specify the name of the directory to be created. When specifying the name of the new directory, include the directory path where you want the new directory to reside. If you do not specify a directory path, the new directory is created in the /usr directory of the file system specified for the filesystem: argument.

Examples

The following example shows how to create a directory named newdir. The dir command is used to verify that the directory has been added.


RP/0/RP0/CPU0:router# mkdir harddisk:
  
Create directory filename []?newdir
Created dir harddisk:/newdir
RP/0/RP0/CPU0:router# dir harddisk:
  
  Directory of harddisk:
  
  11193       drwx  4096        Fri Feb 13 06:45:05 2009  newdir
  37146       drwx  4096        Sun Dec 14 15:30:48 2008  malloc_dump
  43030       drwx  4096        Wed Dec 24 11:20:52 2008  tracebacks
  43035       drwx  4096        Thu Jan  8 18:59:18 2009  sau
  51026       drwx  4096        Sat Dec 27 02:52:46 2008  tempA
  51027       drwx  4096        Sat Dec 27 02:04:10 2008  dir.not.del
  -430307552  -rwx  342         Fri Jan 16 10:47:38 2009  running-config
  -430305504  -rwx  39790       Mon Jan 26 23:45:56 2009  cf.dat
  
  39929724928 bytes total (39883231232 bytes free)
    

pwd

To display the present working directory, use the pwd command in

EXEC mode

System Admin EXEC

pwd

Syntax Description

This command has no keywords or arguments.

Command Default

No default behavior or values.

Command Modes

EXEC

System Admin EXEC

Command History

Release

Modification

Release 7.0.12

This command was introduced.

Usage Guidelines

Use the pwd command to show what directory or file system is specified as the default by the cd command.

Examples

The following example shows how to display the present working directory:


RP/0/RP0/CPU0:router# pwd
		
disk0:/usr
		

rmdir

To remove an existing directory, use the rmdir command in the appropriate mode.

rmdir filesystem: location {node-id | all}

Syntax Description

filesystem

Name of the file system from which to delete a directory, followed by a colon.

location {node-id | all}

Specifies the node where the file system is located. The node-id argument is expressed in the rack/ slot notation. Use the all keyword to indicate all nodes.

Command Default

No default behavior or values

Command Modes

System Admin EXEC

Command History

Release

Modification

Release 7.0.12

This command was introduced.

Usage Guidelines

Use the rmdir command to remove directories (for example, to free up disk space) from a file system. After you issue the rmdir command, the Cisco IOS XR software prompts you to specify the name of the directory to be deleted.

When a directory contains files, you must remove the files before deleting the directory. Use the delete command to remove files.

Examples

The following example shows how to delete a subdirectory from the hard disk. The dir command is used to verify that the directory has been deleted.


RP/0/RP0/CPU0:router# rmdir harddisk:
		
Remove directory filename []?newdir
Delete harddisk:/newdir[confirm]y
RP/0/RP0/CPU0:router# dir harddisk:
		
		Directory of harddisk:
		
		37146       drwx  4096        Sun Dec 14 15:30:48 2008  malloc_dump
		43030       drwx  4096        Wed Dec 24 11:20:52 2008  tracebacks
		43035       drwx  4096        Thu Jan  8 18:59:18 2009  sau
		51026       drwx  4096        Sat Dec 27 02:52:46 2008  tempA
		51027       drwx  4096        Sat Dec 27 02:04:10 2008  dir.not.del
		-430307552  -rwx  342         Fri Jan 16 10:47:38 2009  running-config
		-430305504  -rwx  39790       Mon Jan 26 23:45:56 2009  cf.dat
		
		39929724928 bytes total (39883235328 bytes free)
				

show filesystem

To display the layout and contents of file systems, use the show filesystem command in XR EXEC mode

System Admin EXEC

show filesystem filesystem: [location {node-id | all}]

Syntax Description

filesystem:

Name of the file system for which to display information, followed by a colon. Possible values are: disk0: , disk1: , harddisk: .

location{node-id | all}

(Optional) Specifies the node where the file system is located. The node-id argument is expressed in the rack/ slot notation. Use the all keyword to indicate all nodes.

Command Default

The file system for the active RP is displayed.

Command Modes

XR EXEC mode

System Admin EXEC

Command History

Release

Modification

Release 7.0.12

This command was introduced.

Usage Guidelines

Use the show filesystem command to learn the alias names (prefixes) of the file systems supported by your networking device.

Examples

The following example shows sample output from the show filesystem command:


RP/0/RP0/CPU0:router# show filesystem
  
File Systems:
  
       Size(b)     Free(b)        Type  Flags  Prefixes
             -           -     network     rw  qsm/dev/fs/tftp: tftp:
             -           -     network     rw  qsm/dev/fs/rcp: rcp:
             -           -     network     rw  qsm/dev/fs/ftp: ftp:
   39929724928 39852978176    harddisk     rw  harddisk:
    1024606208   863584256  flash-disk     rw  disk0:
       2092032     2059264       nvram     rw  nvram:
      62390272    62381260       flash     rw  bootflash:
    

The following example shows sample output from the show filesystem command using the optional location node-id keyword and argument:


RP/0/RP0/CPU0:router# show filesystem location 0/rp0/cpu0

File Systems:
  
       Size(b)     Free(b)        Type  Flags  Prefixes
             -           -     network     rw  qsm/dev/fs/tftp: tftp:
             -           -     network     rw  qsm/dev/fs/rcp: rcp:
             -           -     network     rw  qsm/dev/fs/ftp: ftp:
   39929724928 39883235328    harddisk     rw  harddisk:
       2092032     2019328       nvram     rw  nvram:
    1024606208   847888384  flash-disk     rw  disk0:
      62390272    62153616       flash     rw  bootflash:
    
Table 2. show filesystem Field Descriptions

Field

Description

Size(b)

Amount of memory in the file system, in bytes.

Free(b)

Amount of free memory in the file system, in bytes.

Type

Type of file system.

Flags

Permissions for file system.

Prefixes

Alias for the file system.