Clearing Data from a Storage Device
Scenarios
Use the Linux badblocks command to clear data on a storage device. Parameters are specified to overwrite data on the storage device.
The following describes how to clear the data on one HDD/SSD as an example. This operation is for reference only. You can also use other methods to clear data from storage media.
The cleared data cannot be restored. Exercise caution when performing this operation.
Procedure
Before performing this operation, check that:
- The storage device is not in a RAID array with redundancy, and the server operating system is running properly.
- You have obtained the server No. and the slot No. and location of the storage device to be cleared.
- You have accessed the desktop of the server where the target drive is located.
For details, see Using the Remote Virtual Console.
- Open the CLI.
- Query information about drive letters.
lsscsi
Figure 10-22 Querying drive letters - Query drive information.
fdisk -l
- The drive with the * symbol in the Boot column is the system drive. As shown in Figure 10-23, sda is the system drive.
- Do not directly clear system drive data. Before clearing system drive data, clear data from other storage media.
- Write all 0s to the drive to be cleared.
Command: badblocks -swft 0 Drive letter
Example: badblocks -swft 0 /dev/sdb
Figure 10-24 Clearing data (example)- The drive letters vary with the storage media (HDD, SSD, and USB flash drive). Ensure that the drive letter that you entered is correct.
- This operation takes time.
- If the command fails to execute, contact technical support.
- Remove the drive.
After the data is cleared, do not restart or reinstall the server. Otherwise, the system will reload data to the drives during the startup of the server.