Erasing Data from an HDD or SSD by Running the badblocks Command
The following describes how to clear data on an HDD or SSD as an example.
Step 1 Log in to the server holding the drive to be erased.
For details, see 9.4 Logging In to the Server Using the Independent Remote
Console .
Step 2 Open the CLI and run the lsscsi command to query drive letters. Figure 9-14
shows an example.
Figure 9-14 Querying drive letters
Step 3 Run the fdisk -l command to query drive information. As shown in Figure 9-15,
the drive with the * symbol in the Boot column is a system drive, and sda is the
drive letter.
Do not directly erase system drive data. Before erasing system drive data, erase data from
other storage media.
Figure 9-15 Querying drive information
Step 4 Run the badblocks -swft 0 command to write 0s to the drive to be cleared. For
example, if the drive to be cleared is HD1 and its drive letter is /dev/sdb, run the
badblocks -swft 0 /dev/sdb command to clear the data on HD1, as shown in
Figure 9-16.
Figure 9-16 Erasing data
RH2288H V3 Server
User Guide 9 Common Operations
Issue 46 (2022-12-28) Copyright © Huawei Technologies Co., Ltd. 320