Welcome to Linux Forums!

With a comprehensive Linux Forum, information on various types of Linux software and many Linux Reviews articles, we have all the knowledge you need a click away, or accessible via our knowledgeable members.

Linux Forum ArticlesLinux ForumsLinux Forum DownloadsLinux Hosts
Home|Register|FAQ|Member List|Calendar|Unanswered Posts|Forum Rules|Today's Posts|Advanced Search|
SEARCH FOR IN
Go Back   Linux Forums > GNU Linux Zone > Linux Programming & Scripting
Reload this Page How do I initialise HDD using shell script?
Linux Forums
Linux Forums
Welcome To The Linux Forums!
Welcome to Linux Forums. We pride ourselves in being one of the largest Linux communities on the web, we encourage you to REGISTER on our forums and participate in the community. There are over 150,000 members ready to answer your questions. JOINING US today will allow you to make new posts, get support, send messages to other members and submit downloads to our downloads directory and many other great features!

Linux Programming & Scripting C, Perl, PHP, Bash Scripts, anything programming or script related post in here!

Reply
 
Thread Tools Display Modes
Old 05-14-2008   #1 (permalink)
meibabe
Just Joined!
 
Join Date: May 2008
Posts: 2
How do I initialise HDD using shell script?

Hi Im new to Linux. I need to initialise 100 units of machines HDD by clearing the partition. Meaning make the HDD raw without formatting it.
I need help in getting a full script to make this work.
I was told to use

fdisk /dev/XXX <<.
o
w

or dd if=/dev/zero of=/dev/devicetoearse bs=512 count=1

but I'm not sure how to go about creating the whole script.
Any help is appreciated.
Thanks
mei
meibabe is offline   Reply With Quote
Old 05-14-2008   #2 (permalink)
bigtomrodney
Bigtomrodinator
 
bigtomrodney's Avatar
 
Join Date: Nov 2004
Location: Sunny South-East of Ireland
Posts: 4,927
You're on the right track with dd, but that will only remove the partition table...the data is still on the disk as you are overwriting the first 512 bytes of the disk which is only the MBR. If you want to blank the whole disk remove the bs and count options.

If you are supposed to be wiping the machines to get rid of sensitive data I would suggest having a look at DBAN

Darik's Boot and Nuke (Hard Drive Disk Wipe)

It overwrites the data in multiple passes so that it can never retrieve. It exceeds US government requirements for disk cleansing and is really excellent.
bigtomrodney is online now   Reply With Quote
Old 05-14-2008   #3 (permalink)
meibabe
Just Joined!
 
Join Date: May 2008
Posts: 2
do I need to tell the script which HDD after the command
dd if=/dev/zero of=/dev/devicetoearse ?
thanks
gail
meibabe is offline   Reply With Quote
Old 05-14-2008   #4 (permalink)
valan
Linux Engineer
 
Join Date: Nov 2004
Posts: 785
Yes, that's it, the if option says where to get the stuff from, in this case it's /dev/zero which will output a continuous stream of zeros. The of option specifies where to write the stream to, such as /dev/sda.
valan is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


All times are GMT. The time now is 08:04 PM.

Powered by vBulletin 3.6.8 ©2000 - 2007, content relevant URLs by vBSEO, Property of Core Root.

Content Relevant URLs by vBSEO 3.0.0