How to erase the content of a hard drive so that it can be re-purposed

book

Article ID: 167854

calendar_today

Updated On:

Products

XOS

Issue/Introduction

Describes how to perform the task of erasing the content from a disk

Cause

In a case where one disk in a RAID setup fails,the next step is replacing the failed disk with a blank disk.

If a customer has spare disk which is not blank, it can be erased by removing partition table.

Resolution

There are multiple options to erase partitions. For the purpose of this article, we'll present one of them below.

# Warning: Make sure that correct disk is erased, otherwise data from the working one might be lost.

Disks are visible as following devices:

a) /dev/sda
b) /dev/sdb


Below example assumes that the /dev/sda disk is being erased.

1). Using the fdisk tool, run the following commands on the CPM:


# unix su
[[email protected] admin#] fdisk /dev/sda

The following information is displayed:

[[email protected] admin]# fdisk  /dev/sda

The number of cylinders for this disk is set to 12161.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help):


2). Select p to print existing partitions.

A sample result is shown below (might be different on your system):

Disk /dev/sda: 100.0 GB, 100030242816 bytes
255 heads, 63 sectors/track, 12161 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   fd  Linux raid autodetect
/dev/sda2              14       12161    97578810    5  Extended
/dev/sda5              14         138     1004031   fd  Linux raid autodetect
/dev/sda6             139         263     1004031   fd  Linux raid autodetect
/dev/sda7             264        1260     8008371   fd  Linux raid autodetect
/dev/sda8            1261        4746    28001263+  fd  Linux raid autodetect
/dev/sda9            4747        4759      104391   fd  Linux raid autodetect
/dev/sda10           4760        4884     1004031   fd  Linux raid autodetect
/dev/sda11           4885        5009     1004031   fd  Linux raid autodetect
/dev/sda12           5010        6006     8008371   fd  Linux raid autodetect
/dev/sda13           6007        9492    28001263+  fd  Linux raid autodetect


3). Use the "d" command to delete partition.

Command (m for help): d
Partition number (1-13): <number_taken_from sdaXX>


4). Repeat the command to delete the remaining partitions.

5). To verify that no partitions are visible on the disk, issue command "p" - print again.
Disk /dev/sda: 100.0 GB, 100030242816 bytes
255 heads, 63 sectors/track, 12161 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System


6). Use the "w" command to write changes to the disk.

7). Proceed with the RAID rebuilding procedure as described in the XOS Configuration Guide.