I have a laptop which raid has installed on it, and I have two devices sda & sdb for my storage unit and its raid, I want to completely format both the discs. I have come up with the following command to format both discs.

dd if=/dev/zero of=/dev/sda bs=1M
dd if=/dev/zero of=/dev/sdb bs=1M

Are these command sufficent enough to format both discs or not?

  • 2
    Do you want to format as in create a filesystem so that your disks are ready for use (as the explanation says), or do you want to wipe the disks clean which may remove the raid configuration as well, depending on how raid is set up (which is what the example does)? So you'll have to clarify (1) format for use, or wipe clean? and (2) if you want to format for use, what type of RAID do you use? Is it hardware RAID or software RAID (in which case you'd need to use mdadm at some point)? – Mr. Donutz Jan 13 at 8:52

RAID: software VS hardware

You didn't wrote which kind of RAID you are using. There's two main categories:

  • Hardware RAID: the RAID stuff is managed by your hard drive controller and the devices shown in your Linux are an abstract of your array. Usually, there's a firmware accessible during the boot to configure the array (RAID 0, 1, etc...). The devices may be named /dev/sdX or something else more exotic like, for example with HP SmartArray controller, /dev/ccissX.

  • Software RAID: the RAID stuff is totally managed by your operating system. You have, to setup the array on operating system side, usually during the install process or later using mdadm. Usually, software RAID create devices under /dev/mdXX. Your single drives are still visible under /dev/sdX but must not be accessed directly.

Formatting under Linux

The command you typed (dd if=/dev/zero [...]) has nothing to deal with formatting. With these commands, you simply zero-ed your disks which is totally useless unless you want to remove any vestige of the data previously stored on it.

To format, you must use of one the /sbin/mkfs.XXXX where XXXX is the filesystem you want to use. For example /sbin/mkfs.ext4 /dev/sda1 will format partition 1 of the first drive with Ext4 filesystem.

  • I think It's a hardware raid because the device is named as /dev/sdb & by formating I meant the setting disk to zero bits. So by these conditions, am I doing alright? – dariush Jan 14 at 7:08
  • You should better be 100% sure ;-) Did you configured your array using firmware of the controller during boot of the system ? Yeah, if your goal is to zero the device, you're doing it right. – binarym Jan 14 at 8:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.