01-Fundamentals Configuration Guide

HomeSupportConfigure & DeployConfiguration GuidesH3C S12500-X & S12500X-AF Switch Series Configuration Guides(R115x)-6W10201-Fundamentals Configuration Guide
05-File system management configuration
Title Size Download
05-File system management configuration 120.31 KB

Managing the file system

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

 

IMPORTANT

IMPORTANT:

·      Before managing storage media, files, and directories, make sure you know the possible impacts.

·      A file or directory whose name starts with a period (.) is considered a hidden file or directory. Do not give a common file or directory a name that starts with a period.

·      Some system files and directories are hidden.

 

Storage medium naming rules

The device supports the following types of storage media:

·          Flash memoryThe Flash is named flash.

·          USB diskThe USB disk can be partitioned, and the partitions are numbered. For example, the first partition is named usb0, and the second partition is named usb1.

File name formats

IMPORTANT

IMPORTANT:

Enter a storage medium name in lower case, including the chassis and slot strings (if any). Otherwise, the following error message is displayed: "The file or directory doesn't exist." Folder names and file names are case insensitive.

 

When you specify a file, enter the file name in one of the formats shown in Table 1 and Table 2. When you specify a directory, follow the rules for the drive and path arguments.

Table 1 File name formats in standalone mode

Format

Description

Example

file-name

Specifies a file in the current working directory.

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 (/).

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

·         test/subtest/a.cfg indicates a file named a.cfg in the subtest subfolder of the test folder in the current working directory.

drive:/[path]/file-name

Specifies a file in a specific storage medium.

The drive argument represents the storage medium name:

·         For a storage medium on the active MPU, it is flash or usb0.

·         For a storage medium on the standby MPU, it is slotn#flash or slotn#usb0. The n represents the slot number of the standby MPU.

To view MPUs' slot numbers, use the display device command.

flash:/test/a.cfg indicates a file named a.cfg in the test folder of the MPU's flash memory.

·         flash:/test/a.cfg indicates a file named a.cfg in the test folder of the active MPU's flash memory.

·         slot16#flash:/a.cfg indicates a file named a.cfg in the root directory of standby MPU's flash memory.

 

Table 2 File name formats in IRF mode

Format

Description

Example

file-name

Specifies a file in the current working directory.

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

This working directory might be on any MPU in the IRF fabric.

