24-File System Management Command

Download


Chapter 1  File System Management Configuration Commands

1.1  File Attribute Configuration Commands

1.1.1  boot attribute-switch

Syntax

boot attribute-switch { all | app | configuration | web }

View

User view

Parameter

all: Specifies all the files, including app files, configuration files and Web files.

app: Specifies app files.

configuration: Specifies configuration files.

web: Specifies Web files.

 

&  Note:

l      An app file is an executable file, with bin as the extension.

l      A configuration file is used to store and restore configuration, with cfg as the extension.

l      A Web files is used for Web-based network management, with web as the extension.

 

Description

Use the boot attribute-switch command to switch between the main and backup attribute for all the files or a specified type of files. That is, changes a file with the main attribute to one with the backup attribute, or vice versa.

Example

# Switch the attributes of all the files on the switch.

<H3C>boot attribute-switch all

The boot, web and configuration file's backup-attribute and main-attribute will

 exchange.

 Are you sure? [Y/N]

Before pressing ENTER you must choose 'YES' or 'NO'[Y/N]:y

 The boot, web and configuration file's backup-attribute and main-attribute successfully exchanged on unit 1!

1.1.2  boot boot-loader

Syntax

boot boot-loader file-url

View

User view

Parameter

file-url: Path or the name of the app file in the Flash, a string comprising 1 to 64 characters.

Description

Use the boot boot-loader command to configure the main attribute of the app file. The app file specified by this command becomes the main startup file when the device starts the next time.

 

  Caution:

Make sure the app file to be specified as the most preferred startup file exists before executing this command.

 

Example

# Configure the file named boot.bin as the main startup file.

<H3C>boot boot-loader boot.bin

The specified file will be booted next time on unit 1!

1.1.3  boot boot-loader backup-attribute

Syntax

boot boot-loader backup-attribute file-url

View

User view

Parameter

file-url: Path or the name of the app file in the Flash, a string comprising 1 to 64 characters.

Description

Use the boot boot-loader backup-attribute command to configure the backup attribute of the app file. The app file specified by this command becomes the backup startup file when the device starts up the next time. When the main startup file is unavailable, the backup startup file is used to start the switch.

 

  Caution:

Make sure the app file to be specified as the backup startup file exists before executing this command.

 

Example

# Configure the file named backup.bin to be the backup startup file.

<H3C>boot boot-loader backup-attribute backup.bin

Set boot file backup-attribute successfully on unit 1!

1.1.4  boot web-package

Syntax

boot web-package webfile { backup | main }

View

User view

Parameter

webfile: Name of a Web file, a string comprising 5 to 127 characters (including extension .web).

backup: Specifies the file to be of the backup attribute.

main: Specifies the file to be of the main attribute.

Description

Use the boot web-package command to configure a Web file to be of the main or backup attribute.

 

  Caution:

l      Make sure the Web file which the webfile argument identifies exists before executing this command.

l      The configuration of the main or backup attribute of a Web file takes effect immediately without restarting the device.

 

Example

# Configure the Web file named boot.web to be of the main attribute.

<H3C>boot web-package http.web main

1.1.5  display boot-loader

Syntax

display boot-loader [ unit unit-id ]

View

Any view

Parameter

unit unit-id: Specifies the unit ID of a switch. It only can be 1.

Description

Use the display boot-loader command to display the information about the app startup files of a switch, including the current app startup file name, the main and backup app startup files to be used when the switch starts the next time.

Example

# Display the information about the app startup files of unit 1.

[H3C]display boot-loader unit 1

Unit 1

   The current boot app is: abc.bin                                         

   The main boot app is:    abc.bin                                         

   The backup boot app is:  abcbak.bin                                       

1.1.6  display startup

Syntax

display startup [ unit unit-id ]

View

Any view

Parameter

unit unit-id: Specifies the unit ID of a switch.

Description

Use the display startup command to display the startup configuration of a switch, including the name of the current startup configuration file, the names of the main startup configuration file and backup startup configuration file to be used when the switch starts the next time, and so on.

Related command: startup saved-configuration.

Example

# Display the startup configuration of unit 1.

[H3C]display startup unit 1

MainBoard:                                                                     

  Current Startup saved-configuration file:          NULL                      

  Next main startup saved-configuration file:        flash:/123.cfg            

  Next backup startup saved-configuration file:      flash:/back.cfg           

  Bootrom-access enable state:                       enabled                   

1.1.7  startup bootrom-access enable

Syntax

startup bootrom-access enable

undo startup bootrom-access enable

View

User view

Parameter

None

Description

Use the startup bootrom-access enable command to specify a switch to prompt for the customized password before entering the BOOT menu.

Use the undo startup bootrom-access enable command to disable the above function.

