01-Fundamentals Configuration Guide

HomeSupportSwitchesH3C S9500E Switch SeriesConfigure & DeployConfiguration GuidesH3C S9500E Configuration Guide-Release1728-6W17001-Fundamentals Configuration Guide
04-File System Management
Title Size Download
04-File System Management 116.22 KB

Managing the file system

 

 

NOTE:

Throughout this document, a filename can be entered as either of the following:

·       A fully qualified filename with a path included to indicate a file under a specific path. The filename can be 1 to 135 characters in length.

·       A short filename with no path to indicate a file in the current path. The filename can be 1 to 91 characters in length.

 

File system overview

Files that are necessary for the operation of the switch, such as host software and configuration files, are saved in the storage media of the switch. You can manage the storage media and the files saved on the media, and organize the files under different directories for easy management.

Naming rules for a storage medium

The following rules apply when naming a storage medium:

·           If there is only one storage medium of the same type on the switch, the physical device name of the storage medium is the name of the storage medium type, for example, flash.

·           If there are multiple storage media of the same type on the switch, the physical device name of a storage medium on the active main board (AMB) is the medium type name (for example, flash or cfa0), and the physical device name of a storage medium on the standby main board (SMB) comprises the slot number and the medium type (for example, slot1#flash or slot1#cfa0). If the switch is working in IRF mode, the physical device name of any other storage medium comprises the chassis number, slot number, and the medium type (for example, chassis1#slot1#flash or chassis1#slot1#cfa0).

·           If a storage medium is partitioned, the name of a partition comprises the physical device name and the partition number. The sequence numbers of partitions are displayed in numbers such as 0, 1 and 2, for example cfa0.

Filename 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. If the current working directory is on the AMB, a.cfg represents file a.cfg on the AMB; if the current working directory is on the SMB, a.cfg represents file a.cfg on the SMB.

path/file-name

Specifies a file in the specified folder in the current working directory. path represents the folder name. You can specify multiple folders, indicating a file under a multi-level folder.

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 (standalone mode)

Specifies a file in the specified storage medium on the switch. drive represents the storage medium name. The storage medium on the AMB is usually flash or cf; the storage medium on the SMB is usually slotX#flash or slotX#cf, where X represents the number of the slot where the SMB resides. For example, slot1#flash. You can use the display device command to view the correspondence between a board and its slot number.

1 to 135 characters

flash:/test/a.cfg indicates a file named a.cfg in the test folder under the root directory of the flash memory on the AMB.

To read and write the a.cfg file under the root directory of the flash on the SMB (with the slot number 1), enter slot1#flash:/a.cfg for the filename.

drive:/[path]/file-name (IRF mode)

Specifies a file in the specified storage medium on the switch. drive represents the storage medium name. The storage medium on the AMB of the master is usually flash or cf; the storage medium on a slave is usually chassisX#slotY#flash or chassisX#slotY#cf, where X represents the member ID of the slave and Y represents the number of the slot where the main board of the slave resides. You can use the display device command to view the correspondence between a switch and its member ID.

1 to 135 characters

flash:/test/a.cfg indicates a file named a.cfg in the test folder under the root directory of the flash memory on the AMB of the IRF.

To read and write the a.cfg file under the root directory of the flash on an SMB of the IRF (the member ID and slot number of the SMB are 1 and 0 respectively), enter chassis1#slot0#flash:/a.cfg for the filename.

 

Managing files

You can display the specified directory or file information; display file contents; rename, copy, move, remove, restore, and delete files.

 

 

NOTE:

You can create a file by copying, downloading or using the save command.

 

Displaying file information

 

Task

Command

Remarks

Display file or directory information.

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

Available in user view

 

Displaying the contents of a file

 

Task

Command

Remarks

Display the contents of a file.

more file-url

Only a .txt file can be displayed.

Available in user view

 

Renaming a file

 

Task

Command

Remarks

Rename a file.

rename fileurl-source fileurl-dest

Available in user view

 

Copying a file

 

Task

Command

Remarks

Copy a file.

copy fileurl-source fileurl-dest

Available in user view

 

Moving a file

 

Task

Command

Remarks

Move a file.

move fileurl-source fileurl-dest

Available in user view

 

Deleting a file

 

Task

Command

Remarks

Move a file to the recycle bin or delete it permanently.

delete [ /unreserved ] file-url

Available in user view

 

CAUTION

CAUTION:

·       The files in the recycle bin still occupy storage space. To delete a file in the recycle bin, you need to execute the reset recycle-bin command in the directory to which the file originally belonged. It is recommended to empty the recycle bin timely with the reset recycle-bin command to save storage space.

·       The delete /unreserved file-url command deletes a file permanently and the action cannot be undone. Execution of this command equals execution of the delete file-url command and the reset recycle-bin command in the same directory.

 

Restoring a file from the recycle bin

 

Task

Command

Remarks

Restore a file from the recycle bin.

undelete file-url

Available in user view

 

Emptying the recycle bin

 

Step

Command

Remarks

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

cd { directory | .. | / }

Optional

If the original directory of the file to be deleted is not the current working directory, this command is required.

Available in user view

2.     Empty the recycle bin.

reset recycle-bin [ /force ]

Available in user view

 

Managing directories

You can create or remove a directory, and display the current working directory, the specified directory, and file information.

Displaying directory information

 

Task

Command

Remarks

Display directory or file information.

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

Available in user view

 

Displaying the current working directory

 

Task

Command

Remarks

Display the current working directory.

pwd

Available in user view

 

Changing the current working directory

 

Task

Command

Remarks

Change the current working directory.

cd { directory | .. | / }

Available in user view

 

Creating a directory

 

Task

Command

Remarks

Create a directory.

mkdir directory

Available in user view

 

Removing a directory

 

Task

Command

Remarks

Remove a directory.

rmdir directory

Available in user view

 

 

NOTE:

·       Before you remove a directory, you must delete all the files and the subdirectory in this directory. To delete a file, see the delete command; to delete a subdirectory, see the rmdir command.

·       The rmdir command automatically deletes the files in the recycle bin in the current directory.

 

Managing storage media

Managing the space of a storage medium

When the space of a storage medium becomes inaccessible, you can use the fixdisk command to restore the space of the storage medium. The format command formats the storage medium, and all the data on the storage medium is deleted.

To manage the space of a storage medium:

 

Task

Command

Remarks

Restore the space of a storage medium.

fixdisk device

Available in user view

Format a storage medium.

format device [ FAT16 | FAT32 ]

FAT16 and FAT32 are not applicable to a flash card.

Available in user view

 

CAUTION

CAUTION:

·       When you format a storage medium, all the files stored on it are erased and cannot be restored. In particular, if there is a startup configuration file on the storage medium, formatting the storage medium results in loss of the startup configuration file.

·       To format a storage medium that has been partitioned, format each partition of the storage medium. For example, to format a CF card that has been partitioned, you need to format each partition, instead of formatting the CF card.

 

Mounting/unmounting a storage medium

For a hot swappable storage medium (excluding flash), such as a CF card, you can use the mount and umount command to mount or unmount it.

·           By default, a storage medium is automatically mounted when connected to the device. However, when a storage medium is connected to a lower version system, the system cannot recognize the storage medium. To perform read and write operations to the storage medium, you must mount it.

·           An unmounted device is in the disconnected state, and can be removed safely. If you unplug a storage medium without unmounting it, files on the storage medium or even the storage medium may be damaged.

·           An unmounted storage medium can be used only when it is mounted again.

To mount or unmount a storage medium:

 

Task

Command

Remarks

Mount a storage medium.

mount device

By default, a storage medium is automatically mounted and in mounted state when connected to the system.

Unmount a storage medium.

umount device

By default, a storage medium is automatically mounted and in mounted state when connected to the system.

 

CAUTION

CAUTION:

·       When mounting or unmounting a storage medium, or performing file operations on it, do not unplug or switchover the storage medium or the card where the storage medium resides. Otherwise, the file system could be damaged.

·       For a storage medium that has been partitioned, you can only mount/unmount a partition rather than the storage medium.

·       To mount/unmount a storage medium, mount/unmount each partition of the storage medium. For example, to mount a CF card that has been partitioned, you need to mount each partition, instead of mounting the CF card.

·       For a USB disk inserted into the USB interface, you must not unplug it before the system recognizes it. Otherwise, the USB interface or the USB disk may work abnormally. To unplug a USB disk, make sure that the system has recognized it and the USB disk LED does not blink, use the umount command to unmount it, and then unplug it.

 

Partitioning a storage medium

A storage medium can be divided into several different logical devices called partitions. You can perform file operations on each partition respectively, thus preventing the interference of files between partitions.

 

 

NOTE:

Only the CF card and USB disk can be partitioned.

 

The following two partitioning modes are supported on a storage medium:

·           Simple: Specify the number of partitions. The system divides the storage medium into the specified number of partitions with the same size.

·           Interactive: The system partitions the storage medium according to user input. Each partition must be 32 MB at least.

To partition a storage medium:

 

Task

Command

Remarks

Partition a storage medium.

fdisk device [ partition-number ]

By default, a CF card has two partitions, cfa0:/ and cfa1:/.

Available in user view

 

CAUTION

CAUTION:

·       The fdisk device [ partition-number ] command clears all data in a storage medium. Save the files in the storage medium before partitioning it.

·       The fdisk device [ partition-number ] command adds or reduces partitions. You should reconfigure the paths of the application files as needed.

·       If the switch starts up from a CF card, the startup file and the configuration file must be in the first partition of the CF card.

·       To prevent a log file from affecting the startup file and configuration file, set the path of the log file to a partition other than the first partition if you have partitioned the CF card or a USB disk. By default, the system automatically sets the path of the log file to the second partition. If the path does not exist on the CF card or a USB disk, you can use the info-center logfile switch-directory command to change the path to avoid loss of the log file. For more information about this command, see Information center commands in the Network Management and Monitoring Command Reference.

·       After partitioning is completed, the sizes of the partitions may not be consistent with those specified during configuration. The error is smaller than 5% of the total memory of the storage medium.

·       Before removing a partitioned storage medium, unmount all the partitions of the storage medium. Otherwise, the file system on the storage medium may be damaged.

·       Before partitioning a USB disk, make sure that the disk is not write protected; otherwise, the partition operation fails, and you need to remount or re-plug the disk to restore normal access to the USB disk.

 

Performing batch operations

A batch file consists of a set of executable commands. Executing a batch file equals executing the commands in the batch file one by one.

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

To execute a batch file:

 

Step

Command

1.     Enter system view.

system-view

2.     Execute a batch file.

execute filename

 

CAUTION

CAUTION:

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 satisfied, the command fails, and the system skips to the next one.

 

Setting prompt modes

The system provides the following two prompt modes:

·           alert—The system warns you about operations that may bring undesirable consequences such as file corruption or data loss.

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

To prevent undesirable consequence resulting from misoperation, the alert mode is preferred.

To set the operation prompt mode of the file system:

 

Step

Command

Remarks

1.     Enter system view.

system-view

N/A

2.     Set the operation prompt mode of the file system.

file prompt { alert | quiet }

Optional

The default is alert.

 

File and directory management examples

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

<Sysname> dir

Directory of flash:/

 

   0   drw-         -  Feb 16 2006 11:45:36   logfile

   1   -rw-      1218  Feb 16 2006 11:46:19   config.cfg

   2   drw-         -  Feb 16 2006 15:20:27   test

   3   -rw-    184108  Feb 16 2006 15:30:20   aaa.bin

 

129794 KB total (112775 KB free)

# Create a new folder called mytest in the test directory.

<Sysname> cd test

<Sysname> mkdir mytest

%Created dir flash:/test/mytest.

# Display the current working directory.

<Sysname> pwd

flash:/test

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

<Sysname> dir

Directory of flash:/test/

 

   0   drw-         -  Feb 16 2006 15:28:14   mytest

 

2540 KB total (2519 KB free)

# Return to the upper directory.

<Sysname> cd ..

# Display the current working directory.

<Sysname> pwd

flash:

  • 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 Policy & Program
  • Global Learning
  • Partner Sales Resources
  • Partner Business Management
  • Service Business
All Partners
  • Profile
  • News & Events
  • Online Exhibition Center
  • Contact Us
All About Us
新华三官网