Switches: GDisk

Article:HOWTO10415  |  Created: 2009-07-23  |  Updated: 2011-02-10  |  Article URL http://www.symantec.com/docs/HOWTO10415
Article Type
How To

Product(s)



Question

You are wondering what switches can be used with the GDisk utilities, GDisk.exe, and GDisk32.exe.

Answer

GDisk is a DOS program with seven main operations. This document describes the options available for each operation. The seven operations are:

  • Display partition information (/STATUS)
  • Create a partition (/CRE)
  • Delete a partition (/DEL)
  • Activate or deactivate a partition (/ACT and /-ACT)
  • Hide or unhide a partition (/HIDE and /-HIDE)
  • Reinitialize the master boot record (/MBR)
  • Wipe the disk surface (/DISKWIPE)

These commands can be run from the DOS command-line or from a batch file (/BATCH). In addition, GDisk provides help from the command-line.

Note: GDisk does not function correctly in some instances when the computer has GoBack installed. To use GDisk in this case, disable GoBack, start the computer from a floppy disk, and then run GDisk.

GDisk32

Norton Ghost 2002, 2003, and Symantec Ghost 7.5, 8.x include two versions of GDisk: GDisk.exe and GDisk32.exe. GDisk32.exe is a 32 bit program that can be run from within a DOS virtual computer. Use this version when you want to run GDisk from within Windows.

Note: Not all GDisk.exe command-line switches will work with GDisk32.exe.

GDisk32.exe conforms to most current U.S. Department of Defense (DoD) specifications.

Use GDisk32.exe for the following:

  • Un-hiding a partition that the Windows NT or Windows 2000 Disk Manager cannot see.
  • Activating a diagnostic or recovery partition.
  • Adding or removing an operating system from the Windows NT or Windows 2000 Boot Menu. GDisk32.exe includes a new switch, -BOOTINI, for adding or removing entries from the Windows NT or Windows 2000 file Boot.ini. That is, when you use the -BOOTINI switch to add or remove entries from the Windows Boot.ini file, you change which operating systems are available on the Windows Boot Menu. For instance, if you installed Windows 98 to the computer and then Windows 2000, the Windows 2000 boot menu might not display Windows 98. Use -BOOTINI to add the Windows 98 partition to the file Boot.ini.

In all other cases, such as when you run GDisk from a bootable floppy disk, use GDisk.exe rather than GDisk32.exe.

/BSECTFILE

The switch /BSECTFILE is a parameter for the switch /BOOTINI. The switch /BSECTFILE requires the full path to the file, such as /bsectfile:c:\text.dat

If you do not specify the path to the boot file, the resulting Boot.ini entry (in this example, TEST.DAT="TEST") fails.

/INIFILE

The switch /INIFILE is a parameter for the switch /BOOTINI. The switch /INIFILE does not require the full path to the file. For example, the following syntax is correct: /inifile:boot.ini 
 

Displaying GDisk help

General help is available by using the ? switch:

gdisk /?

Help on a particular operation is available by using the switch for the operation without additional parameters. The format of this command is:

gdisk /? </operation>

For instance, the following command displays information regarding deleting partitions:

gdisk /? /del

 

Using GDisk in batch mode

The batch mode switch, /BATCH, allows GDisk to perform multiple operations with a single command. The operations can be specified interactively at a DOS command-line, or they can be supplied in advance in a text file.

GDisk's batch mode uses the following command-line format:

gdisk [disk] /BATCH[:filename] [switch[switch...]]

  • Disk tells GDisk which fixed physical disk (1 through 8) the commands apply to.
  • /BATCH tells GDisk that it will be executing multiple GDisk commands. This command is optional.
  • Filename provides GDisk with the name of the text file that includes multiple GDisk commands. If no file name is provided, GDisk prompts the user (interactively) for the command-line parameters.
  • Switch lists the command-line parameters (switches). If the command-line calls a batch file, the switches specified on the command-line are run after running the commands contained in the batch file.

Specifying /BATCH commands interactively

Using the /BATCH command without the name of a text file allows GDisk commands to be supplied interactively at a prompt. The command-line format is:

gdisk [disk] /BATCH [switch[switch...]]