By default, the above function is enabled.

You can use the display startup command to verify these two commands.

Example

# Specify to prompt for the customized password before entering the BOOT menu.

<H3C> startup bootrom-access enable

1.1.8  startup saved-configuration

Syntax

startup saved-configuration cfgfile [ backup | main ]

undo startup saved-configuration [ unit unit-id ]

View

User view

Parameter

cfgfile: Path name or file name of the configuration file in the Flash, a string comprising 5 to 56 characters. Currently, a configuration file is store in the root directory of a storage device.

backup: Specifies the file to be of the backup attribute.

main: Specifies the file to be of the main attribute.

unit unit-id: Specifies the unit ID of a switch.

Description

Use the startup saved-configuration command to specify the main or backup configuration file for a switch to start the next time.

Use the undo startup saved-configuration command to specify a switch to start without loading the configuration file.

If you execute the startup saved-configuration command with neither the backup nor the main keyword specified, the specified file is assigned the main attribute.

 

  Caution:

To make a switch to start without loading the configuration file, do not execute the save command after executing the undo startup saved-configuration command.

 

Related command: display startup.

Example

# Configure the file named config.cfg to be the main configuration file for the switch to start the next time.

<H3C>startup saved-configuration config.cfg main

Please wait......Done!                                                        

%Apr  2 02:55:10:025 2000 H3C CFM/3/CFM_LOG:- 1 -Unit1 set the configuration

 successfully.                                                                 

<H3C>                                                                      

%Apr  2 02:55:10:134 2000 H3C CFM/3/CFM_LOG:- 1 -Unit2 set the configuration

 successfully.

1.2  File System Configuration Commands

 

&  Note:

Note to limit the lengths of file path and file name within the following ranges regulated for the switch.

l      A directory name should be no more than 91 characters.

l      A file name plus its local path name should be no more than 127 characters.

l      A device name should be no more than 14 characters.

l      A file name plus its complete path name should be no more than 142 characters.

 

1.2.1  cd

Syntax

cd directory

View

User view

Parameter

directory: Target directory.

Description

Use the cd command to enter a specified directory on the Ethernet switch.

The default directory is the root directory of the Flash.

Example

# Enter the directory named test.

<H3C> cd test

<H3C> pwd

unit1>flash:/test

1.2.2  copy

Syntax

copy fileurl-source fileurl-dest

View

User view

Parameter

fileurl-source: Path name or file name of the source file in the Flash.

fileurl-dest: Path name or file name of the destination file in the Flash.

Description

Use the copy command to copy a file.

If the fileurl-dest argument identifies an existing file, the system prompts you for the confirmation to overwrite the existing file.

Example

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

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

Copy unit1>flash:/config.cfg to unit1>flash:/test/1.cfg?[Y/N]:y

..

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

1.2.3  delete

Syntax

delete [ /unreserved ] file-url

delete { running-files | standby-files } [ /unreserved ]

View

User view

Parameter

/unreserved: Deletes a file completely.

file-url: Path or the file name of a file in the Flash. You can use the “*” character in this argument as a wildcard. For example, the delete *.txt command deletes all the files with txt as their extensions.

running-files: Specifies all the files with the main attribute.

standby-files: Specifies all the files with the backup attribute.

Description

Use the delete command to delete a specified file stored on a switch.

If you execute the delete command with the /unreserved keyword specified, the specified file is completely deleted. (That is, the file cannot be restored.)

You can also use the delete command to delete files by file attribute. The delete running-files command deletes all the files with the main attribute, and the delete standby-files command deletes all the files with the backup attribute.

For a file that has both the main and backup attributes, the delete running-files deletes its main attribute only, and the delete standby-files command deletes its backup attribute only.

Deleted files are stored in the recycle bin.

Following are the notes on deleted files:

l           The dir command cannot display the information about deleted files.

l           To display the information about deleted files, use the dir /all command.

l           To restore a deleted file, use the undelete command.

l           To delete the files in the recycle bin, use the reset recycle-bin command.

When you use the delete running-files or delete standby-files command, you will be prompted to confirm whether to delete all files with the main/backup attribute. If you choose yes, the corresponding files are deleted. If you choose no, the system will further to prompt you confirming the following items orderly:

1)         Delete the image file with the main/backup attribute?

2)         Delete the configuration file with the main/backup attribute?

3)         Delete the Web file with the main/backup attribute?

The corresponding messages are displayed as follows:

Delete the running image file? [Y/N]:n

Delete the running config file? [Y/N]:n

Delete the running web file? [Y/N]:n

 

Delete the backup image file? [Y/N]:n

Delete the backup config file? [Y/N]:n

Delete the backup web file? [Y/N]:n

