To facilitate management on the switch memory,
S3100 series Ethernet switches provide the file system function, allowing you to
access and manage the files and directories. You can create, remove, copy or
delete a file through command lines, and you can manage files using
directories.
1.1.2 File System Configuration Tasks
Table 1-1
Configuration tasks on the file system
S3100 series Ethernet switches allow you to input a file path and
file name in one of the following ways:
l
In universal resource locator (URL) format and
starting with “unit1>flash:/”. or “flash:/” This
method is used to specify a file in the current Flash memory. For example, the
URL of a file named text.txt in the root directory of the switch is unit1>flash:/text.txt
or flash:/text.txt.
l
Entering the path name or file name directly.
This method can be used to specify a path or a file in the current work
directory. For example, to access file text.txt in the current directory, you
can directly input the file name text.txt as the file URL
1.1.3 Directory
Operations
The file system provides directory-related functions,
such as:
l
Creating/deleting a directory
l
Displaying the current work directory, or contents
in a specified directory
Table 1-2 describes the
directory-related operations.
Perform the following configuration in user
view.
Table 1-2 Directory
operations
|
To do…
|
Use the command…
|
Remarks
|
|
Create a directory
|
mkdir directory
|
Optional
|
|
Delete a directory
|
rmdir directory
|
Optional
|
|
Display the current work directory
|
pwd
|
Optional
|
|
Display the information about specific directories
and files
|
dir [ /all
] [ file-url ]
|
Optional
|
|
Enter a specified directory
|
cd directory
|
Optional
|
l
Only empty directories can be deleted by using
the rmdir command.
l
In the output information of the dir /all
command, deleted files (that is, those stored in the recycle bin) are embraced
in brackets.
The file system also provides file-related functions
listed in Table 1-3.
Perform the following configuration in user
view. Note that the execute command should be executed in system view.
Table 1-3 File operations
|
To do…
|
Use the command…
|
Remarks
|
|
Delete a file
|
delete [ /unreserved
] file-url
delete { running-files
| standby-files } [ /unreserved ]
|
Optional
A deleted file can be restored by using
the undelete command if you delete it by executing the delete
command without specifying the /unreserved keyword.
|
|
Restore a file in the recycle bin
|
undelete file-url
|
Optional
|
|
Delete a file from 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 text files.
|
|
Display the information about a directory
or a file
|
dir [ /all
] [ file-url ]
|
Optional
|
|
Enter system view
|
system-view
|
—
|
|
Execute the specified batch file
|
execute filename
|
Optional
This command should be executed in system
view.
|
Caution:
l
For deleted files whose names are the same, only
the latest deleted file is kept in the recycle bin and can be restored.
l
The files which are deleted by the delete
command without the /unreserved keyword are actually moved to the
recycle bin and thus still take storage space. You can clear the recycle bin by
using the reset recycle-bin command.
l
The dir /all command displays the files in
the recycle bin in square brackets.
l
If the configuration files are deleted, the
switch adopts the null configuration when it starts up next time.
Perform the following Flash memory operations
using commands listed in Table
1-4.
Perform the following configuration in user
view.
Table 1-4 Operations on the Flash memory
|
To do…
|
Use the command…
|
Remarks
|
|
Format the Flash memory
|
format device
|
Required
|
|
Restore space on the Flash memory
|
fixdisk device
|
Required
|
Caution:
The format operation leads to the loss of all files, including the
configuration files, on the Flash memory and is irretrievable.
You can set the prompt mode of the current
file system to alert or quiet. In alert mode, the file system
will give a prompt for confirmation if you execute a command which may cause
data loss, for example, deleting or overwriting a file. In quiet mode, such
prompt will not be displayed.
Table 1-5 Configuration
on prompt mode of file system
|
To do…
|
Use the command…
|
Remarks
|
|
Enter system view
|
system-view
|
—
|
|
Configure the prompt mode of the file
system
|
file prompt { alert | quiet }
|
Required
By default, the prompt mode of the file system
is alert.
|
# Display all the files in the root
directory of the file system.
<Sysname> dir /all
Directory of unit1>flash:/
1 (*) -rw- 3579326 Mar 28
2007 10:51:22 s3100.bin
2 (*) -rw- 1235 Apr 03
2000 16:04:52 config.cfg
3 -rwh 151 Apr 03
2000 16:04:55 private-data.txt
4 -rwh 716 Apr 04
2000 17:27:35 hostkey
5 -rwh 572 Apr 04
2000 17:27:41 serverkey
6 -rwh 548 Apr 04
2000 17:30:06 dsakey
7 drw- - Apr 04
2000 23:04:21 test
7239 KB total (3585 KB free)
(*) -with main attribute (b) -with
backup attribute
(*b) -with both main and backup
attribute
# Copy the file flash:/config.cfg to flash:/test/,
with 1.cfg as the name of the new file.
<Sysname> 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.
# Display the file information after the
copy operation.
<Sysname>
dir /all
Directory of unit1>flash:/
1 (*) -rw- 3579326 Mar 28
2007 10:51:22 s3100.bin
2 (*) -rw- 1235 Apr 03
2000 16:04:52 config.cfg
3 -rwh 151 Apr 03
2000 16:04:55 private-data.txt
4 -rwh 716 Apr 04
2000 17:27:35 hostkey
5 -rwh 572 Apr 04
2000 17:27:41 serverkey
6 -rwh 548 Apr 04
2000 17:30:06 dsakey
7 drw- - Apr 04
2000 23:04:21 test
7239 KB total (3585 KB free)
(*) -with main attribute (b) -with
backup attribute
(*b) -with both main and backup
attribute
<Sysname> dir
unit1>flash:/test/
Directory of unit1>flash:/test/
1 -rw- 1235 Apr 05
2000 01:51:34 test.cfg
2 -rw- 1235 Apr 05
2000 01:56:44 1.cfg
7239 KB total (3585 KB free)
(*) -with main attribute (b) -with
backup attribute
(*b) -with both main and backup
attribute
The following three startup files support
file attribute configuration:
l
App files: An app file is an executable file,
with .bin as the extension.
l
Configuration files: A configuration file is
used to store and restore configuration, with .cfg as the extension.
l
Web files: A Web file is used for Web-based
network management, with .web as the extension.
The app files, configuration files, and Web
files support three kinds of attributes: main, backup and none, as described in
Table 1-6.
Table 1-6 Descriptions on file
attributes
|
Attribute name
|
Description
|
Feature
|
Identifier
|
|
main
|
Identifies main startup files. The main
startup file is preferred for a switch to start up.
|
In the Flash memory, there can be only
one app file, one configuration file and one Web file with the main
attribute.
|
(*)
|
|
backup
|
Identifies backup startup files. The
backup startup file is used after a switch fails to start up using the main
startup file.
|
In the Flash memory, there can be only
one app file, one configuration file and one Web file with the backup
attribute.
|
(b)
|
|
none
|
Identifies files that are neither of main
attribute nor backup attribute.
|
—
|
None
|
A file can have
both the main and backup attributes. Files of this kind are labeled *b.
Note that, there can be only one app file,
one configuration file and one Web file with the main attribute in the Flash
memory. If a newly created file is configured to be with the main attribute,
the existing file with the main attribute in the Flash memory will lose its
main attribute. This circumstance also applies to the file with the backup
attribute in the Flash memory.
File operations and file attribute
operations are independent. For example, if you delete a file with the main
attribute from the Flash memory, the other files in the flash memory will not
possess the main attribute. If you download a valid file with the same name as
the deleted file to the flash memory, the file will possess the main attribute.
After the Boot ROM of a switch is upgraded,
the original default app file has the main attribute.
The device selects the main startup file as
the preferred startup file. If the device fails to boot with the main startup
file, it boots with the backup startup file.
For the Web file and configuration file, Hangzhou
H3C Technologies Co., Ltd (referred to as H3C hereinafter) may provide
corresponding default file when releasing software versions. When booting, the
device selects the startup files based on certain order. The device selects Web
files in the following steps:
1)
If the default Web file exists, the device will
boot with the default Web file;
2)
If the default Web file does not exist, but the
main Web file exists, the device will boot with the main Web file;
3)
If neither the default Web file nor the main Web
file exists, but the backup Web exists, the device will boot with the backup
Web file;
4)
If neither of the default Web file, main Web
file and backup Web exists, the device considers that no Web file exists.
For the selection of the configuration file
when the device boots, refer to the Configuration File Management part
in this manual.
You can configure and view the main
attribute or backup attribute of the startup file used for the next startup of
a switch, and change the main or backup attribute of the file.
Perform the configuration listed in Table 1-7 in
user view. The display commands can be executed in any view.
Table 1-7 Configure file attributes
|
To do…
|
Use the command…
|
Remarks
|
|
Configure the app file with the main
attribute for the next startup
|
boot boot-loader
file-url
|
Optional
|
|
Configure the app file with the backup
attribute for the next startup
|
boot boot-loader
backup-attribute file-url
|
Optional
|
|
Configure the Web file and its attribute
|
boot web-package
webfile { backup | main }
|
Optional
|
|
Switch the file attributes between main
and backup
|
boot attribute-switch
{ all | app | configuration | web }
|
Optional
|
|
Specify to enable user to use the
customized password to enter the BOOT menu
|
startup bootrom-access enable
|
Optional
By default, the user is enabled to use
the customized password to enter the BOOT menu.
|
|
Display
the information about the app file used as the startup file
|
display
boot-loader [ unit unit-id ]
|
Optional
Available
in any view
|
|
Display
information about the Web file used by the device
|
display
web package
|
Caution:
l
The configuration of the main or backup
attribute of a Web file takes effect immediately without restarting the switch.
l
After upgrading a Web file, you need to specify
the new Web file in the Boot menu after restarting the switch or specify a new
Web file by using the boot web-package command. Otherwise, Web server
cannot function normally.
l
Currently, a configuration file has the
extension of cfg and resides in the root directory of the Flash memory.
l
For the detailed configuration of configuration
file attributes, refer to the Configuration File Management module in
this manual.