33-File System Management Operation

Download


Chapter 1  File System Management

 

You can provide the directory argument in the following two ways in this chapter.

l      In the form of [drive] [path]. In this case, the argument can be a string containing 1 to 64 characters.

l      By specifying the name of a storage device, such as flash:/ and cf:/.

You can provide the file-url argument in the following two ways in this chapter.

l      In the form of [drive] [path] [file name]. In this case, the argument can be a string containing 1 to 64 characters.

l      By specifying the name of a storage device, such as flash:/ and cf:/.

 

1.1  File System Configuration

1.1.1  Introduction to File System

To facilitate management on storage devices such as the Flash of a switch, An Ethernet switch has the file system module built in. The file system allows you to access and manage files and directories, such as the operations of creating/deleting/modifying/renaming a file or a directory and displaying the contents of a file.

By default, a switch prompts for confirmation before executing the commands which have potential risks (for example, deleting and overwriting files).

 

&  Note:

l      S7506R switch support SRPU switchover. Both the primary and the secondary SRPU have file system built in for you to manipulate the files on the both SRPUs. Note that the URL of a file on the secondary SRPU must begin with slot[No.]#flash:/, where No. is the number of the slot where the secondary SRPU is seated. Assume that the secondary SRPU is seated in slot 1, then you need to use slot1#flash:/text.txt to identify the file named text.txt and residing in the root directory of the secondary SRPU.

 

1.1.2  CF Card Configuration

You can use CF (compact flash) card on a S7500 series switch to extend the memory space. A CF card can be seated in the compact flash slot of a SRPU.

l           With a CF card seated in the compact flash slot, you can access the root directory of the CF card by executing the cd cf: command.

l           The commands used to manipulate files, such as dir, copy, delete, and move, apply to the files on a CF card.

l           You can disable a CF card by using the umount cf: command. To use a disabled CF card again, you need to remove it and install it again.

Table 1-1  

Operation

Command

Description

Enter the root directory of a CF card

cd cf:

Required

Disable a CF card

umount cf:

Required

 

&  Note:

Currently, only Salience III SRPU supports CF card.

 

The operations listed in Table 1-2 are available in the directories on a CF card.

1.1.3  File System Configuration Tasks

Table 1-2 File system configuration tasks

Task

Remark

Related section

Directory-related operations

Optional

Section 1.1.4  Directory-Related Operations

File-related operations

Optional

Section 1.1.5  File-Related Operations

Storage device-related operations

Optional

Section 1.1.6  Storage Device-Related Operations

Setting the file system prompt mode

Optional

Section 1.1.7  Prompt Mode Configuration

 

1.1.4  Directory-Related Operations

The file system provides directory-related operations, such as:

l           Creating/deleting a directory

l           Displaying the information about the files or the directories in the current directory or a specified directory

Table 1-3 lists the directory-related operations.

Table 1-3 Directory-related operations

Operation

Command

Description

Create a directory

mkdir directory

Optional

Delete a directory

rmdir directory

Optional

Only empty directories can be deleted.

Display the current directory

Pwd

Optional

Display the information about specific directories and files

dir [ /all ] [ file-url ]

Optional

Enter a specified directory or switch to a specified storage device

cd directory

Optional

 

&  Note:

In the output information of the dir /all command, deleted files (that is, those in the recycle bin) are embraced in brackets.

 

1.1.5  File-Related Operations

The file system also provides file-related operations, such as:

l           Deleting a file

l           Restoring a deleted file

l           Deleting a file completely

l           Managing a configuration file

l           Renaming a file

l           Copying a file

l           Moving a file

l           Displaying the content of a file

l           Displaying the information about a file

l           Checking file system

l           Executing a batch file

Table 1-4 lists the file-related operations.

Table 1-4 File-related operations

Operation

Command

Description

Delete a file

delete [ /unreserved ] file-url

Optional

A deleted file can be restored if you delete it by executing the delete command with the /unreserved keyword not specified. You can use the undelete command to restore a deleted file of this kind.

Restore a deleted file

undelete file-url

Optional

This operation can only restore the files deleted with the /unreserved keyword not specified.

Delete a file in the recycle bin

reset recycle-bin [ file-url ] [ /force ]

Optional

Rename a file

rename fileurl-source fileurl-dest

Optional

Copy a file

copy fileurl-source fileurl-dest

Optional

Move a file

move fileurl-source fileurl-dest

Optional

Display the content of a file

more file-url

Optional

Currently, the file system only supports displaying the contents of a file in texts.

Display the information about a directory or a file

dir [ /all ] [ file-url ]

Optional

Enter system view