The files will be deleted after you choose yes.

 

  Caution:

For deleted files whose names are the same, only the latest deleted file is stored in the recycle bin and can be restored.

 

Example

# Delete the file test/test.txt on the local unit.

<H3C>delete test/test.txt

Delete unit1>flash:/test/test.txt?[Y/N]:y

.

%Delete file unit1>flash:/test/test.txt...Done.

# Delete the files that are of the backup attribute.

<H3C> delete standby-files

Delete all the backup files? [Y/N]:n

Delete the backup image file? [Y/N]:n

Delete the backup config file? [Y/N]:y

Delete the backup web file? [Y/N]:n

Start deleting ...

Deleting ... done

1.2.4  dir

Syntax

dir [ /all ] [ file-url ]

View

User view

Parameter

/all: Displays the information about all the files, including those in the recycle bin.

file-ur: Path name or the name of a file in the Flash. You can specify multiple files by inserting the “*” character as wildcards in this argument. For example, the dir *.txt command displays the information about all the files with the extension of txt in the current directory.

Description

Use the dir command to display the information about the specified files or directories on a switch.

In the output information, files with the main, backup or main/backup attribute a tagged. This command supports the wildcard of “*”.

 

&  Note:

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

 

Example

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

<H3C> dir

Directory of unit1>flash:/

 

   1 (*)   -rw-   4040342  Jan 07 2006 12:52:38   abc.bin

   2       -rw-    751035  Apr 02 2000 04:20:04   http3.1.4-0012.web

   3 (*)   -rw-       730  Apr 01 2000 23:57:31   vrpcfg.cfg

 

7239 KB total (2555 KB free)

 

(*) -with main attribute   (b) -with backup attribute

(*b) -with both main and backup attribute

# Display the information about all the files in the root directory of the file system, including the files in the recycle bin.

<H3C> dir /all

Directory of unit1>flash:/

 

   1 (*)   -rw-   4040342  Jan 07 2006 12:52:38   abc.bin

   2       -rwh         4    Apr 01 2000 23:55:59   snmpboots

   3       -rw-    751035  Apr 02 2000 04:20:04   http3.1.4-0012.web

   4 (*)   -rw-       730  Apr 01 2000 23:57:31   vrpcfg.cfg

 

7239 KB total (2555 KB free)

 

(*) -with main attribute   (b) -with backup attribute

(*b) -with both main and backup attribute 

1.2.5  display current-configuration

Syntax

display current-configuration [ configuration [ configuration-type ] | interface [ interface-type ] [ interface-number ] | vlan [ vlan-id ] ] [ by-linenum [ | { begin | include | exclude } regular-expression ] ]

View

Any view

Parameter

configuration: Displays the specified configuration.

configuration-type: Configuration type, which can be one of the following:

l           isp, which specifies the configuration of the internet service provider (ISP)

l           radius-template, which specifies RADIUS template configuration

l           system, which specifies the system configuration

l           user-interface, which specifies user interface configuration.

interface: Displays interface configuration.

interface-type: Interface type, which can be Aux, Ethernet, GigabitEthernet, or NULL.

interface-number: Interface number.

vlan: Displays VLAN configuration.

vlan-id: VLAN ID.

by-linenum: Displays line numbers.

|: Uses a regular expression to filter the configuration of the device to be displayed.

begin: Displays the configuration starting with the string specified by the regular-expression argument.

include: Displays the configuration including the string specified by the regular-expression argument.

exclude: Displays the configuration not including the string specified by the regular-expression argument.

regular-expression: A regular expression.

Table 1-1 Special characters used in a regular expression

Character

Meaning

Description

_

Underline. It is similar to a wildcard and can represent the following characters: (^|$|[,{}]), spaces, starting character and ending character.

If the first character of a regular expression is not “_”, the number of the underline characters in a regular expression is only limited by the length of a command line.

If the first character of a regular expression is “_”, there can be up to four other successive underline characters following it.

If the underline characters are not successive, only the first underline character group is matched. The subsequent underline groups are ignored.

