4. File System Management

This chapter provides information about file system management.

Topics in this chapter include:

4.1. The File System

The 7705 SAR 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, and display file or directory contents and the image version.

4.1.1. Compact Flash Device

The file system is based on a DOS file system. On the 7705 SAR, each CSM has an integrated compact flash device. The names for these devices are:

  1. cf3:
  2. cf3-A:
  3. cf3-B:

The first device name above (cf3:) is a relative device name in that it refers to the device local to the control processor on the CSM running the current console session. As in the DOS file system, the colon (“:”) at the end of the name indicates that it is a device.

The second and third device names (cf3-A: and cf3-B:) are absolute device names that refer directly to the device on CSM A or CSM B (CSM B applies only to chassis with redundant CSMs).

    The device cf3-B: does not apply to the following chassis because they do not have redundant CSMs:

  1. 7705 SAR-A
  2. 7705 SAR-Ax
  3. 7705 SAR-M
  4. 7705 SAR-H
  5. 7705 SAR-Hc
  6. 7705 SAR-W
  7. 7705 SAR-Wx
  8. 7705 SAR-X
Note:

  1. The 7705 SAR-8 Shelf V2, 7705 SAR-18, 7705 SAR-H, and 7705 SAR-M have removable compact flash cards.
  2. The 7705 SAR-A, 7705 SAR-Ax, 7705 SAR-Hc, 7705 SAR-W, and 7705 SAR-Wx do not have removable compact flash cards; they are shipped with integrated memory that is used to store system boot software, OS software, and configuration files and logs.
  3. The 7705 SAR-X has two removable compact flash cards but they are not field-replaceable. Replacement of the devices is done as a repair service.

On the 7705 SAR-18, cf3: is used to store the software image required for system startup and operation, including the application load. The 7705 SAR-18 CSM also has two optional compact flash slots for two compact flash devices (cf1: and cf2:). These compact flash devices are also referred to as cf1-A:/cf1-B: and cf2-A:/cf2-B: to indicate whether they are on CSM A or CSM B. All the compact flash devices can be used to store software upgrades, statistics, logging files, accounting files, scripts, and configuration data.

Note:

To prevent corruption of open files in the file system, compact flashes should be removed on those chassis that have replaceable compact flash cards only when the CFs are administratively shut down. The 7705 SAR gracefully closes any open files on the device so that it can be safely removed.

4.1.2. URLs

The arguments for the 7705 SAR file commands are modeled after the standard universal resource locator (URL).

A URL can refer to a file (a file-url) or a directory (a directory-url).

The 7705 SAR 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 three types of URLs: local, ftp, and tftp.

The syntax for each of the URL types is listed in Table 16.

Table 16:  URL Types and Syntax  

URL Type

Syntax

Notes

local-url

[cflash-id/] [file-path]

cflash-id is the compact flash device name

Values: cf1: | cf1-A: | cf1-B: | cf2: | cf2-A: | cf2-B: | cf3: | cf3-A: | cf3-B:

(the 7705 SAR-18 supports all values; the 7705 SAR-8 Shelf V2 supports cf3:, cf3-A:, and cf3-B:; all fixed platforms support cf3: and cf3-A:)

Length: 200 characters maximum, including cflash-id; directory length is 99 characters maximum each

path is the path to the directory or file

remote-url

