?
Solved

Automate FDISK to set active partition

Posted on 2004-09-10
3
Medium Priority
?
1,074 Views
Last Modified: 2012-05-05
We successfully use a handful of imaging, scripting, and partitioning methods to automate deployment, backup, and restoration of hundreds of PCs.  Lately, due to a combination of some twichy software we really can't throw overboard (due to our $$$ of exposure with it and the things it *DOES* do well enough...) changing drive technologies and some more finicky BIOS/ATA Controller/HD combos, some post-imaging system results are twitchy.  Specifically, a system being reimaged may pull down the image fine, but the resulting partition table lists no active partition (yea, that's kind of a problem!).  Once we manually enter into FDISK and set it to active, all's well.  But this wastes a lot of time when the systems could otherwise be boxed by chimps and sent off as "like new" with no need for further IT administration.

We use automated FDISK scripts and have been for some time; they are great for wiping the MBR out, deleting partiions, and particularly for restoring OEM/Diagnostics partitions and essentially ensuring that no matter what wizardry users or over-caffeinated sysadmins have performed on a PC during its tenure, that all system are restored to their original state prior to returing to the leasing agents.  However, the one thing we have been having a hard time determining is how to script FDISK to set a given partition to ACTIVE.  I am hoping this is possible.  I am not opposed to using something like FreeFDISK or AEFDISK, but if this is feasible with FDISK, I'd rather just stick with that since we're already using it with great success.

Here is a thread that helped us get going with that originally:

http://www.experts-exchange.com/Operating_Systems/MSDOS/Q_20378776.html

Here is a page that lists some helpful FDISK scripting/FDISK Batch file basics:

http://www.computerhope.com/fdiskhlp.htm#04

Free FDISK:

http://www.23cc.com/free-fdisk/

AEFDISK:

http://www.AEFDisk.com/

0
Comment
Question by:DKelsey01
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 1

Accepted Solution

by:
Dejunai earned 500 total points
ID: 12030580
FDISK is automated by a number of ways, but the simplest way is a command list.

DOSPROMPT> FDISK.COM < COMMANDS.LST

The COMMANDS.LST is a simple text file with the keystrokes required to
run FDISK the way you want it. Each indvidual command should appear
on a seperate line.

You cannot have the COMMANDS.LST make any choices. So, if alternate
command sets are needed they must be determined in the initial batch file.

if "%1"=="1" FDISK.COM < COMMAND01.LST
if "%1"=="2" FDISK.COM < COMMAND02.LST
...etc...

A Sample LST would be something like...
-------------------- BEGIN ------------------------
Y
3
1
1
DRIVE_C
Y
-------------------- -END- ------------------------

The above text...
Sends KEYSTROKE Y at the FDISK initial request to enable large disk support.
Sends KEYSTROKE 3 to delete a DOS partition...
Sends KEYSTROKE 1 to delete primary partition...
Sends KEYSTROKE 1 to indicate which partition...
Sends the KEYSTROKES "DRIVE_C" as the volume label
Sends KEYSTROKE Y to acknowledge YES Delete the partition...


Play with it, you see how it works quickly.
Hope this helps...
0
 
LVL 1

Expert Comment

by:Dejunai
ID: 12030611
Er, just wanted to add...
My company used to use the above method,
It worked fine.

But the best method...

Is a small utility from symantec included with any copy of GHOST,
called GDISK.EXE...

100% command line friendly... I strongly recommend getting it.

0
 

Author Comment

by:DKelsey01
ID: 12034852
Thanks to both of you--I'll probably start with the scripting utility first.  I've been able to get it to work using 3rd party freeware, which I'm not opposed to, but it just seems like it would be somewhat more elegant to streamline the toolset and keep the quantity of utilities in use as low as possible.

As for GHOST, we own a site license, but retired it several years ago in favor of Altiris' management solution.  I do remember using GDISK before, so I'll try to locate, dust off, and put it through its paces as well.

Thanks again...
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

VALIDATING DATES One method of validating dates is to jam the date into the DATE command and see if it accepts it by examining the system's errorlevel value. A non-zero result indicates failure. A typical example might look something like the fol…
Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses
Course of the Month8 days, 10 hours left to enroll

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question