(

Left parenthesis, push-in-stack signal

You are not recommended to use this character in a regular expression.

.

Period. A wildcard, it can represent any single character, including spaces.

None

*

Asterisk. It means that the preceding sub-expression can be matched for zero or multiple times.

zo* matches “z” and “zoo”.

+

Plus sign. It means that the preceding sub-expression can be matched for one or multiple times.

zo+ matches "zo" and “zoo”, but not "z".

 

Description

Use the display current-configuration command to display the current configuration of a switch.

Parameters that are the same as the default are not displayed.

As the display current-configuration command can be used to view the currently valid parameters, you can use this command to verify a group of configurations. Parameters that do not take effect are not displayed. For example, although you can perform PPP-related configurations on an interface encapsulated with X.25, the display current-configuration command does not display the PPP configuration information.

Related command: save, reset saved-configuration, display saved-configuration.

Example

# Display the currently valid configuration parameters of the Ethernet switch.

<H3C> display current-configuration

#                                                                               

 sysname H3C                                                               

#                                                                              

radius scheme system                                                           

#                                                                               

domain system                                                                  

#                                                                              

vlan 1                                                                          

#                                                                              

vlan 2                                                                         

#                                                                               

interface Vlan-interface2                                                      

#                                                                              

interface Aux1/0/0                                                              

#                                                                              

interface Ethernet1/0/1                                                        

#                                                                               

interface Ethernet1/0/2                                                        

#                                                                              

interface Ethernet1/0/3                                                         

#                                                                              

interface Ethernet1/0/4                                                        

#                                                                              

interface Ethernet1/0/5                                                        

#                                                                              

interface Ethernet1/0/6                                                        

#                                                                               

interface Ethernet1/0/7                                                        

#                                                                              

interface Ethernet1/0/8                                                         

#                                                                              

interface Ethernet1/0/9                                                        

#                                                                               

interface Ethernet1/0/10                                                       

#                                                                              

interface Ethernet1/0/11                                                        

#                                                                              

interface Ethernet1/0/12                                                       

#                                                                               

interface Ethernet1/0/13                                                       

#                                                                              

interface Ethernet1/0/14                                                       

#                                                                               

interface Ethernet1/0/15                                                       

#                                                                              

interface Ethernet1/0/16                                                       

#                                                                              

interface Ethernet1/0/17                                                       

#                                                                               

interface Ethernet1/0/18                                                       

#                                                                              

interface Ethernet1/0/19                                                        

#                                                                              

interface Ethernet1/0/20                                                       

#                                                                               

interface Ethernet1/0/21                                                       

#                                                                              

interface Ethernet1/0/22                                                        

#                                                                              

interface Ethernet1/0/23                                                       

#                                                                              

interface Ethernet1/0/24                                                       

#                                                                              

interface GigabitEthernet1/1/1                                                 

#                                                                               

interface GigabitEthernet1/2/1                                                 

#                                                                              

interface NULL0                                                                 

#                                                                              

 management-vlan 2                                                             

#                                                                               

user-interface aux 0                                                          

user-interface vty 0 4                                                         

#                                                                               

return                                          

# Display the lines that include the stings matching “10*” in the configuration information. (The character “*” means that the character 0 in the string before it can appear multiple times or does not appear.)

<H3C> display current-configuration | include 10*

primary authentication 127.0.0.1 1645

 primary accounting 127.0.0.1 1646

 local-server nas-ip 127.0.0.1 key easyKey

vlan 1

interface Vlan-interface1

 ip address 10.1.1.2 255.255.255.0

interface Ethernet1/0/1

 speed 1000

interface Ethernet1/0/2

interface Ethernet1/0/3

interface Ethernet1/0/4

  network 10.1.1.0 0.0.0.255

# Display the configuration information including the string “user”.

<H3C> display current-configuration | include ^user

user-interface aux 0

user-interface vty 0 4

1.2.6  display saved-configuration

Syntax

display saved-configuration [ unit unit-id ] [ by-linenum ]

View

Any view

Parameter

unit unit-id: Specifies the unit ID of a switch.

by-linenum: Displays line numbers.

Description

Use the display saved-configuration command to display the content of the main configuration file in the Flash of a switch.

You can use this command to check the startup configuration of a switch if it operates improperly after powered on.

Related command: save, reset saved-configuration, display current-configuration.

Example

# Display the content of the main configuration file in the Flash.

<H3C> display saved-configuration

#                                                                         

 sysname H3C                                                               

#                                                                              

radius scheme system                                                           

#                                                                               

domain system                                                                  

#                                                                              

vlan 1                                                                          

#LOCCFG. MUST NOT DELETE                                                       

#                                                                              

interface Aux1/0/0                                                              

#                                                                              

interface Ethernet1/0/1                                                        

#                                                                               

interface Ethernet1/0/2                                                        

#                                                                              

interface Ethernet1/0/3                                                         

#                                                                              

interface Ethernet1/0/4                                                        

#                                                                               

interface Ethernet1/0/5                                                        

#                                                                              

interface Ethernet1/0/6                                                        

#                                                                               

interface Ethernet1/0/7                                                        

#                                                                              

interface Ethernet1/0/8                                                        

#                                                                              

interface Ethernet1/0/9                                                        

#                                                                               

interface Ethernet1/0/10                                                       

#                                                                              

interface Ethernet1/0/11                                                        

#                                                                              

interface Ethernet1/0/12