[ftp://login:pswd@remote-locn/] [file-path]

An absolute ftp path from the root of the remote file system:

Length: 255 characters maximum (could be less depending on command); directory length is 99 characters maximum each

login is the ftp user name

pswd is the ftp user password

remote-locn is the remote host (hostname or IP address)

Values:

  1. hostname: host name of the remote location, up to 128 characters maximum
  2. ipv4-address: a.b.c.d
  3. “[“ipv6-address”]” (address must be enclosed in square brackets)
    1. x:x:x:x:x:x:x:x[-interface]
    2. x:x:x:x:x:x:d.d.d.d[-interface]
    3. x: [0 to FFFF]H
    4. d: [0 to 255]D
    5. interface: the interface name, 32 characters maximum, mandatory for link local addresses

path is the path to the directory or file

ftp://login:pswd]@host/./path

A relative ftp path from the user’s home directory. Note the period and slash (“./”) in this syntax, as compared to the absolute path.

tftp-url

tftp://login:pswd@remote-locn/file-path

tftp is only supported for operations on file-urls

Table 17 lists the commands that are supported both locally and remotely.

Table 17:  File Command Local and Remote File System Support 

Command

local-url

ftp-url

tftp-url

attrib

cd

copy

delete

dir

md

move

rd

repair

scp

source only

type

version

The 7705 SAR accepts either forward slash (“/”) or backslash (“\”) characters to delimit directory and/or filenames in URLs. Similarly, the 7705 SAR 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 interpret the backslash character as an “escape” character. This can cause problems when using an external SCP client application to send files to the 7705 SAR 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 7705 SAR SCP server.

For example, a destination directory specified as “cf3:\dir1\file1” will be transmitted to the 7705 SAR SCP server as “cf3: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.

4.1.3. Wildcards

The 7705 SAR supports the standard DOS wildcard characters. The asterisk (*) can represent zero or more characters in a string of characters, and the question mark (?) can represent any one character.

Example:

ALU-1>file cf3:\ # copy test*.cfg siliconvalley
     cf3:\testfile.cfg
     1 file(s) copied.
     ALU-1>file cf3:\ # cd siliconvalley
     ALU-1>file cf3:\siliconvalley\ # dir
      Volume in drive cf3 on slot A has no label.
     Directory of cf3:\siliconvalley\
     05/10/2006 11:32p      <DIR>          .
     05/10/2006 11:14p      <DIR>          ..
     05/10/2006 11:32p                7597 testfile.cfg
          1 File(s)                   7597 bytes.
          2 Dir(s)                 1082368 bytes free.
     ALU-1>file cf3:\siliconvalley\ #

As in a DOS file system, the 7705 SAR wildcard characters can only be used in some of the file commands.

4.2. Common Configuration Tasks

The following sections describe the basic system tasks that can be performed.

  1. Note:

    When a file system operation is performed with a command that can potentially delete or overwrite a file system entry (such as a copy, delete, move, rd, or scp command), a prompt appears to confirm the action. The force keyword performs the copy, delete, move, rd, or scp action without displaying the confirmation prompt.

4.2.1. Modifying File Attributes

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 CLI syntax displayed below to modify file attributes:

CLI Syntax:
file>
attrib [+r | -r] file-url

The following displays an example of the command syntax:

Example:
# file
file cf3:\ # attrib
file cf3:\ # attrib +r BOF.SAV
file cf3:\ # attrib

The following displays the file configuration:

     ALU-1>file cf3:\ # attrib
     cf3:\bootlog.txt
     cf3:\bof.cfg
     cf3:\boot.ldr
     cf3:\bootlog_prev.txt
     cf3:\BOF.SAV
ALU-1>file cf3:\ # attrib +r BOF.SAV
     ALU-1>file cf3:\ # attrib
     cf3:\bootlog.txt
     cf3:\bof.cfg
     cf3:\boot.ldr
     cf3:\bootlog_prev.txt
     R cf3:\BOF.SAV

4.2.2. Creating and Navigating Directories

Use the md command to create a new directory in the local file system, one level at a time.

Use the cd command to navigate to different directories.

Use the CLI syntax displayed below to create a new directory:

CLI Syntax:
file>
md file-url

The following displays an example of the command syntax:

Example:
file cf3:\ # md test1
file cf3:\ # cd test1
file cf3:\test1\ # md test2
file cf3:\test1\ # cd test2
file cf3:\test1\test2\ # md test3
file cf3:\test1\test2\ # cd test3
file cf3:\test1\test2\test3 #

4.2.3. Copying Files

Use the copy command to upload or download an image file, configuration file, or other file types to or from a flash card or a TFTP server.

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 7705 SAR router. The destination file must be in the format: user@host:file-name. The destination does not need to be local.

Use the CLI syntax displayed below to copy files:

CLI Syntax:
file>
copy source-file-url dest-file-url [force]
scp local-file-url destination-file-url [router router name | service-id] [force]

The following displays an example of the copy command syntax:

Example:
 
     ALU-1>file cf3::\ # copy 104.cfg cf3::\test1\test2\test3\test.cfg
     ALU-1>file cf3::\ # scp file1 admin@192.168.x.x:cf3::\file1 
     ALU-1>file cf3::\ # scp file2 user2@192.168.x.x:/user2/file2 
     ALU-1>file cf3::\ # scp cf3::/file3 admin@192.168.x.x:cf3::\file3

4.2.4. Moving Files

Use the move command to move a file or directory from one location to another.

Use the CLI syntax displayed below to move files:

CLI Syntax:
file>
move old-file-url new-file-url [force]

The following displays an example of the command syntax:

Example:
 
ALU-1>file cf3::\test1\test2\test3\ # move test.cfg cf3::\test1
     cf3::\test1\test2\test3\test.cfg
ALU-1>file cf3::\test1\test2\test3\ # cd ..
ALU-1>file cf3::\test1\test2\ # cd ..
ALU-1>file cf3::\test1\ # dir
 
 Directory of cf3::\test1\
     05/04/2006 07:58a      <DIR>          .
     05/04/2006 07:06a      <DIR>          ..
     05/04/2006 07:06a      <DIR>          test2
     05/04/2006 07:58a               25278 test.cfg
      1 File(s)                  25278 bytes.
      3 Dir(s)                 1056256 bytes free.
 ALU-1>file cf3::\test1\ #

4.2.5. Deleting Files and Removing Directories

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 CLI syntax displayed below to delete files and then remove directories:

CLI Syntax:
file>
delete file-url [force]
rd file-url [force]

The following displays an example of the command syntax:

ALU-1>file cf3::\test1\ # delete test.cfg
ALU-1>file cf3::\test1\ # delete abc.cfg
ALU-1>file cf3::\test1\test2\ # cd test3
ALU-1>file cf3::\test1\test2\test3\ # cd ..
ALU-1>file cf3::\test1\test2\ # rd test3
ALU-1>file cf3::\test1\test2\ # cd ..
ALU-1>file cf3::\test1\ # rd test2
ALU-1>file cf3::\test1\ # cd ..
ALU-1>file cf3::\ # rd test1
ALU-1>file cf3::\ #

Use the CLI syntax displayed below to remove a directory without first deleting files or subdirectories:

CLI Syntax:
file>
rd file-url rf

4.2.6. Displaying Directory and File Information

Use the dir command to display a list of files on a file system.

Use the type command to display the contents of a file.

Use the version command to display the version of a 7705 SAR both.tim file.

Use the CLI syntax displayed below to display directory and file information:

CLI Syntax:
file>
dir [file-url]
type file-url
version file-url

The following displays an example of the command syntax:

A:ALU-1# file
A:ALU-1>file cf3::\ # dir 
 
 Volume in drive cf3: on slot A has no label.
 
 Volume in drive cf3: on slot A is formatted as FAT32.
 
Directory of cf3::\
 
02/08/2008  11:23a              140584 boot.ldr
02/07/2008  12:19p                 786 bof.cfg
02/13/2008  05:42p                2058 bootlog.txt
01/13/2008  05:42p                2434 bootlog_pre.txt
01/30/2008  05:17p                 797 bof.cfg.arash
01/25/2008  04:11p      <DIR>          TXT
01/30/2008  11:36a                 787 bof.cfg.ftp
01/30/2008  01:11p                 736 bof.cfg.root
01/30/2008  11:35a                 886 bof.cfg.deep
01/30/2008  11:35a                 483 bof.cfg.JC
               8 File(s)                 411097 bytes.
               1 Dir(s)                 1043456 bytes free.
A:ALU-1>file cf3::\ # type bof.cfg
# TiMOS-B-1.1.R1 both/hops NOKIA SAR 7705
# Copyright (c) 2016 Nokia.
# All rights reserved. All use subject to applicable license agreements.
# Built on Wed Apr 9 09:53:01 EDT 2016 by csabuild in /rel2.0/b1/R1/panos/main
 
# Generated WED APR 09 20:18:06 2016 UTC
 
    primary-image    ftp://*:*@xxx.xxx.xxx.xx/home/csahwreg17/images/both.tim
    primary-config   ftp://*:*@ xxx.xxx.xxx.xx /home/csahwreg17/images/dut-a.cfg
    address          xxx.xxx.xxx.xx /24 active
    address          xxx.xxx.xxx.xx /24 standby
    primary-dns      xxx.xxx.xxx.xx
    dns-domain       labs.ca.alcatel-lucent.com
    static-route     xxx.xxx.0.0/16 next-hop xxx.xxx.xxx.x
    autonegotiate
    duplex           full
    speed            100
    wait             3
    persist          off  
    console-speed    115200
 
A:ALU-1>file cf3::\ # 

4.2.7. Repairing the File System

Use the repair command to check a compact flash device for errors and repair any errors found.

Use the CLI syntax displayed below to check and repair a compact flash device:

CLI Syntax:
file
repair [flash-id]

The following displays an example of the command syntax:

ALU-1>file cf3:\ # repair 
Checking drive cf3: on slot A for errors...
Drive cf3: on slot A is OK.