system-view

Execute a batch file

execute file-url

Optional

 

  Caution:

l      For deleted files whose names are the same, only the latest deleted file can be restored.

l      The files which are deleted using the delete command with the /unreserved keyword not specified are actually moved to the recycle bin and thus still take storage space. You can clear the recycle bin to make room for other files by using the reset recycle-bin command.

l      In the output information of the dir /all command, deleted files (that is, those in the recycle bin) are embraced in brackets.

l      If the configuration files are deleted, the switch adopts the default configuration parameters when it starts the next time.

l      The execute command cannot be executed recursively.

 

1.1.6  Storage Device-Related Operations

With the file system, you can format a storage device, such as the Flash or a CF card. Note that the format operation leads to the loss of all files on the storage device and is irretrievable. For memory spaces that are unavailable due to unexpected errors, you can use the fixdisk command to restore them.

Table 1-5 Storage device-related operations

Operation

Command

Description

Format a storage device

format device

Optional

Restore a storage device

fixdisk device

Optional

 

1.1.7  Prompt Mode Configuration

You can set the file system prompt mode to be alert or quiet. When in the alert mode, the file system prompts for confirmation when you perform irreversible operations (such as deleting a file completely or overwriting a file). If you are in the quiet mode, you are not prompted when you execute the operations.

Table 1-6 lists the operations to configure the file system prompt mode.

Table 1-6 Configuration on prompt mode of file system

Operation

Command

Description

Enter system view

system-view

Set the file system prompt mode

file prompt { alert | quiet }

Required

By default, the file system prompt mode is alert.

 

1.1.8  File System Configuration Example

# Display all the files in the root directory of the file system on the local unit.

<H3C> dir /all

Directory of flash:/

 

   0   -rw-          4  Mar 09 2006 13:59:19   snmpboots

   1   -rw-   16215134  Apr 04 2006 16:36:20   S7500.bin

   2   -rw-        483  Apr 20 2006 14:50:54   diaginfo.txt

   3   -rw-       3980  Apr 21 2006 15:08:29   config.cfg

   4   drw-          -  Apr 16 2006 11:18:17   hj

   5   drw-          -  Apr 10 2005 19:07:59   dd

   6   -rw-      11779   Apr 05 2006 10:23:03   test.bak

   7   -rw-      19307   Apr 16 2006 11:15:55   1.txt

   8   -rw-         66   Apr 05 2006 11:32:28   temp1

 

31877 KB total (15876 KB free)

# Create a directory named test.

<H3C> mkdir test

.

%Created dir flash:/test.

# Copy flash:/config.cfg as flash:/test/1.cfg.

<H3C> copy flash:/config.cfg flash:/test/1.cfg

......

%Copy file flash:/config.cfg to flash:/test/1.cfg...Done.

# Display the file information.

<H3C> dir /all

Directory of flash:/

 

   0   -rw-          4  Mar 09 2006 13:59:19   snmpboots

   1   -rw-   16215134  Apr 04 2006 16:36:20   S7500.bin

   2   -rw-        483  Apr 20 2006 14:50:54   diaginfo.txt

   3   -rw-       3980  Apr 21 2006 15:08:29   config.cfg

   4   drw-          -  Apr 16 2006 11:18:17   hj

   5   drw-          -  Apr 10 2005 19:07:59   dd

   6   -rw-      11779  Apr 05 2006 10:23:03   test.bak

   7   -rw-      19307  Apr 16 2006 11:15:55   1.txt

   8   -rw-         66  Apr 05 2006 11:32:28   temp1

   9   drw-          -  Apr 25 2006 16:27:46   test

 

31877 KB total (15876 KB free)

<H3C> dir flash:/test/

Directory of flash:/test/

 

   0   -rw-      3980  Apr 25 2006 16:33:21   1.cfg

 

31877 KB total (15869 KB free)

# Enter directory test.

<H3C> cd test

# Rename 1.cfg as c.cfg.

<H3C> rename 1.cfg c.cfg

.

%Renamed file flash:/1.cfg to flash:/c.cfg. 

# Delete the file c.cfg

<H3C> delete c.cfg.

 

%Deleted file flash:/test/c.cfg.    

# Restore the file c.cfg.

<H3C> undelete c.cfg

....

%Undeleted file flash:/test/c.cfg.

# Display the content of the file c.cfg.

<H3C>more c.cfg

 

#

 sysname H3C S7503

#

 local-server nas-ip 127.0.0.1 key security

#

 domain default enable system

#

 temperature-limit 0 10 70

 temperature-limit 2 10 80

 temperature-limit 3 10 70      

……(Omitted)