Advice for automaticaly running mke2fs
Results 1 to 9 of 9

Thread: Advice for automaticaly running mke2fs

  1. #1
    Member
    Join Date
    Sep 2006
    Location
    At a keyboard
    Posts
    82

    Advice for automaticaly running mke2fs

    I've a nifty little task at work. Got about 2500 hard drives, of various types and sizes, that need to be repartitioned and formatted to ext3. Im setting up 6 whiteboxes on a rack with kvm to do this. What I want to do is create a boot CD to run a script that will wipe the partition table then format the drive and pipe the results to a file that is displayed when the task is completed. I keep running into snags and script crashes when I attempt this. The drives that fail to format are going to be manually inspected and RMA'ed if necessary.

    Anyone have any advice, tips, perhaps a distro out there that I am yet to find? Believe me, I've googled this to death every thing I have found requires user interaction which defeats the purpose, I could format them manually like I have been just as quick.
    "I have died, I will die, It's alright, I don't mind"

  2. #2
    Senior Member
    Join Date
    Oct 2003
    Location
    MA
    Posts
    1,053
    I think your best bet would be to use a ghost image. Norton Ghost corporate supports command lines so you can boot off a cd and automatically write an image to a disk. The biggest problem you face is the amount of interfaces to connect to a host at one time. In that you are limited.

  3. #3
    Senior Member IKnowNot's Avatar
    Join Date
    Jan 2003
    Posts
    792
    OK, I've been watching this thread for responses, but there's been only one since originally posted. Maybe I can spark some further conversation, if you have not already solved your problem?


    oofki has an interesting idea, one that I was pondering, but I have two thoughts about that:

    First, although the program mentioned states it will ghost an ext3 file system, has anyone used it successfully? I know there were problem for years with ext2 then ext3. I haven't used any of the newer versions. ( although, since no files will actually be copied, maybe the past restrictions won't apply? )
    If this were the only obstacle maybe G4l or G4U ?

    Second,
    ... of various types and sizes ...
    How many ghost images would be required?


    Now, back to it.
    The very first thing that came to my mind when reading this thread was why?
    Why are there 2500 drives?
    Why do they need to be formated to ext3?
    More importantly, do the drives have to be wiped? ( Is or was there data on the drives that is required to be scrubbed clean so it is totally unrecoverable by any moral or legal obligation? ) I think that is a big question and maybe a reason some have stayed away from this thread?
    What about requirements of programs used? ( documentation, trustworthiness, liability, etc. ? )

    Wow! Six boxes and 2500 drives! A daunting task to say the least.

    It may also have helped considerably to know what you have tried and what errors you received!

    I've never tried anything like this, but I am assuming you wrote a bash script to contain something like

    #!/bin/sh

    sfdisk -L /dev/hda <<EOF
    ;
    EOF
    sfdisk -V -q /dev/hda
    mkfs.ext3 -q
    e2fsck -y


    This assumes the first IDE hard drive is being formated, and whatever distro you are booting to knows where to find these programs.

    Am I even close?

    .
    " And maddest of all, to see life as it is and not as it should be" --Miguel Cervantes

  4. #4
    Member
    Join Date
    Sep 2006
    Location
    At a keyboard
    Posts
    82
    oofki, thanks but ghost isn't an option.

    IKnowNot, yes, I have something similar that wasn't quite working the way I wanted. Which was multiple scripts. I believe what you suggest may actually work better. How would I go about piping the output of the commands to a file that will be displayed after every thing has run though? Which is how I ended up with more than one script if I remember correctly.

    While the data does not have to be securely deleted, Would you have any suggestions for doing so? I'm going to be working off of slax frodo CD's for this .
    "I have died, I will die, It's alright, I don't mind"

  5. #5
    Senior Member IKnowNot's Avatar
    Join Date
    Jan 2003
    Posts
    792
    While the data does not have to be securely deleted, Would you have any suggestions for doing so? I'm going to be working off of slax frodo CD's for this .
    If it doesn't have to be securely deleted then attempting to do so would add a lot of extra time to such a large project.

    To just delete what is on the drive, maybe something like
    dd if=/dev/zero of=/dev/hda bs=1M
    ??
    I am no expert, but to securely delete the data couldn't you, after running the above, run
    dd if=/dev/random of=/dev/hda bs=1M

    about six times, then run the first one again? Would that do it?
    ===================================

    What is the purpose of the file?

    Could you just use the screen output to verify that all went well, or do you need a hard copy, or a running list? ( you said you will be using a KVM, so switching to each box when it is complete should show if successful or not? )

    If you pipe it to a file, on what media will the file be stored? ( are you going to network these computers and have a file or print server attached for the output? ) Or maybe the boxes have floppy drives which you could mount to store the files on a disk?

    BUT, suppose you name the file format_bin
    when you call it, just pipe the output into a file;

    ./format_bin > /mnt/usb/output-file

    where /mnt/usb is where I mounted my USB drive to save the file.
    ( you could probably include the mount command at the head of the file if it is on the CD )

    OK, a few small changes to the file, and some additional info if you really want to use that file:

    #!/bin/sh

    hdparm -I /dev/hda

    sfdisk -q -f /dev/hda <<EOF
    ;
    EOF
    sfdisk -V -q /dev/hda
    mkfs.ext3 -q /dev/hda1
    e2fsck -y /dev/hda1


    The above file will format a 13G drive in under a minute.
    Add just one pass of dd and it increases to 19 minutes
    .
    " And maddest of all, to see life as it is and not as it should be" --Miguel Cervantes

  6. #6
    Member
    Join Date
    Sep 2006
    Location
    At a keyboard
    Posts
    82
    I just wanted to send it to a file so that I could see the results of all the commands given at a glance. If one fails in the beginning I don't want to over look it, the file will not actually be saved. Just don't want to have to sit and watch the screen. I'll probly just send the file to the /root/ dir and have it display from there. Drives that fail are put under scrutiny and then RMA'ed for failure. Thanks again for the assistance.
    "I have died, I will die, It's alright, I don't mind"

  7. #7
    Senior Member
    Join Date
    Oct 2003
    Location
    MA
    Posts
    1,053
    Just out of curiosity why would ghost not work for you? Maybe because the price tag?

  8. #8
    Member
    Join Date
    Sep 2006
    Location
    At a keyboard
    Posts
    82
    Not so much the price tag, I just do not like nortons products in the least. And like I said, I'm working with all types of drives. Lets say 8 different sizes ide drives, 8 or 9 different sizes of sata drives, and at least 3 different sizes of scsi drives as well as sas drives. Many models all made by different manufacturers. From what I understand I would have to have a diffrent ghost image for each one of those drives specifacly. I'm trying the improve a currently existing system, not create a new system.
    "I have died, I will die, It's alright, I don't mind"

  9. #9
    Senior Member
    Join Date
    Oct 2003
    Location
    MA
    Posts
    1,053
    Well you are probably thinking of the home version of ghost, the corporate one is bootable and actually works very nicely. Anyways good luck in your search mate.

Similar Threads

  1. SVCHost running at 99.9%
    By Zorolord in forum General Computer Discussions
    Replies: 2
    Last Post: July 12th, 2006, 12:42 PM
  2. Computer running very slow
    By dayneman1 in forum General Computer Discussions
    Replies: 6
    Last Post: May 9th, 2006, 06:55 PM
  3. M$ office running on Linux
    By GbinaryR in forum Microsoft Security Discussions
    Replies: 8
    Last Post: March 30th, 2002, 08:37 PM
  4. Running Your Firewall in runlevel 0
    By micael in forum *nix Security Discussions
    Replies: 9
    Last Post: February 19th, 2002, 03:13 PM
  5. Traceroute: under the hood
    By antihaxor in forum Non-Security Archives
    Replies: 0
    Last Post: January 24th, 2002, 04:42 PM

Posting Permissions

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

 Security News

     Patches

       Security Trends

         How-To

           Buying Guides