Find the answer to your Linux question:
Results 1 to 4 of 4
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 ...
  1. #1
    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

  2. #2
    Linux Guru
    Join Date
    Nov 2004
    Posts
    6,110
    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.

  3. #3
    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

  4. #4
    Linux Engineer
    Join Date
    Nov 2004
    Location
    Ft. Polk, LA
    Posts
    796
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...