[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 (/).

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

·         test/subtest/a.cfg indicates a file named a.cfg in the subtest subfolder of 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:

·         For a storage medium on the global active MPU, it is flash or usb0.

·         For a storage medium on a global standby MPU, it is chassism#slotn#flash or chassism#slotn#usb0. The m represents the member ID of the subordinate device. The n represents the slot number of the MPU.

To view member devices' member IDs, use the display irf command.

·         flash:/test/a.cfg indicates a file named a.cfg in the test folder on the global active MPU's flash memory.

·         chassis2#slot0#flash:/a.cfg indicates a file named a.cfg in the root directory of the flash memory on a global standby MPU (in slot 0 of member device 2).

 

Managing files

CAUTION

CAUTION:

To avoid file system corruption, do not perform the following operations during file operations:

·      Installing or removing storage media.

·      Performing an active/standby switchover in standalone mode.

·      Performing a switchover between the global active MPU and a global standby MPU in IRF mode.

 

You can perform the following file management tasks:

·          Display directory and file information.

·          Display file contents.

·          Rename, copy, move, remove, restore, delete, compress, decompress, archive, and extract files.

·          Calculate the digests of files for file integrity verification.

You can create a file by copying, downloading, or using the save command. For more information about downloading a file, see "Configuring FTP" and "Configuring TFTP." For more information about the save command, see Fundamentals Command Reference.

Before you rename, compress, decompress, delete, restore, or move a file on a USB disk, or copy a file to a USB disk, make sure the disk is not write protected.

Displaying file information

Perform this task in user view.

 

Task

Command

Display folder or file information.

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

 

Displaying the contents of a text file

Perform this task in user view.

 

Task

Command

Display the contents of a text file.

more file-url

 

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

 

Compressing or decompressing a file

Perform the following tasks in user view:

 

Task

Command

Compress a file.

gzip filename

Decompress a file.

gunzip filename

 

Archiving or extracting files

Perform the following tasks in user view:

 

Task

Command

Archive files.

tar create [ gz ] archive-file fileurl-dest [ verbose ] source fileurl-source-list&<1-5>

Extract files.

tar extract archive-file fileurl-dest [ verbose ] [ screen | to directory-name ]

Display the names of archived files.

tar list archive-file fileurl-dest

 

Deleting or 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.

Files in the recycle bin occupy storage space. 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

 

IMPORTANT

IMPORTANT:

Do not use the delete command to delete files from the recycle bin. To delete files from the recycle bin, use the reset recycle-bin command.

 

Deleting files from the recycle bin

The device supports multiple storage media. Each storage medium has a recycle bin of its own.

The device supports multiple storage media. If a storage medium is not partitioned, it has a recycle bin of its own. If a storage medium is partitioned, each partition has its own recycle bin.

A recycle bin is a folder named .trash in the root directory of the storage medium or partition.

To view which files or directories are in a recycle bin, use either of the following methods:

·          Enter the storage medium or partition and execute the dir/all .trash command.

·          Execute the cd .trash command to enter the recycle bin folder, and then execute the dir command.

To delete files from a recycle bin, perform the following task in user view:

 

Task

Command

Delete files from the recycle bin.

reset recycle-bin [ /force ]

 

Calculating the digest of a file

File digests are used to verify 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.

·         To use the SHA-256 algorithm:
sha256sum file-url

·         To use the MD5 algorithm:
md5sum file-url

 

Managing directories

CAUTION

CAUTION:

To avoid file system corruption, do not perform the following operations during file operations:

·      Installing or removing storage media.

·      Performing an active/standby switchover in standalone mode.

·      Performing a switchover between the global active MPU and a global standby MPU in IRF mode.

 

You can perform the following directory management tasks:

·          Create or delete a directory.

·          Display or change the current working directory.

·          Display a specific directory.

Before you create or delete a directory on a USB disk, make sure the disk is not write protected.

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

 

Deleting a directory

To delete 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.

Deleting a directory permanently deletes all its files in the recycle bin, if any.

Perform this task in user view.

 

Task

Command

Delete a directory.

rmdir directory

 

Managing storage media

CAUTION

CAUTION:

To avoid file system corruption, do not perform the following operations while the system is repairing, formatting, partitioning, mounting, or unmounting a storage medium:

·      Installing or removing storage media or cards.

·      Performing an active/standby switchover in standalone mode.

·      Performing a switchover between the global active MPU and a global standby MPU in IRF mode.

 

If you remove a storage medium while a folder or file on the storage medium is being accessed, the device might not recognize the storage medium when you reinstall it. To reinstall this kind of a storage medium, complete one of the following tasks:

·          If you were accessing a folder on the storage medium, change the current directory.

·          If you were accessing a file on the storage medium, close the file.

·          If another administrator was accessing the storage medium, unmount all partitions on the storage medium.

Before you repair or format a USB disk, make sure the disk is not write protected.

Repairing a storage medium

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

Before repairing a storage medium, make sure no other users are accessing the medium. Otherwise, the repair operation fails.

Perform this task in user view.

 

Task

Command

Repair a storage medium.

fixdisk medium-name

 

Formatting a storage medium

CAUTION

CAUTION:

After a storage medium is formatted, all files and directories on it are erased and cannot be restored.

 

To format a storage medium that has been partitioned, you must format all the partitions individually, instead of formatting the medium as a whole. You can format a storage medium only when no one is accessing the medium.

Perform this task in user view.

 

Task

Command

Format a storage medium.

format medium-name

 

Mounting or unmounting a storage medium

Generally, a hot-swappable storage medium is automatically mounted when it is connected to the device. If the system cannot recognize the storage medium, however, you must mount the storage medium before you can access it.

To remove a hot-swappable storage medium from the device, you must first unmount it to disconnect it from the device. Otherwise, files on the storage medium or even the storage medium itself might be damaged.

Restrictions and guidelines

To mount/unmount a partitioned storage medium, you must mount/unmount all the partitions individually, instead of mounting/unmounting the medium as a whole. To unmount a USB disk, make sure the system has recognized the USB disk and the USB disk LED is not blinking. Otherwise, the USB interface or USB disk might be damaged.

Before unmounting a storage medium, make sure no other users are accessing the medium. Otherwise, the unmount operation fails.

Configuration procedure

Perform one of the following tasks in user view as appropriate:

 

Task

Command

Remarks

Mount a storage medium.

mount medium-name

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

Unmount a storage medium.

umount medium-name

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

 

Partitioning a USB disk

A USB disk can be divided into logical devices called "partitions." Operations on one partition do not affect the other partitions.

The following partitioning modes are available for USB disks:

·          Simple—Specify the number of partitions. The system divides the USB disk into the specified number of partitions with the same size.

·          InteractiveThe system partitions the USB disk according to user input. Each partition must be at least 32 MB.

Restrictions and guidelines

It is normal that the specified partition size and the actual partition size have an error less than 5% of the total memory.

Before partitioning a USB disk:

·          Back up the files in the storage medium. The partition operation clears all data in the medium.

·          If you are partitioning a USB disk, make sure the disk is not write protected. Otherwise, the partition operation will fail, and you must remount or reinstall the disk to restore access to the USB disk.

·          Make sure no other users are accessing the medium. Otherwise, the partition operation fails.

After partitioning a USB disk:

·          Reconfigure paths of application files to include the correct partition information.

·          To guarantee the startup system software image and configuration files sufficient storage space, set the path for log files to a partition other than the first partition. By default, the system automatically saves log files to the second partition. If the path does not exist, use the info-center logfile switch-directory command to change the path to avoid log loss. For more information about this command, see Network Management and Monitoring Command Reference.

Configuration procedure

Perform this task in user view.

 

Task

Command

Remarks

Partition a storage medium.

fdisk medium-name [ partition-number ]

By default, only one partition usb0:/ is available on a USB disk.

 

Setting the operation mode for files and folders

The device supports the following file and folder operation modes:

·          alert—The system prompts for confirmation when your operation might cause problems such as file corruption and data loss. This mode provides an opportunity to cancel a disruptive operation.

·          quiet—The system does not prompt for confirmation.

To set the operation mode for files and folders:

 

Step

Command

Remarks

1.       Enter system view.

system-view

N/A

2.       Set the operation mode for files and folders.

file prompt { alert | quiet }

The default mode is alert.

 

  • 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
新华三官网