The SR OS file system is used to store files used and generated by the system, for example, image files, configuration files, logging files and accounting files.
The file commands allow you to copy, create, move, and delete files and directories, navigate to a different directory, display file or directory contents and the image version.
Although some of the storage devices on routers are not actually compact flash devices (for example, cf1: on the 7950 XRS is an internal SSD), we refer to all storage devices as compact flash.
The file system is based on a DOS file system. In the 7750 SR and 7450 ESS, each control processor can have up to three storage devices numbered one through three. In the 7950 XRS, each CCM has an SSD and up to two compact flash devices. The names for these devices are:
The above device names are relative device names as they refer to the devices local to the control processor with the current console session. As in the DOS file system, the colon (“:”) at the end of the name indicates it is a device.
The three compact flash devices on the 7450 ESS and 7750 SR OS are removable and have an administrative state.
The cf2: and cf3: compact flash devices on the 7950 XRS routers are removable and have an administrative state. cf1: is an internal SSD.
Devices vary by platform as compact flash, SD card, USB, or embedded SSD. The format used for the removable storage devices is DOS FAT32. The maximum size supported is 32 GB.
Note: To prevent corrupting open files in the file system, you should only remove a compact flash that is administratively shutdown. SR OS gracefully closes any open files on the device, so it can be safely removed. |
The arguments for the SR OS file commands are modeled after standard universal resource locater (URL). A URL refers to a file (a file-url) or a directory (a directory-url).
The SR OS supports operations on both the local file system and on remote files. For the purposes of categorizing the applicability of commands to local and remote file operations, URLs are divided into five types of URLs: local, ftp, tftp, http, and https. The syntax for each of the URL types are listed in Table 3.
URL Type | Syntax | Notes |
local-url | [cflash-id:\]path | cflash-id is the compact flash device name. Values: cf1:, cf2:, cf3: |
ftp-url | ftp://[username[:password]@]host/path | An absolute ftp path from the root of the remote file system. username is the ftp user name password is the ftp user password host is the remote host path is the path to the directory or file |
ftp://[username[:password]@]host/./path | A relative ftp path from the user’s home directory. Note the period and slash (“./”) in this syntax compared to the absolute path. | |
tftp-url | tftp://host[/path]/filename | tftp is only supported for operations on file-urls. |
http-url | http://[username[:password]@]host[:port]/path | host is an HTTP server port defaults to 80 |
https-url | https://[username[:password]@]host[:port]/path | host is an HTTPS server port defaults to 443 |
If the host portion of the URL is an IPv6 address, then the address should be enclosed in square brackets. For example:
ftp://user:passw@[3ffe::97]/./testfile.txt
tftp://[2001:db8:3333:4444:5555:6666:7777:8888]/./testfile.txt
The system accepts either forward slash (/) or backslash (\) characters to delimit directory and/or filenames in URLs. Similarly, the SR OS SCP client application can use either slash or backslash characters, but not all SCP clients treat backslash characters as equivalent to slash characters. In particular, UNIX systems will often times interpret the backslash character as an escape character. This can cause problems when using an external SCP client application to send files to the SCP server. If the external system treats the backslash like an escape character, the backslash delimiter will get stripped by the parser and will not be transmitted to the SCP server.
For example, a destination directory specified as “cf1:\dir1\file1” will be transmitted to the SCP server as “cf1:dir1file1” where the backslash escape characters are stripped by the SCP client system before transmission. On systems where the client treats the backslash like an escape character, a double backslash (\\) or the forward slash (/) can typically be used to properly delimit directories and the filename.
When a special character is used in a password, it can cause issues when that password is encoded as part of a URL. To prevent this issue, percent encoding can be used. Percent encoding is a mechanism to encode 8-bit characters that have specific meaning in the context of URLs. The encoding consists of substitution of a percent character (%) followed by the hexadecimal representation of the ASCII value of the replaced character.
Some file manipulation commands such as copying, removing, or moving files, may request access to an HTTP or HTTPS server. If an HTTP or HTTPS server redirects the system to a different URL (from an "HTTP 301" error or similar response), the system prompts the user "y/n" to either repeat the operation with the new URL or terminate it. These file commands can be configured to force the HTTP redirects without prompting or they can be configured to refuse HTTP redirects. If a file command is redirected more than eight times, or if it queries an HTTPS URL and gets redirected to an HTTP URL, the command automatically terminates as a security measure.
For example, to refuse HTTP redirects, use the no-redirect parameter in the classic CLI command.
To refuse HTTP redirects with the MD-CLI command, use the direct-http parameter.
To force the HTTP redirects without prompting, use the force parameter in either the classic CLI or the MD-CLI.
When connecting to an HTTPS server, the system verifies the server's TLS certificate. For the certificate to pass verification, the system must have a CA profile already configured for the server's Certificate Authority (CA), which specifies up-to-date certificate and CRL files. HTTPS file commands do not use the Online Certificate Status Protocol (OCSP). If the certificate was issued by an intermediate CA, the system must have a CA profile for every CA tracing back to the root CA. If the server's certificate fails verification for any reason, the file command terminates. Refer to the 7450 ESS, 7750 SR, and VSR Multiservice Integrated Service Adapter and Extended Services Appliance Guide for more information about CA profiles.
The CLI command to configure the CA profile is in the configure system security pki ca-profile context.
An HTTPS file command may also include a client-tls-profile parameter, referring to a client TLS profile that provides the cipher list, client certificate, and trust anchor the system uses when communicating with the HTTPS server. Refer to the 7450 ESS, 7750 SR, 7950 XRS, and VSR System Management Guide for more information about client TLS profiles.
A file command that connects to an HTTP or HTTPS server outside the local network may need to use an HTTP proxy. The user may add the proxy parameter to point to a proxy server (which must be an HTTP URL).
SR OS supports the standard DOS wildcard characters. The asterisk (*) can represent zero or more characters in a string of characters. The question mark (?) represents any one character and must be enclosed in quotation marks (" ").
Classic CLI example:
MD-CLI Example:
The following sections are basic system tasks that can be performed in the classic CLI.
For more information about the supported classic CLI commands, refer to the 7450 ESS, 7750 SR, 7950 XRS, and VSR Classic CLI Command Reference Guide.
When a file system operation is performed that can potentially remove or overwrite a file system entry, a prompt appears to confirm the action. The force keyword performs the operation without displaying the confirmation prompt.
All the commands can operate on the local file system. Table 4 indicates which commands also support remote file operations.
Command | local-url | ftp-url | tftp-url | http-url | https-url |
attrib | ✓ | ||||
cd | ✓ | ✓ | |||
copy | ✓ | ✓ | ✓ | ✓ | ✓ |
delete | ✓ | ✓ | ✓ | ✓ | |
dir | ✓ | ✓ | |||
md | ✓ | ||||
move | ✓ | ✓ | ✓ | ✓ | |
rd | ✓ | ||||
scp | source only | ||||
type | ✓ | ✓ | ✓ | ✓ | ✓ |
unzip | ✓ | source only | source only | ||
version | ✓ | ✓ | ✓ | ||
vi | ✓ |
Use the dir command to display a list of files on a file system. The type command displays the contents of a file. The version command displays the version of an SR OS image file.
Use the following CLI syntax to display directory and file information:
The following shows an example of the command syntax:
The system administrator can change the read-only attribute in the local file.
Enter the attrib command with no options to display the contents of the directory and the file attributes.
Use the following CLI syntax to modify file attributes:
The following example shows the file configuration:
New directories can be created in the local file system, one level at a time.
Use the md command to create a new directory.
The cd command navigates to different directories.
The following example shows the creation of three levels of directories.
A variety of files and file types, including image files and configuration files, can be uploaded or downloaded to and from flash cards or TFTP servers.
Use the copy command to copy files locally.
The scp command copies files between hosts on a network. It uses SSH for data transfer, and uses the same authentication and provides the same security as SSH.
The source file for the scp command must be local. The file must reside on the router. The destination file has to be of the format: user@host:file-name. The destination does not need to be local.
The following displays examples of the command syntax:
Files or directories can be moved from one location to another.
Use the following CLI syntax to move files:
Use the delete and rd commands to delete files and remove directories. Directories can be removed even if they contain files and/or subdirectories. To remove a directory that contains files and/or subdirectories, use the rd rf command. When files or directories are deleted, they cannot be recovered.
The force option deletes the file or directory without prompting the user to confirm.
Use the following CLI syntax to delete files and then remove directories:
The following displays an example of the command syntax:
Use the following CLI syntax to remove a directory without first deleting files or subdirectories:
Use the unzip command to expand the contents of a ZIP file to the local file system. Any file that is zipped using the store, deflate, or zip64 compression methods can be unzipped. An example is the SR OS software image available from the Nokia customer support portal.
The source ZIP file location can be a locally installed solid-state storage device or a remote FTP or TFTP server.
The create-destination keyword ensures that any non-existent directory structure that is explicitly entered as the destination file URL is created as part of the unzip operation. This parameter is required to create new directories.
Note:
|
To unzip files, use the following CLI syntax:
The following example displays the unzip command syntax:
Use the repair command to check a compact flash device for errors and repair any errors found.
Use the following CLI syntax to check and repair a compact flash device:
The following example shows the command syntax:
The following sections are basic system tasks that can be performed in the MD-CLI.
For more information about the supported MD-CLI commands, refer to the 7450 ESS, 7750 SR, and 7950 XRS MD-CLI Command Reference Guide.
When a file system operation is performed that can potentially remove or overwrite a file system entry, a prompt appears to confirm the action. The force keyword performs the operation without displaying the confirmation prompt.
All the commands can operate on the local file system. Table 5 indicates which commands also support remote file operations.
Command | local-url | ftp-url | tftp-url | http-url | https-url |
change-directory | ✓ | ✓ | |||
checksum | ✓ | ✓ | ✓ | ||
copy | ✓ | ✓ | ✓ | ✓ | ✓ |
list | ✓ | ✓ | |||
make-directory | ✓ | ||||
move | ✓ | ✓ | ✓ | ✓ | |
permission | ✓ | ||||
remove | ✓ | ✓ | ✓ | ✓ | |
remove-directory | ✓ | ||||
show | ✓ | ✓ | ✓ | ✓ | ✓ |
unzip | ✓ | source only | source only | ||
version | ✓ | ✓ | ✓ |
Use the list command to list the files on a file system, with an option to indicate the list order based on the date, name, or size of the files. The show command displays the contents of a specified file or multiple files. The version command displays the version of an SR OS image file.
Use the following CLI syntax to display directory and file information:
The following shows an example of the command syntax:
The system administrator can change the attribute of a local file or files in a directory.
Enter the permission command with no options to display the contents of the directory and the file attributes.
A single local file can be specified or the wildcard character (*) can be used to indicate multiple files. If no URL is specified, the command applies to all files in the directory.
The following shows an example of the command syntax. A file with an “R” preceding the filename indicate the file is read-only; otherwise, the file is read-write.
New directories can be created in the local file system, one level at a time.
Use the make-directory command to create a new directory.
The change-directory command navigates to different directories.
The following example shows the creation of three levels of directories.
A variety of files and file types, including image files and configuration files, can be uploaded or downloaded to and from flash cards or TFTP servers.
Use the copy command to copy files.
The following example copies the md-config.cfg file to the test1 directory.
Files or directories can be moved from one location to another.
Use the following CLI syntax to move files:
The following example moves the md-config.cfg file to the test1/test2 directory.
Use the remove and remove-directory commands to delete files and remove directories. Directories can be removed even if they contain files or subdirectories.
Use the following CLI syntax to delete files and then remove directories:
The following example removes the test1/test2/test3 directory.
Use the unzip command to expand the contents of a ZIP file to the local file system. Any file zipped using the store, deflate, or zip64 compression methods can be unzipped. An example is the SR OS software image available from the Nokia customer support portal.
The source ZIP file location can be a locally installed solid-state storage device or a remote FTP or TFTP server.
The create-destination keyword ensures that any non-existent directory structure that is explicitly entered as the destination file URL is created as part of the unzip operation. This parameter is required to create new directories.
Note:
|
To unzip files, use the following CLI syntax:
The following example shows the command syntax:
Use the repair command to check a compact flash device for errors and repair any errors found.
Use the following CLI syntax to check and repair a compact flash device:
The following example shows the command syntax:
Use the checksum command to display file checksums of an SR OS image file.
Use the following CLI syntax to display checksums:
The following example shows the command syntax: