• No results found

Managing Files

In document Huawei-S2300-Configuration-Guide (Page 83-94)

You can view, create, delete, and rename files.

6.1 Overview of the File System

This section describes the concepts of the file system.

Basic Concepts of the File System

A file system allows you to manage files and directories on the storage devices. In the file system, you can create, delete, modify, and rename a file or a directory, and view contents of a file.

The file system provides the following functions:

l Managing the files that are stored on the storage devices l Managing the storage devices

Storage Device

A storage device is a hardware device used to store data.

Different products support different storage devices. Currently, the S2300 supports the flash memory.

File

A file stores and manages information.

Directory

A directory collects and organizes files. It is a logical container of files.

6.2 Managing a Storage Device

This section describes how to format a storage device.

6.2.1 Establishing the Configuration Task

Pre-configuration Tasks

Before managing a storage device, complete the following tasks:

l Installing the S2300 and switching it on properly l Client logging in to the S2300

Data Preparation

To manage a storage device, you need the following data.

No. Data

1 Device name

6.2.2 Restoring Storage Devices with File System Troubles

When the file system on a storage device fails, the terminal of the switch prompts you to rectify the fault.

Context

Do as follows on the switch:

Procedure

Step 1 Run:

fixdisk device-name

The storage devices with file system troubles is repaired.

NOTE

After this command is run, if the prompt that the system should be repaired is still received, it indicates that the physical medium may be damaged.

----End

6.2.3 (Optional) Formatting a Storage Device

Context

CAUTION

After the format flash: command is run, the files and directories in the Flash are cleared and cannot be restored. So, confirm the action before you use the command.

Procedure

Step 1 Run the following command in the user view:

format flash:

The flash is formatted.

----End

6.3 Managing the Directory

You can manage directories to logically store files in hierarchy.

6.3.1 Establishing the Configuration Task

Before managing directories, familiarize yourself with the applicable environment, complete the pre-configuration tasks, and obtain the required data. This can help you complete the configuration task quickly and accurately.

Applicable Environment

When you need to transfer files between the client and the server, configure the directory by using the file system.

Pre-configuration Tasks

Before configuring the management directory, complete the following tasks:

l Powering on the switch

l Connecting the client with the server correctly

Data Preparation

To configure a management directory, you need the following data.

No. Data

1 Directory name to be created 2 Directory name to be deleted

6.3.2 Viewing the Current Directory

You can view the current directory to know its information.

Context

Do as follows on the switch.

Procedure

Step 1 Run:

pwd

The current directory is displayed.

----End

6.3.3 Switching a Directory

You can switch the current directory to another directory.

Context

Do as follows on the switch:

Procedure

Step 1 Run:

cd directory

A directory is specified.

Step 2 Run:

pwd

The current directory is displayed.

----End

6.3.4 Displaying a Directory or File

You can view a directory or files in the directory.

Context

Do as follows on the switch:

Procedure

Step 1 Run:

cd directory

A directory is specified and the specified directory is displayed.

Step 2 Run:

dir [ /all ] [ filename | flash: ]

The file and sub-directory list in the directory is displayed.

Either the absolute path or relative path is applicable.

----End

6.3.5 Creating a Directory

You can create a directory in the specified directory on a specified storage device.

Context

Do as follows on the switch:

Procedure

Step 1 Run:

cd directory

The parent directory of the directory to be created is displayed.

Step 2 Run:

mkdir directory

The directory is created.

----End

6.3.6 Deleting a Directory

You can delete an unneeded directory.

Context

Do as follows on the switch:

Procedure

Step 1 Run:

cd directory

The parent directory of the directory to be deleted is displayed.

Step 2 Run:

rmdir directory

The directory is deleted.

----End

6.4 Managing Files

You can view, create, delete, and rename files.

6.4.1 Establishing the Configuration Task

Before managing files, familiarize yourself with the applicable environment, complete the pre-configuration tasks, and obtain the required data. This can help you complete the pre-configuration task quickly and accurately.

Applicable Environment

To view, delete, or rename files on the switch, you need to configure files using the file system.

Pre-configuration Tasks

Before configuring the file system, complete the following tasks:

l Powering on the switch

l Connecting the client with the server correctly

Data Preparation

To configure a file system, you need the following data.

No. Data

1 File name to be viewed 2 File name to be deleted 3 File name to be renamed

6.4.2 Displaying Contents of Files

You can view the contents of a file, which are displayed in texts.

Context

Do as follows on the switch:

Procedure

Step 1 Run:

cd directory

The directory of the file is displayed.

Step 2 Run:

more filename

The content of the file is displayed.

----End

6.4.3 Copying Files

You can copy files.

Context

Do as follows on the switch:

Procedure

Step 1 Run:

cd directory

The directory of the file is displayed.

Step 2 Run:

copy source-filename destination-filename

The file is copied.

NOTE

The file to be copied must be larger than 0 bytes. Otherwise, the operation fails.

----End

6.4.4 Moving Files

You can move files to a specified directory.

Context

Do as follows on the switch:

Procedure

Step 1 Run:

cd directory

The directory of the file is displayed.

Step 2 Run:

move source-filename destination-filename

The file is moved.

----End

6.4.5 Renaming Files

You can rename files.

Context

Do as follows on the switch:

Procedure

Step 1 Run:

cd directory

The directory of the file is displayed.

Step 2 Run:

rename source-filename destination-filename

The file is renamed.

----End

6.4.6 Compressing Files

You can compress files to reduce the size of the files.

Context

Do as follows on the switch.

Procedure

Step 1 Run:

zip source-filename destination-filename

The file is compressed.

----End

6.4.7 Deleting Files

You can delete unneeded files.

Context

Do as follows on the switch:

Procedure

Step 1 Run:

cd directory

The directory of the file is displayed.

Step 2 Run:

delete [ /unreserved ] filename

The file is deleted.

----End

6.4.8 Deleting Files in the Recycle Bin

You can permanently delete files in the recycle bin.

Context

Do as follows on the switch:

Procedure

Step 1 Run:

reset recycle-bin [ filename ]

The file is deleted.

----End

6.4.9 Undeleting Files

You can undelete files.

Context

Do as follows on the switch:

Procedure

Step 1 Run:

undelete filename

The deleted file is recovered.

NOTE

l If the current directory is not the parent directory, you must operate the file by using the absolute path.

l If you use the parameter [ /unreserved ] in the delete command, the file cannot be restored after being deleted.

----End

6.4.10 Running Files in Batch

You can upload the files and then process the files in batches.

Prerequisite

Uploading the batched files on the client end to the switch.

Context

When the batch file is created, you can run the batch file to implement routine tasks automatically.

Procedure

Step 1 Run:

system-view

The system view is displayed.

Step 2 Run:

execute filename

The batched file is executed.

----End

6.4.11 Configuring Prompt Modes

The system displays prompts or warning messages when you operate the device. If you need to change the prompt mode for file operations, you can configure the prompt mode of the file system.

Prerequisite

Before configuring a file system, complete the following tasks:

l Powering on the switch

l Logging in to the switchfrom the client end

Context

The data may be lost or damaged during the process, and the prompt is required.

Procedure

Step 1 Run:

system-view

The system view is displayed.

Step 2 Run:

file prompt { alert | quiet }

The prompt mode of the file system is configured.

By default, the prompt mode is alert.

CAUTION

If the prompt is in the quiet mode, no prompt appears for data lossdue to maloperation.

----End

7 Management of Configuration Files

About This Chapter

This chapter describes current configurations, configuration files, detection of master/slave configuration consistency, and configuration recovery.

In document Huawei-S2300-Configuration-Guide (Page 83-94)