Table Of Contents
File System Commands on Cisco IOS XR Software
cd
cfs check
clear-classic-config
copy
delete
dir
erase nvram:
format
fsck
mkdir
pwd
rmdir
show filesystem
squeeze
undelete
File System Commands on Cisco IOS XR Software
This chapter describes the Cisco IOS XR software commands used to manage file systems.
Caution 
The commands in this chapter should not be used to access or modify any Cisco IOS XR software or configuration files. Use only the documented commands for installing and configuring the router. Modifying, deleting, or moving configuration or software package files using the manual commands described in this chapter is not required and can result in router downtime, loss of service, and a corrupted database.
cd
To change the present working directory, use the cd command in EXEC mode.
cd [filesystem:]
Syntax Description
filesystem:
|
(Optional) Location of the new present working directory. Include the file system alias for the filesystem argument, followed by a colon, and, optionally, the name of a directory.
|
Defaults
The default file directory is disk0:/usr. Enter the cd command without the argument to return the present working directory to disk0:/usr.
Command Modes
EXEC
Command History
Releases
|
Modifications
|
Release 2.0
|
This command was introduced on the Cisco CRS-1.
|
Release 3.0
|
No modification.
|
Release 3.2
|
This command was first supported on the Cisco XR 12000 Series Router.
|
Release 3.3.0
|
No modification.
|
Release 3.4.0
|
No modification.
|
Usage Guidelines
To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.
The present working directory is the directory used when EXEC commands that have an optional filesystem argument are entered without that argument. Use the cd command to define the present working directory. For example, when the dir command is entered without specifying the filesystem argument, the files in the present working directory are displayed.
Use the pwd command to display the present working directory.
Use the show filesystem command to display the available storage devices.
Task ID
Task ID
|
Operations
|
filesystem
|
read
|
Examples
The following example shows how to change the present working directory to the root directory on the hard disk. In this example, the pwd command confirms that the present 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
The following example shows how to change the present working directory to the default file directory by specifying the cd command without a location. In this example, the pwd command confirms that the present working directory has changed to the default file directory.
RP/0/RP0/CPU0:router# pwd
Related Commands
Command
|
Description
|
dir
|
Displays the contents of the working directory.
|
pwd
|
Displays the current working directory of the cd command.
|
show filesystem
|
Displays the layout and contents of a file system.
|
cfs check
To perform a check of the Configuration File System (CFS), use the cfs check command in EXEC mode.
cfs check
Syntax Description
This command has no arguments or keywords.
Command Modes
EXEC
Command History
Release
|
Modification
|
Release 2.0
|
This command was introduced on the Cisco CRS-1.
|
Release 3.0
|
No modification.
|
Release 3.2
|
This command was first supported on the Cisco XR 12000 Series Router.
|
Release 3.3.0
|
No modification.
|
Release 3.4.0
|
No modification.
|
Usage Guidelines
To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.
Use the cfs check command to check the sanity of the configuration file system and attempt to recover from internal inconsistencies; one or more rollback points may be lost depending on the severity of the state of the file system.
Note
While this command runs, redundancy of the designated secure domain router system controllers (SDRs) is disabled.
Task ID
Task ID
|
Operations
|
root-lr
|
read, write
|
Examples
The following example shows how to perform a CFS check:
RP/0/RP0/CPU0: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-classic-config
To clear or truncate the Cisco IOS software running configuration stored in nvram, use the clear-classic-config command in EXEC mode.
clear-classic-config
Syntax Description
This command has no arguments or keywords.
Command Modes
EXEC
Command History
Release
|
Modification
|
Release 3.2
|
This command was made available only on the Cisco XR 12000 Series Router.
|
Release 3.3.0
|
No modification.
|
Release 3.4.0
|
No modification.
|
Usage Guidelines
To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.
Use the clear-classic-config command to clear space on the nvram, if the Cisco IOS software configuration is no longer needed, or to boot the Cisco IOS software with no configuration.
Task ID
Task ID
|
Operations
|
config-services
|
execute
|
Examples
The following example shows how to clear the Cisco IOS software running configuration stored in NVRAM:
RP/0/0/CPU0:router# clear-classic-config
copy
To copy a file from a source (such as a network server) to a destination (such as a flash disk), use the copy command in Administration EXEC mode or in EXEC mode.
copy source [location node-id] destination [location node-id | location all]
Syntax Description
source
|
A filename including the directory path or network location of the file. The possible sources are:
• directory-path—Directory path of the file where the file is copied from.
• bootflash:—Copies from the bootflash: file system.
• disk0:—Copies from disk0: file system.
• disk1:—Copies from disk1: file system.
• flash:—Copies from the flash: file system. The flash: keyword is alias for bootflash:.
• 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).
• harddiska:—Copies from the hard disk partition.
• nvram:—Copies from the nvram: file system.
• ipv4—Copies an IPv4 access list or prefix list.
• ipv6—Copies an IPv6 access list or prefix list.
• rcp:—Copies from a remote copy protocol (rcp) network server. The syntax is rcp:[[[//username@]location]/directory]/filename.
• running-config—Copies from the current system configuration.
• tftp:—Copies from a TFTP network server. The syntax is tftp:[[//location]/directory]/filename.
|
destination
|
Filename including the directory path or network location of the file.
Note The names "ipv4" and "ipv6" cannot be specified as a destination.
|
location node-id
|
(Optional) Specifies a node. The node-id argument is expressed in the rack/slot/module notation.
|
location all
|
(Optional) Copies to all nodes.
|
Command Modes
Administration EXEC
EXEC
Command History
Releases
|
Modifications
|
Release 2.0
|
This command was introduced on the Cisco CRS-1.
|
Release 3.0
|
No modification.
|
Release 3.2
|
This command was first supported on the Cisco XR 12000 Series Router. The command was made available in Administration EXEC mode.
Support was added to copy to a designated node or to all nodes. Hardware partition support was added.
|
Release 3.3.0
|
No modification.
|
Release 3.4.0
|
No modification.
|
Usage Guidelines
To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.
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 varies according to the file or directory location. Enter the device or network location for the file system type.
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 keywords location all.
In the alias syntax for the ftp:, rcp:, and tftp: keywords, the location is either an IP address or a host name. The filename is specified relative to the directory used for file transfers.
When no alias or 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 describes the network protocols supported by the Cisco IOS XR software.
Table 1 Network Protocols Supported by the 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
|
Rcp is a protocol that allows users to copy files to and from a file system residing on a remote host or server on the network. Rcp uses TCP to ensure the reliable delivery of data. Rcp downloads require a username.
|
Additional usage guidelines are in the following sections:
•
Invalid Combinations of Source and Destination
•
Using TFTP
•
Using FTP
•
Using rcp
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 | location all]
Example:
RP/0/RP0/CPU0:router# copy tftp://1.1.1.1/images/crs_software.pie disk1:
Note
Some Cisco IOS XR software 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. The 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 | location all]
Example:
RP/0/RP0/CPU0:router# copy ftp://john:secret@10.1.1.1/images/crs_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 host name, 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 host name.
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:
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:
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.
Table 2 shows the syntax and example for the copy command when used with FTP, rcp, and TFTP network servers.
Table 2 Syntax and Examples of the copy command
Type
|
Syntax and Example
|
FTP
|
copy ftp://username:password@{hostname | ipaddress}/directory-path/pie-name target-device [location node-id | location all]
Example:
RP/0/RP0/CPU0:router# copy ftp://john:secret@10.1.1.1/images/comp-crs-full.pie disk1:
|
rcp
|
copy rcp://username@{hostname | ipaddress}/directory-path/pie-name target-device [location node-id | location all]
Example:
RP/0/RP0/CPU0:router# copy rcp://john@10.1.1.1/images/comp-crs-full.pie disk1:
|
TFTP
|
copy tftp://{hostname | ipaddress}/directory-path/pie-name target-device [location node-id | location all]
Example:
RP/0/RP0/CPU0:router# copy tftp://10.1.1.1/images/comp-crs-full.pie disk1:
|
Task ID
Task ID
|
Operations
|
filesystem
|
execute
|
Examples
The following example shows how to copy a file from a FTP server to disk1:
RP/0/RP0/CPU0:router# copy ftp://john:secret@10.1.1.1/images/comp-crs-full.pie disk1:
Related Commands
Command
|
Description
|
cd
|
Changes the default directory or file system.
|
dir
|
Displays a list of files on a file system.
|
delete
To delete files, use the delete command in Administration EXEC mode or in EXEC mode.
delete [filesystem:] filename [/noprompt] [location node-id | location all]
Syntax Description
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.
|
/noprompt
|
(Optional) Causes no prompt for confirmation before deleting the specified file(s).
|
location node-id
|
(Optional) Deletes a file from a designated node. The node-id argument is expressed in the rack/slot/module notation.
|
location all
|
(Optional) Deletes a file from all nodes.
|
Defaults
A filename must be specified. If a filename is entered without a filesystem or directory path, the present working directory is used.
Command Modes
Administration EXEC
EXEC
Command History
Release
|
Modification
|
Release 2.0
|
This command was introduced on the Cisco CRS-1.
|
Release 3.0
|
No modification.
|
Release 3.2
|
This command was first supported on the Cisco XR 12000 Series Router. The command was made available in Administration EXEC mode.
Support was added to delete files from a node or from all nodes.
|
Release 3.3.0
|
No modification.
|
Release 3.4.0
|
No modification.
|
Usage Guidelines
To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.
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.
Task ID
Task ID
|
Operations
|
filesystem
|
execute
|
Examples
The following example shows how to delete a file:
RP/0/RP0/CPU0:router# delete rbtest
Delete disk1:/rbtest[confirm]y
Related Commands
Command
|
Description
|
cd
|
Changes the default directory or file system.
|
dir
|
Displays a list of files on a file system.
|
squeeze
|
Permanently deletes flash files by squeezing a flash file system.
|
undelete
|
Recovers a file marked "deleted" on a flash file systems.
|
dir
To display a list of files on a file system or in a specific directory, use the dir command in Administration EXEC mode or EXEC mode.
dir [/all | /recurse] [filesystem:] [filename] [location node-id | location all]
Syntax Description
/all
|
(Optional) Lists deleted files, undeleted files, and files with errors.
|
/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
|
(Optional) Displays a lists of files from a directory on the designated node. The node-id argument is expressed in the rack/slot/module notation.
|
location all
|
(Optional) Displays a lists of files from a directory on all nodes.
|
Defaults
When the dir command is entered without keywords or arguments, the contents of the present working directory are displayed.
Command Modes
Administration EXEC
EXEC
Command History
Releases
|
Modifications
|
Release 2.0
|
This command was introduced on the Cisco CRS-1.
|
Release 3.0
|
No modification.
|
Release 3.2
|
This command was first supported on the Cisco XR 12000 Series Router. The command was made available in Administration EXEC mode.
Support was a added to display a list of files from a directory on a node or from all nodes.
|
Release 3.3.0
|
No modification.
|
Release 3.4.0
|
No modification.
|
Usage Guidelines
To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.
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.
Task ID
Task ID
|
Operations
|
filesystem
|
execute
|
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 2003 boot_28_Aug_2003_11_21_49
5533 drwx 4096 Thu Aug 28 11:38:54 2003 boot_28_Aug_2003_11_38_54
5538 drwx 4096 Fri Sep 5 13:28:54 2003 boot_05_Sep_2003_13_28_54
5543 drwx 4096 Mon Sep 8 08:55:52 2003 boot_08_Sep_2003_06_59_08
Related Commands
Command
|
Description
|
cd
|
Changes the default directory or file system.
|
pwd
|
Displays the current setting of the cd command.
|
show filesystem
|
Displays the layout and contents of a file system.
|
erase nvram:
To erase the nvram file system, use the erase nvram: command in EXEC mode.
erase nvram: [format]
Syntax Description
format
|
(Optional) Formats the entire nvram.
|
Command Modes
EXEC
Command History
Release
|
Modification
|
Release 2.0
|
This command was introduced on the Cisco CRS-1.
|
Release 3.0
|
No modification.
|
Release 3.2
|
This command was first supported on the Cisco XR 12000 Series Router.
|
Release 3.3.0
|
No modification.
|
Release 3.4.0
|
No modification.
|
Usage Guidelines
To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.
Caution 
Using the
erase nvram: command permanently removes the files.
Task ID
Task ID
|
Operations
|
filesystem
|
execute
|
Examples
The following example shows how to erase the nvram file system:
RP/0/RP0/CPU0:router# erase nvram:
Erase operation will destroy IOS/ENA files in "nvram:":. Continue? [confirm]y
Related Commands
Command
|
Description
|
delete
|
Deletes individual files.
|
format
To format a file system, use the format command in Administration EXEC mode or in EXEC mode.
format filesystem: [partition] [monlib-filename] [location node-id | all] [spare spare-number]
[force] [recover]
Syntax Description
filesystem:
|
Name of the file system to format, followed by a colon.
|
partition
|
(Optional) Creates a partition on a hard disk. This option is only when the harddisk: keyword is entered for filesystem: argument.
|
monlib-filename
|
(Optional) Name of the ROM monitor library (monlib) file to use for formatting the file system. The default monlib file is the one bundled with the system software.
Note The monlib is used by ROMMON for accessing the file system on the media.
|
location node-id
|
(Optional) Specifies the node where the file system is located. The node-id argument is expressed in the rack/slot/module notation.
|
all
|
(Optional) Specifies all nodes where the file system is located.
|
spare spare-number
|
(Optional) Reserves spare sectors as specified by the spare-number argument when formatting flash memory. Valid values are from 0 to 16.
|
force
|
(Optional) Forces a monlib update, without verifying the monlib version on the device.
|
recover
|
(Optional) Recovers any sector read errors on a flash disk.
|
Defaults
The default monlib file is the one included with the Cisco IOS XR software.
spare-number: 0
Command Modes
Administration EXEC
EXEC
Command History
Release
|
Modification
|
Release 2.0
|
This command was introduced on the Cisco CRS-1.
|
Release 3.0
|
No modification.
|
Release 3.2
|
This command was first supported on the Cisco XR 12000 Series Router. The command was made available in Administration EXEC mode.
Support was added to create a hard disk partition.
|
Release 3.3.0
|
No modification.
|
Release 3.4.0
|
No modification.
|
Usage Guidelines
To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.
Before you can use a new flash memory card, you must format it.
Caution 
Formatting a storage device deletes all data on that device.
Note
The file systems that are available on the router and the formatting options available for file systems differ according to platform.
Use the online help (?) function to display the file systems available to be formatted on the router and the formatting options available for a file system.
Task ID
Task ID
|
Operations
|
root-system
|
execute
|
Examples
The following example shows how to format disk1::
RP/0/RP0/CPU0:router# format disk1:
The following example shows how to format disk1 with instructions to recover any sectors on the device that have read errors:
RP/0/RP0/CPU0:router# format disk1: recover
This format operation will try to recover sectors with read error
This operation may take a while. Continue? [confirm]
Format will destroy all data on "disk1:". Continue? [confirm]
Note
When the console returns to the EXEC prompt, the new flash disk has been formatted and is ready for use.
Related Commands
Command
|
Description
|
fsck
|
Checks a file system for a damage and repairs any problems.
|
fsck
To check a file system for damage and repair any problems, use the fsck command in EXEC mode.
fsck filesystem:
Syntax Description
filesystem:
|
Name of the file system to check, followed by a colon.
|
Command Modes
EXEC
Command History
Release
|
Modification
|
Release 2.0
|
This command was introduced on the Cisco CRS-1.
|
Release 3.0
|
No modification.
|
Release 3.2
|
This command was first supported on the Cisco XR 12000 Series Router.
Support was added to check the hard disk A file system for damage and repair any problems.
|
Release 3.3.0
|
No modification.
|
Release 3.4.0
|
No modification.
|
Usage Guidelines
To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.
Task ID
Task ID
|
Operations
|
filesystem
|
execute
|
Examples
The following example shows how to check the file system on flash disk0: for damage:
RP/0/RP0/CPU0:router# fsck disk0:
Phase 1 - Read and compare FATs
Phase 2 - Check cluster chains
Phase 3 - Check directories
Phase 4 - Check for lost files
157280 kb used, 843344 kb free, 2541 files, 190 directories
Related Commands
Command
|
Description
|
show filesystem
|
Displays the layout and contents of a file system.
|
mkdir
To create a new directory on a file system, use the mkdir command in Administration EXEC mode or in EXEC mode.
mkdir filesystem: [location node-id | location all]
Syntax Description
filesystem:
|
File system on which to create a new directory.
|
location node-id
|
(Optional) Creates a new directory on a file system on the designated node. The node-id argument is expressed in the rack/slot/module notation.
|
location all
|
(Optional) Creates a new directory on a file system on all RP and DRP nodes.
|
Command Modes
Administration EXEC
EXEC
Command History
Releases
|
Modifications
|
Release 2.0
|
This command was introduced on the Cisco CRS-1.
|
Release 3.0
|
No modification.
|
Release 3.2
|
This command was first supported on the Cisco XR 12000 Series Router. The command was made available in Administration EXEC mode.
Support was added to create a new directory on a file system on a designated node or on all nodes.
|
Release 3.3.0
|
No modification.
|
Release 3.4.0
|
No modification.
|
Usage Guidelines
To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.
After you issue the mkdir command, the 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 will be created on the /usr directory of the file system specified by the filesystem: argument.
Task ID
Task ID
|
Operations
|
filesystem
|
execute
|
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:
11193 drwx 4096 Fri Feb 13 06:45:05 2004 newdir
37146 drwx 4096 Sun Dec 14 15:30:48 2003 malloc_dump
43030 drwx 4096 Wed Dec 24 11:20:52 2003 tracebacks
43035 drwx 4096 Thu Jan 8 18:59:18 2004 sau
51026 drwx 4096 Sat Dec 27 02:52:46 2003 tempA
51027 drwx 4096 Sat Dec 27 02:04:10 2003 dir.not.del
-430307552 -rwx 342 Fri Jan 16 10:47:38 2004 running-config
-430305504 -rwx 39790 Mon Jan 26 23:45:56 2004 cf.dat
39929724928 bytes total (39883231232 bytes free)
Related Commands
Command
|
Description
|
dir
|
Displays a list of files on a file system.
|
rmdir
|
Removes an existing directory in a flash file system.
|
pwd
To display the present working directory, use the pwd command in EXEC mode.
pwd
Syntax Description
This command has no arguments or keywords.
Command Modes
EXEC
Command History
Releases
|
Modifications
|
Release 2.0
|
This command was introduced on the Cisco CRS-1.
|
Release 3.0
|
No modification.
|
Release 3.2
|
This command was first supported on the Cisco XR 12000 Series Router.
|
Release 3.3.0
|
No modification.
|
Release 3.4.0
|
No modification.
|
Usage Guidelines
To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.
Use the pwd command to show what directory or file system is specified as the default by the cd command.
Task ID
Task ID
|
Operations
|
filesystem
|
read
|
Examples
The following example shows how to display the present working directory:
RP/0/RP0/CPU0:router# pwd
Related Commands
Command
|
Description
|
cd
|
Changes the default directory or file system.
|
dir
|
Displays a list of files on a file system.
|
rmdir
To remove an existing directory, use the rmdir command in Administration EXEC mode or in Administration EXEC mode.
rmdir filesystem: [location node-id | location all]
Syntax Description
filesystem
|
Name of the file system from which to delete a directory, followed by a colon.
|
location node-id
|
(Optional) Removes a directory from the designated node.
|
location all
|
(Optional) Removes a directory from all nodes.
|
Command Modes
Administration EXEC
EXEC
Command History
Releases
|
Modifications
|
Release 2.0
|
This command was introduced on the Cisco CRS-1.
|
Release 3.0
|
No modification.
|
Release 3.2
|
This command was first supported on the Cisco XR 12000 Series Router. The command was made available in Administration EXEC mode.
Support was added to remove a directory from a node or from all nodes.
|
Release 3.3.0
|
No modification.
|
Release 3.4.0
|
No modification.
|
Usage Guidelines
To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.
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.
Task ID
Task ID
|
Operations
|
filesystem
|
execute
|
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:
37146 drwx 4096 Sun Dec 14 15:30:48 2003 malloc_dump
43030 drwx 4096 Wed Dec 24 11:20:52 2003 tracebacks
43035 drwx 4096 Thu Jan 8 18:59:18 2004 sau
51026 drwx 4096 Sat Dec 27 02:52:46 2003 tempA
51027 drwx 4096 Sat Dec 27 02:04:10 2003 dir.not.del
-430307552 -rwx 342 Fri Jan 16 10:47:38 2004 running-config
-430305504 -rwx 39790 Mon Jan 26 23:45:56 2004 cf.dat
39929724928 bytes total (39883235328 bytes free)
Related Commands
Command
|
Description
|
delete
|
Deletes files from the current directory.
|
dir
|
Displays a list of files on a file system.
|
mkdir
|
Creates a new directory on a flash file system.
|
show filesystem
To display the layout and contents of file systems, use the show filesystem command in EXEC mode.
show filesystem [location node-id | location all]
Syntax Description
location node-id
|
(Optional) Displays the layout and contents of file systems on the designated node. The node-id argument is entered in the rack/slot/module notation.
|
location all
|
(Optional) Displays the layout and contents of file systems on all nodes.
|
Defaults
The file system for the active RP is displayed.
Command Modes
EXEC
Command History
Release
|
Modification
|
Release 2.0
|
This command was introduced on the Cisco CRS-1.
|
Release 3.0
|
No modification.
|
Release 3.2
|
This command was first supported on the Cisco XR 12000 Series Router.
Support was added to display the layout and contents of file systems on all nodes.
|
Release 3.3.0
|
No modification.
|
Release 3.4.0
|
No modification.
|
Usage Guidelines
To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.
Use the show filesystem command to learn the alias names (prefixes) of the file systems supported by your networking device.
Task ID
Task ID
|
Operations
|
basic-services
|
read
|
Examples
The following is sample output from the show filesystem command:
RP/0/RP0/CPU0:router# show filesystem
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 is sample output from the show filesystem command using the optional location keyword and node-id argument:
RP/0/RP0/CPU0:router# show filesystem location 0/rp0/cpu0
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 3 describes the significant fields shown in the display.
Table 3 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.
|
squeeze
To permanently erase files tagged as "deleted" or "error" on a flash file system, use the squeeze command in EXEC mode.
squeeze filesystem:
Syntax Description
filesystem:
|
Name of the file system, followed by a colon.
|
Command Modes
EXEC
Command History
Release
|
Modification
|
Release 3.2
|
This command was introduced on the Cisco XR 12000 Series Router.
|
Release 3.3.0
|
No modification.
|
Release 3.4.0
|
No modification.
|
Usage Guidelines
To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.
When flash memory is full, you might need to rearrange the files so that the space used by the files marked "deleted" can be reclaimed. (This "squeeze" process is required for linear flash memory cards to make sectors contiguous; the free memory must be in a "block" to be usable.)
When you enter the squeeze command, the router copies all valid files to the beginning of flash memory and erases all files marked "deleted." After the squeeze process is completed, you can write to the reclaimed flash memory space.
Caution 
After performing the squeeze process you cannot recover deleted files using the
undelete command.
In addition to removing deleted files, the squeeze command removes any files that the system has marked as "error." An error file is created when a file write fails (for example, the device is full). To remove error files, you must use the squeeze command.
Rewriting flash memory space during the squeeze operation may take several minutes.
Task ID
Task ID
|
Operations
|
basic-services
|
execute
|
Examples
The following example shows how to permanently erase files tagged as "deleted" or "error" on the bootflash file system:
RP/0/0/CPU0:router# squeeze bootflash:
All deleted files will be removed. Continue? [confirm] y
Squeeze operation may take a while. Continue? [confirm] y
Squeeze under progress 30
Squeeze of bootflash: complete
Related Commands
Command
|
Description
|
delete
|
Deletes a file on a flash memory device.
|
dir
|
Displays a list of files on a file system.
|
undelete
|
Recovers a file marked "deleted" on a flash file systems
|
undelete
To recover a file marked "deleted" on a flash file system, use the undelete command in Administration EXEC mode or in EXEC mode.
undelete index [filesystem:]
Syntax Description
index
|
Number that indexes the file in the dir command output.
|
filesystem:
|
(Optional) File system containing the file to undelete, followed by a colon.
|
Defaults
The default file system is the one specified by the cd command.
Command Modes
Administration EXEC
EXEC
Command History
Release
|
Modification
|
Release 3.2
|
This command was introduced on the Cisco XR 12000 Series Router. The command was made available in Administration EXEC mode.
|
Release 3.3.0
|
No modification.
|
Release 3.4.0
|
No modification.
|
Usage Guidelines
To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.
For flash file systems, when you delete a file, the Cisco IOS XR software simply marks the file as deleted, but it does not erase the file. The undelete command allows you to recover a "deleted" file on a specified flash memory device. You must undelete a file by its index because you could have multiple deleted files with the same name. For example, the "deleted" list could contain multiple configuration files with the name router-config. You undelete by index to indicate which of the many router-config files from the list to undelete. Use the dir command to learn the index number of the file you want to undelete.
You cannot undelete a file if a valid (undeleted) file with the same name exists. Instead, you first delete the existing file and then undelete the file you want. For example, if you had an undeleted version of the router-config file and you wanted to use a previous, deleted version instead, you could not simply undelete the previous version by index. You would first delete the existing router-config file and then undelete the previous router-config file by index. You can delete and undelete a file up to 15 times.
On flash file systems, if you try to recover the configuration file pointed to by the CONFIG_FILE environment variable, the system prompts you to confirm recovery of the file. This prompt reminds you that the CONFIG_FILE environment variable points to an undeleted file. To permanently delete all files marked "deleted" on a flash memory device, use the squeeze command.
Task ID
Task ID
|
Operations
|
filesystem
|
execute
|
Examples
The following example recovers the deleted file whose index number is 1 on the bootflash file system:
RP/0/0/CPU0:router# undelete 1 bootflash:
Related Commands
Command
|
Description
|
cd
|
Changes the default directory or file system.
|
delete
|
Deletes a file on a flash memory device.
|
dir
|
Displays a list of files on a file system.
|
pwd
|
Displays the current setting of the cd command.
|
squeeze
|
Permanently deletes flash files by squeezing a flash file system.
|