What switches can be used with the GDisk utilities, GDisk.exe, and GDisk32.exe?
GDisk is a DOS program with seven main operations. This document describes the options available for each operation. The seven operations are:
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.
GDisk conformance to standards
The disk-wipe feature in GDisk conforms to the standards detailed in the
following two documents:
Operating Manual), DoD 5220.22-M, January 1995.
Use GDisk32.exe for the following:
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...]]
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...]]
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]
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]
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]
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]
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]
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 [/DODWIPE|/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. |
/DODWIPE |
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:
For more information on GDisk, see Introduction to GDisk.
For more information on removing data from a hard disk, see How to perform a hard disk wipe using the Ghost utility called GDisk.