For instance, the following command will load GDisk, prompt the user for additional commands, then wait for further input from the user:

gdisk /batch

Here is an example of how an interactive session might look. This session creates an extended partition on the second physical disk.

C:\>gdisk /batch

Complete the following command (ENTER to quit):

>gdisk 2 /cre /ext

Partition Status Type Volume Label Mbytes System Usage

2 *CREATED* EXT DOS 507.9 17%

>gdisk 2 /cre /log

Partition Status Type Volume Label Mbytes System Usage

2 EXT DOS 507.9 17%

D: 3 *CREATED* LOG DOS Unformatted 507.9 FAT16 17%

 

Specifying /BATCH commands in a text file

Using the /BATCH command with the name of a text file allows GDisk commands to be supplied without user intervention during GDisk operation. GDisk opens the file and executes the commands within the file until all commands have been executed or one of the commands encounters an error. The command-line format is:

    gdisk [disk] /BATCH [switch[switch...]]

  • The name of the text file must follow DOS conventions, but the extension does not have to be .txt.
  • In the text file, GDisk ignores blank lines and lines starting with the hash symbol (#).
  • If all the GDisk commands will operate on the same fixed physical disk, specify the disk number on the GDisk command-line that calls the batch file or on each line of the batch file.
  • If the GDisk commands will operate on the various disks, specify the disk number on each line of the batch file. If there are additional switches on the initial command-line (the one that calls the batch file), then also specify the disk number on the initial command line.
  • Command-line arguments that apply to all of the batch commands can be specified on the original command line. The lines in the batch file (or typed at the prompt) are appended to the already partially formed command line.
  • A batch file can call another batch file.

Example of a batch file

The following command runs the batch file two-new.gg to perform GDisk operations on disk 2, without prompting for confirmation:

gdisk 2 /y /batch:two-new.gg

The file two-new.gg, with the following contents, deletes all partitions and creates two new ones on the second fixed disk. The hash marks (#) indicate remarks. Note that, in this example, the commands do not specify the fixed disk on each line:

# Delete all partitions

/del /all

# Create a new FAT16 primary DOS partition and format it

/cre /pri /-32 /for /q

/cre /ext

# Create a new FAT16 logical DOS partition and format it

/cre /log /-32 /for /q

When GDisk runs, it appends the contents of the batch file to the initial command line, performing each of the following commands in sequence:

gdisk 2 /y /del /all

gdisk 2 /y /cre /pri /-32 /for /q

gdisk 2 /y /cre /ext

gdisk 2 /y /cre /log /-32 /for /q

Nested batch files

A batch file can call another batch file.

For instance, the following command calls the file std-init.gg:

gdisk /batch:std-init.gg

Supposing the file std-init.gg contains the following lines, where the digits 1 and 2 specify the disk number:

1 /batch:two-new.gg

2 /batch:two-new.gg

Then GDisk runs the commands contained in the file two-new.gg on the first fixed disk, then on the second fixed disk, as follows:

gdisk 1 /y /del /all

gdisk 1 /y /cre /pri /-32 /for /q

gdisk 1 /y /cre /ext

gdisk 1 /y /cre /log /-32 /for /q

gdisk 2 /y /del /all

gdisk 2 /y /cre /pri /-32 /for /q

gdisk 2 /y /cre /ext

gdisk 2 /y /cre /log /-32 /for /q

Mixing interactive commands and text file commands

GDisk accepts the interactive /BATCH command and a text file /BATCH command on the same command line.

For instance, the following command prompts for the number of the fixed disk or disks to execute the commands in two-new.gg against:

gdisk /batch /batch:two-new.gg

The disk number can also be supplied in a text file. For instance:

gdisk /batch:disks.gg /batch:two-new.gg

Where the contents of the file disks.gg are the numbers of the physical disks (each number on a separate line):

1

2

Switches for GDisk operations

Here are the GDisk switches, as provided by the Gdisk /? <operation> command.

Gdisk /?

This command displays the command-line formats for the major Gdisk operations:

gdisk disk /CRE {/PRI|/EXT|/LOG} [/SZ:mbytes] [/FOR [/Q] [/V[:label]]] [/-32] [/-CE] [/X] [/Y]

gdisk disk /DEL {/PRI[:nth]|/EXT[:nth]|/LOG:nth|/P:partn-no|/ALL} [/X] [/Y]

gdisk [disk] [/STATUS] [/RAW|/LBA] [/SER] [/X] [/Y]

gdisk disk /ACT /P:partn-no [/X] [/Y]

gdisk disk /[-]HIDE /P:partn-no [/X] [/Y]

gdisk disk /MBR [/WIPE] [/X] [/Y]

gdisk [disk] /BATCH[:filename] [switch[switch...]]

gdisk /? [/CRE|/DEL|/STATUS|/ACT|/[-]HIDE|/MBR|/BATCH]

GDisk /? /ACT

This command displays the command-line format for the /ACT operation. The /ACT command sets a partition to Active. The /-ACT command deactivates the partition.

General command:

gdisk disk /ACT /P:partn-no [/X] [/Y]

  • disk The physical fixed disk (1-8).
  • /ACT Set the active partition.
  • /-ACT Deactivate the partition.
  • /P:partn-no The number of the partition to activate. Use /STATUS to select the partition number.
  • /X Ignore extended disk-access support.
  • /Y Suppress prompting to confirm you wish the action to be performed. /SURE has the same meaning.

GDisk /? /CRE

This command displays the command-line format for the /CRE operation. The /CRE command creates fixed disk partitions and logical drives.

General command:

gdisk disk /CRE {/PRI|/EXT|/LOG} [/SZ:mbytes] [/FOR [/Q] [/V[:label]]] [/-32] [/-CE] [/X] [/Y]

  • disk The physical fixed disk (1-8).
  • /CRE Create a DOS partition or logical DOS drive.
  • /PRI Create a primary DOS partition.
  • /EXT Create an extended DOS partition.
  • /LOG Create a logical DOS drive in the extended DOS partition.
  • /SZ:mbytes Specifies the size of the partition. Default is to create a partition of the largest possible size.
  • /FOR Format the new partition once it has been created.
  • /Q Perform a quick format on the new partition.
  • /V[:label] Specifies the volume label. Default is no label.
  • /-32 Ignore large-disk support (FAT32). Limits maximum size of new primary DOS partitions and logical DOS drives to 2048 MB.
  • /-CE Ignore any free space in the Customer Engineering (CE) cylinder.
  • /X Ignore extended disk-access support.
  • /Y Suppress prompting to confirm you wish the action to be performed. /SURE has the same meaning.

GDisk /? /DEL

This command displays the command-line format for the /DEL operation. The /DEL command deletes fixed disk partitions and logical drives.

General command:

gdisk disk /DEL {/PRI[:nth]|/EXT[:nth]|/LOG:nth|/P:partn-no|/ALL} [/qwipe|/dodwipe|/customwipe:n] [/X] [/Y]

Switch Description
   
disk The physical fixed disk (1-8).
/DEL Delete a DOS partition or logical DOS drive.
/PRI[:nth] Delete the 'nth' primary DOS partition (1-n). Default is 1.
/EXT[:nth] Delete the 'nth' extended DOS partition. Default is 1.
/LOG:nth Delete the 'nth' logical DOS drive from the extended DOS partition (1-n).
/P:partitionnumber Delete any partition. Use /STATUS to select the number of the partition to delete.
/All Delete all partitions.
/qwipe Overwrites the partition’s data area before deleting the partition. Makes one pass of the disk.
/dodwipe Overwrites the partition’s data area before deleting the partition. Makes seven passes of the disk. 
  This is the security standard for the U.S. Department of Defense.
/customwipe:n Overwrites the partition’s data area n times before deleting the partition.  
  *  Note that this switch is not available in Symantec Ghost 7.5. Use /DISKWIPE /DOD instead.  
  *  n can be set from 1 to 100. 
  *  /customwipe:7 is equivalent to /dodwipe
/X Ignore extended disk-access support.
/Y Suppress prompting to confirm you wish the action to be performed. /SURE has the same meaning.

GDisk /? /HIDE

This command displays the command-line format for the /HIDE operation. The /HIDE command hides a regular partition or un-hides a hidden partition.

General command:

gdisk disk /[-]HIDE /P:partn-no [/X] [/Y]

  • disk The physical fixed disk (1-8).
  • /HIDE Hide a partition.
  • /-HIDE Unhide a hidden partition.
  • /P:partn-no The number of the partition to hide/unhide. Use /STATUS to select the partition number.
  • /X Ignore extended disk-access support.
  • /Y Suppress prompting to confirm you wish the action to be performed. /SURE has the same meaning.

     

Gdisk /? /MBR

This command displays the command-line format for the /MBR operation. The /MBR command rewrites the boot code in the Master Boot Record by overwriting it.

Although reinitializing (writing over) the Master Boot Record (MBR) does not alter the disk's partition information, it can be destructive if other software has written information into the MBR. Typical programs that use space in the MBR include drive translation software such as OnTrack's Disk Manager, or a boot manager such as OS/2's Boot Manager. These types of utility programs are known by various names, such as disk extender, drive overlay, and operating system loader.

WARNING: Do not use the /MBR switch on a disk that is using drive translation software installed to the MBR. Writing over the translation software makes the partition data inaccessible unless the drive translation software can be successfully reinstalled.

The most common reason to use this command is to write over a boot sector virus. This destroys the virus that is residing in the MBR. This command does not prevent reinfection of the MBR.

General command:

gdisk disk /MBR [/WIPE] [/X] [/Y]

  • disk The physical fixed disk (1-8).
  • /MBR Reinitialize the Master Boot Record.
  • /WIPE Delete all partitions and logical DOS drives. Default is to leave existing partitions unmodified.
  • /X Ignore extended disk-access support.
  • /Y Suppress prompting to confirm you wish the action to be performed. /SURE has the same meaning.

     

GDisk /STATUS /?

This command displays the command-line format for the /STATUS operation. The /STATUS command displays information about fixed disk partitions.

General command:

gdisk [disk] [/STATUS] [/RAW|/LBA] [/SER] [/X] [/Y]

  • disk The physical fixed disk (1-8). Default is to list all fixed disks.
  • /STATUS Display partition information. Default mode.
  • /RAW Display raw contents of partition table.
  • /LBA Display raw contents of partition table using Logical Block Addressing.
  • /SER Display serial number of disk instead of model.
  • /X Ignore extended disk-access support.
  • /Y Suppress prompting to confirm you wish the action to be performed. /SURE has the same meaning.

     

GDisk /DISKWIPE /?

This command displays the command-line format for the /DISKWIPE operation. The /DISKWIPE command wipes out all information on the hard disk.

Warning: The /DISKWIPE command wipes out the entire contents of the physical disk. Make sure you specify the correct fixed physical disk before proceeding. You can use the /STATUS command with a disk number to check the identity of the fixed disk that you specify.

General command:

gdisk disk /DISKWIPE [/DOD|/CUSTOM:n]

Switch

Description

disk

The physical fixed disk (1-8). Default is to list all fixed disks.

/DISKWIPE

Wipes the contents of the whole disk.

/DOD

DoD 5200.28-STD Wipe of the contents of the whole disk.

/CUSTOM:passes

DoD 5200.28-STD Wipe of the contents of the whole disk.Note that this switch is not available in Symantec Ghost 7.5. Use /DOD instead.

/X

Ignore extended disk-access support.

/I

Ignore direct IDE disk-access support

/S

Ignore SCSI disk-access support.

/Y

Suppress prompting to confirm you wish the action to be performed. /SURE has the same meaning.

/R

Restart after execution of command

 

For versions of Gdisk after  the year 2000 ONLY, Gdisk will perform the following:

GDisk can perform a sanitizing operation, as defined by "action d", when performing a "disk-wipe" operation with the "/diskwipe /dodwipe" command modifier.

The following cycle occurs six times:

  • All addressable locations are overwritten with 0x35.
  • All addressable locations are overwritten with 0xCA.
  • All addressable locations are overwritten with a pseudo-random character.
  • All addressable locations are verified in hardware using the Verify Sectors command to the disk.

For more information on GDisk, see KB 48237, Introduction to GDisk.

For more information on removing data from a hard disk, see KB 44724, How to perform a hard disk wipe using the Ghost utility called GDisk.

Legacy ID



48247


Article URL http://www.symantec.com/docs/HOWTO10415


Terms of use for this information are found in Legal Notices