01-Fundamentals Configuration Guide

HomeSupportConfigure & DeployConfiguration GuidesH3C Access Controllers Configuration Guides(E3703P61 R2509P61 R3709P61 R2609P61 R3509P61)-6W10201-Fundamentals Configuration Guide
04-File System Management Configuration
Title Size Download
04-File System Management Configuration 64.84 KB

Managing the file system

This chapter describes how to manage the device's file system, including the storage media, directories, and files.

Your device might have a Flash, a CF card, or both, depending on your device model. For more information, see About the H3C Access Controllers Configuration Guides.

File name formats

When you specify a file, enter the file name in one of the formats shown in Table 1. When you specify a directory, enter the directory in one of the formats that contains the path argument.

Table 1 File name formats

Format

Description

Length

Example

file-name

Specifies a file in the current working directory.

1 to 91 characters

a.cfg indicates a file named a.cfg in the current working directory.

path/file-name

Specifies a file in a specific folder in the current working directory.

The path argument represents the path to the file. If the file is in a single-level folder, specify the folder name for the argument. If the file is in a nested folder, separate each folder name by a forward slash (/).

1 to 135 characters

test/a.cfg indicates a file named a.cfg in the test folder in the current working directory.

drive:/[path]/file-name

Specifies a file in a specific storage medium on the device.

The drive argument represents the storage medium name, typically flash or cfa0.

If the device has only one storage medium, you do not need to specify the storage medium.

If the device has multiple storage media, you must provide the storage medium name.

1 to 135 characters

cfa0:/test/a.cfg indicates a file named a.cfg in the test folder in the root directory of the CF card.

 

Managing files

CAUTION

CAUTION:

To avoid file system corruption, do not install or remove storage media or perform active/standby switchover while the system is processing a file operation.

 

You can display directory and file information, display file contents, rename, copy, move, remove, restore, and delete files, and calculate file digests.

The copy operation enables you to create a file. You can also create a file by performing the download operation or using the save command.

Displaying file information

Perform this task in user view.

 

Task

Command

Display file or directory information.

dir [ /all ] [ file-url | /all-filesystems ]

 

Displaying the contents of a file

Perform this task in user view.

 

Task

Command

Remarks

Display the contents of a file.

more file-url [ | { begin | exclude | include } regular-expression ]

Only text files can be displayed.

 

Renaming a file

Perform this task in user view.

 

Task

Command

Rename a file.

rename fileurl-source fileurl-dest

 

Copying a file

Perform this task in user view.

 

Task

Command

Copy a file.

copy fileurl-source fileurl-dest

 

Moving a file

Perform this task in user view.

 

Task

Command

Move a file.

move fileurl-source fileurl-dest

 

Deleting/restoring a file

You can delete a file permanently or move it to the recycle bin. A file moved to the recycle bin can be restored, but a permanently deleted file cannot.

A file in the recycle bin occupies storage space. To release the occupied space, execute the reset recycle-bin command in the directory that holds the file. To save storage space, periodically empty the recycle bin with the reset recycle-bin command.

Perform the following tasks in user view:

 

Task

Command

Delete a file by moving it to the recycle bin.

delete file-url

Restore a file from the recycle bin.

undelete file-url

Delete a file permanently.

delete /unreserved file-url

 

Emptying the recycle bin

Step

Command

Remarks

1.       Enter the original working directory of the file to be deleted in user view.

cd { directory | .. | / }

Skip this step if the original directory of the file is the current working directory.

2.       Empty the recycle bin.

reset recycle-bin [ /force ]

N/A

 

Calculating the digest of a file

The digest of a file can be used to verify the file integrity. For example, you can calculate the digest of a software image file and compare it with that provided on the H3C website to verify whether the file has been tampered with.

Perform this task in user view.

 

Task

Command

Calculate the digest of a file.

crypto-digest sha256 file-url

 

Managing directories

You can create or remove a directory, display or change the current working directory, and display a specific directory.

Displaying directory information

Perform this task in user view.

 

