|GPART(8)||System Manager's Manual||GPART(8)|
- BeOS filesystem type.
- FreeBSD/NetBSD/386BSD disklabel sub-partitioning scheme used on Intel platforms.
- Linux second extended filesystem.
- MS-DOS FAT12/16/32 "filesystems".
- IBM OS/2 High Performance filesystem.
- Linux LVM physical volumes (LVM by Heinz Mauelshagen).
- Linux swap partitions (versions 0 and 1).
- The Minix operating system filesystem type.
- MS Windows NT/2000 filesystem.
- QNX 4.x filesystem.
- The Reiser filesystem (version 3.5.X, X > 11, 3.6.X).
- Sun Solaris on Intel platforms uses a sub-partitioning scheme on PC hard disks similar to the BSD disklabels.
- Silicon Graphic's journalling filesystem for Linux.
gpart -C 1028,255,63 <other options> <device>
dd if=/dev/hda of=mbr bs=512 count=1exchanging /dev/hda with the block device name of the disk in question. This should be done for all disks in the system. To restore the primary partition table without overwriting the MBR type
dd if=mbr of=/dev/hda bs=1 count=64 skip=446 seek=446Warning: make sure that all parameters are typed as shown and that the disk device is correct. Failing to do so may result in severe filesystem corruption. The saved file should be stored in a safe place like a floppy disk.
- -b backupfile
- If the guessed primary partition table seems consistent and should be written (see the -W option) backup the current MBR into the specified file.
- -C c,h,s
- Set the disk geometry (cylinders, heads, sectors) for the scan. This is useful if a disk should be scanned which was partitioned using a different geometry, if the device is a disk-image or if the disk geometry cannot be retrieved through the PCs BIOS. No spaces are allowed between the numbers, unless all three are enclosed in quotes.
- Check/compare mode (implies the -q quiet option). After the scan is done, the resulting primary partition table is compared to the existing one. The return code of gpart then contains the number of differences (0 if they are identical except for the boot/active flag which cannot be guessed). This option has no effect if -d is given on the command line.
- Do not start the guessing loop. Useful if the partition table should be printed (in combination with the -v option) without actually scanning for partitions.
- Do not try to identify extended partition tables. If there are extended partitions on the given device gpart will most certainly complain about too many primary partitions because there can be only four primary partitions. Existing logical partitions will be listed as primary ones.
- Do not skip disk read errors. If this option is given, and short disk reads or general disk read errors (EIO) are encountered, gpart will exit. If not given, the program tries to continue.
- Full scan. When a possible partition is found, gpart normally skips all sectors this entry seems to occupy and continues the scan from the end of the last possible partition. The disk scan can take quite a while if this option is given, be patient.
- Do not try to get the disk geometry from the OS. If the device is no block or character device but a plain file this option should be supplied. If the file to be scanned is an image of a disk, the geometry can be given by the -C option.
- Show some help.
- Run interactively. Each time a possible partition is identified the user is asked for confirmation.
- -K last sector
- Scan only up to the given sector or the end of the file or device whichever comes first.
- -k sectors
- Skip given number of sectors before the scan. Potentially useful if a partition is looked for at the end of a large disk.
- List available filesystem/partition type modules and their weights, then exit.
- -l logfile
- Log output to the given file (even if -q was supplied).
- -n increment
- Scan increment: number of sectors or "s" for single sector increment, "h" for an increment of sectors per head (depends on geometry) or "c" for cylinder increment. The increment also influences the condition where extended partition tables are searched: if the scan increment is "s" (i.e. 1) extended partition tables are required to be on a head boundary, otherwise they must be on a cylinder boundary. If the disk geometry could not be retrieved and no geometry was given on the command line, the default increment is one sector.
- Quiet/no output mode. However if a logfile was specified (see -l option) all output is written to that file. This option overrides the -i interactive mode.
- -s sector size
- Preset medium sector size. gpart tries to find out the sector size but may fail in doing so. Probed sector sizes are 2^i, i=9..14 (512 to 16384 bytes). The default medium sector size is 512 bytes.
- Show version number.
- Be verbose. This option can be given more than once resulting in quite a lot of information.
- -W device
- Write partition table. If a consistent primary partition table has been guessed it can be written to the specified file or device. The supplied device can be the same as the scanned one. Additionally the guessed partition entries can be edited. No checks are performed on the entered values, thus the resulting table is allowed to be highly inconsistent. Please beware. Warning: The guessed partition table should be checked very carefully before writing it back. You can always write the guessed partition table into a plain file and write this into sector 0 using dd(1) (see section PRECAUTIONS above).
- -w module name,weight
- Put the given module at the head of the module chain and assign a new weight to that module. All modules are given an initial weight of 1.0. Again no spaces are allowed.
gpart /dev/hda- To print the primary partition table of the third IDE drive without starting the scan loop in FreeBSD type
gpart -vvd /dev/wd2- If lilo(8) was installed in the master boot record (MBR) of a hard disk it saves the contents of the first sector in a file called /boot/boot.<major/minor>. To list the partitions contained in such a file type e.g.
gpart -vdg /boot/boot.0300If the partition table contains an extended partition, gpart will complain about invalid extended partition tables because the extended entry points to sectors not within that file. - Usually the first primary partition starts on the second head. If gpart cannot identify the first partition properly this may not be the case. gpart can be told to start the scan directly from sector one of the disk, using the sector-wise scan mode:
gpart -k 1 -n s /dev/hdb- Suppose gpart identifies an NTFS partition as FAT on a certain disk. In this situation the "ntfs" module should be made the first module to be probed and given a weight higher than the usual weight of 1.0:
gpart -w ntfs,1.5 /dev/hdbTo list the available modules and their weights use the -L option. - After having checked the output of gpart at least thrice, the primary partition table can be written back to the device this way:
gpart -W /dev/sdc /dev/sdcThis of course may be extremely dangerous to your health and social security, so beware. - A hard disk with 63 sectors per head is scanned in steps of 63 sectors. To perform the scan on every second head while skipping the first 1008 sectors type
gpart -k 1008 -n 126 /dev/sda- If you want to see how easily gpart can be mislead, and how many probable partition starts are on a disk, search the whole disk really sector by sector, writing all output to a logfile:
gpart -vvfn s -ql /tmp/gpart.log /dev/sd2 &Usually gpart will not be able to produce an educated guess of the primary partition table in this mode. The logfile however may contain enough hints to manually reconstruct the partition table.
Hard disk block devices. The naming scheme of hard disk block devices is OS dependent, consult your system manuals for more information.
Michail Brzitwa <firstname.lastname@example.org>fdisk(8).
|January 2001||Administration Tools|