Task

Command

Display directory or file information.

dir [ /all ] [ file-url | /all-filesystems ]

 

Displaying the current working directory

Perform this task in user view.

 

Task

Command

Display the current working directory.

pwd

 

Changing the current working directory

Perform this task in user view.

 

Task

Command

Change the current working directory.

cd { directory | .. | / }

 

Creating a directory

Perform this task in user view.

 

Task

Command

Create a directory.

mkdir directory

 

Removing a directory

To remove a directory, you must delete all files and subdirectories in this directory. To delete a file, use the delete command. To delete a subdirectory, use the rmdir command.

Removing a directory permanently deletes all its files in the recycle bin.

Perform this task in user view.

 

Task

Command

Remove a directory.

rmdir directory

 

Managing storage media

CAUTION:

After a storage medium is formatted, all files on it are erased and cannot be restored. If a startup configuration file exists on the storage medium, formatting the storage medium results in loss of the startup configuration file.

 

If part of a storage medium is inaccessible, use the fixdisk command to examine the medium for any damage and repair the medium.

To manage the space of a storage medium, perform one of the following tasks in user view:

 

Task

Command

Remarks

Repair a storage medium.

fixdisk device

N/A

Format a storage medium.

format device [ FAT16 | FAT32 ]

FAT16 and FAT32 are not applicable to the Flash memory.

 

Performing batch operations

A batch file comprises a set of executable commands. Executing a batch file is the same as executing the commands one by one. However, execution of a batch file does not guarantee successful execution of every command in the batch file. If a command has error settings or the conditions for executing the command are not met, the system skips this command.

You can edit a batch file on your PC, and then upload or download it to the device. If the extension of the file is not .bat, use the rename command to change it to .bat.

To execute a batch file:

 

Step

Command

1.       Enter system view.

system-view

2.       Execute a batch file.

execute filename

 

Setting the file system operation mode

The file systems support the following operation modes:

·          alert—The system warns you about operations that might cause problems such as file corruption and data loss. To avoid problems, use the alert mode.

·          quiet—The system does not prompt for any operation confirmation.

To set the file system operation mode:

 

Step

Command

Remarks

1.       Enter system view.

system-view

N/A

2.       Set the file system operation mode.

file prompt { alert | quiet }

Optional.

The default is alert.

 

File system management examples

# Display the files and the subdirectories in the current directory.

<Sysname> dir

Directory of cfa0:/

   0     -rw-  20669704  Jan 12 2011 15:17:24   wx5004.bin

   1     drw-         -  May 17 2010 11:11:32   logfile

   2     -rw-     10329  May 18 2010 08:01:54   command.txt

   3     -rw-      1433  Jan 27 2011 14:49:12   startup.cfg

   4     -rw-      2686  Jan 27 2011 14:53:06   system.xml

   5     drw-         -  Jan 21 2011 14:11:52   test

252904 KB total (232676 KB free)

File system type of cfa0: FAT32

# Create new folder mytest in the test directory.

<Sysname> cd test

<Sysname> mkdir mytest

%Created dir cfa0:/test/mytest.

# Display the current working directory.

<Sysname> pwd

cfa0:/test

# Display the files and the subdirectories in the test directory.

<Sysname> dir

Directory of cfa0:/test/

   0     drw-         -  Jan 27 2011 16:16:24   mytest

252904 KB total (232672 KB free)

File system type of cfa0: FAT32

# Return to the upper directory.

<Sysname> cd ..

# Display the current working directory.

<Sysname> pwd

cfa0:

 

  • Cloud & AI
  • InterConnect
  • Intelligent Computing
  • Security
  • SMB Products
  • Intelligent Terminal Products
  • Product Support Services
  • Technical Service Solutions
All Services
  • Resource Center
  • Policy
  • Online Help
All Support
  • Become a Partner
  • Partner Resources
  • Partner Business Management
All Partners
  • Profile
  • News & Events
  • Online Exhibition Center
  • Contact Us
All About Us
新华三官网