ArticleslgStudy

computer science

Gpart

Gpart is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Gpart rather than just read about it. In short: gpart is a software utility which scans a storage device, examining the data in order to detect partitions which may exist but are absent from the disk's partition tables. Gpart was written by Michail Brzitwa of Germany.

Key takeaways

  • Gpart belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Gpart to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Gpart from memory before moving on to harder problems.

Reference excerpt

gpart is a software utility which scans a storage device, examining the data in order to detect partitions which may exist but are absent from the disk's partition tables. Gpart was written by Michail Brzitwa of Germany. The release on the author's website is now older than the releases some distributions are using. It appears that Michail Brzitwa does not actively maintain the code, instead the various distributions (I.E. Fedora or Debian) appear to maintain their own versions. gpart tries to guess partitions from any device that can be partitioned, even a file. If the primary partition table has been lost, overwritten or destroyed the partitions still exist on the media but the operating system cannot access them. gpart ignores the primary partition table and scans the disk (or disk image file) sector after sector for several filesystem/partition types. It does so by "asking" filesystem recognition modules if they think a given sequence of sectors resembles the beginning of a filesystem or partition type. Michail Brzitwa,: man page "gpart(8) - Linux man page", January 2001 A list of these modules are listed below. Also modules can be written for future filesystems and used in the detection process. If recovering partitions is needed that are damaged on the only bootable disk in a machine, a live CD can be used such as knoppix to start the machine and use the utilities from the disk. It is also good at finding and listing the types, locations, and sizes of inadvertently-deleted partitions, both primary and logical. It gives you the information you need to manually re-create them (using fdisk, cfdisk, sfdisk, etc.). The guessed partition table can also be written to a file or (if you firmly believe the guessed table is entirely correct) directly to a disk device. With some badly damaged devices, it is possible to use a utility such as ddrescue to make a backup. gpart can guess the partitions on the copy. If it is successful, they can be written back to the device. Using ddrescue can get read errors because the device is damaged but if there are partitions readable with your copy then Mount (Unix) can retrieve the data from the copy.

$ mount -t <part type> /path/to/imagefile -o loop,offset=<part offset> /mnt/loop

This will mount the partition at offset <part offset> on /mnt/loop so you can recover your data from the file. To get the partition offset you can use either fdisk -ul /path/to/imagefile or use the output from gpart. Look at the sample output at the size line, the last pair of round brackets has the start (16) and then end (3906559). When specifying the offset, always specify the start.

Sample output This is sample output from a scan of an 8GB flash memory stick with two partitions, one FAT16B 2GB partition and one xfs 6GB partition.

Begin scan... Possible partition (DOS FAT), size (1907mb), offset (0mb) Possible partition (SGI XFS filesystem), size (5730mb), offset (1907mb) End scan. Checking partitions... Partition (DOS or Windows 95 with 32 bit FAT, LBA): primary Partition (Linux ext2 filesystem): primary Ok. Guessed primary partition table: Primary partition(1) type: 012 (0x0C) (DOS or Windows 95 with 32 bit FAT, LBA) size: 1907mb #s(3906544) s(16-3906559) chs: (0/1/1)-(1023/19/16)d (0/1/1)-(12207/19/16)r Primary partition(2) type: 131 (0x83)(Linux ext2 filesystem) size: 5730mb #s(11736000) s(3906560-15642559) chs: (1023/19/16)-(1023/19/16)d (12208/0/1)-(48882/19/16)r Primary partition(3) type: 000 (0x00)(unused) size: 0mb #s(0) s(0-0) chs: (0/0/0)-(0/0/0)d (0/0/0)-(0/0/0)r Primary partition(4) type: 000 (0x00)(unused) size: 0mb #s(0) s(0-0) chs: (0/0/0)-(0/0/0)d (0/0/0)-(0/0/0)r

Partition types Supported (guessable) filesystem or partition types:

BeOS Be File System. FreeBSD/NetBSD/386BSD BSD disklabel sub-partitioning scheme used on Intel platforms. IBM OS/2 High Performance File System (HPFS). Linux ext2 (second extended filesystem). Linux LVM (Logical Volume Manager) physical volumes. Linux swap partitions (versions 0 and 1). The Minix operating system filesystem type. DOS and Windows 9x FAT12, FAT16 and FAT32 filesystems. Microsoft Windows NT and later NTFS filesystem. ReiserFS (version 3.5.X, X > 11). XFS, Silicon Graphics' journaling file system for Linux. Oracle Solaris on Intel platforms uses a sub-partitioning scheme on PC hard disks similar to the BSD disklabels. QNX 4.x filesystem. Other types may be added relatively easily, as separately compiled modules.

See also TestDisk – another partition recovery tool fdisk, cfdisk, gparted - partition editors Knoppix

References

External links gpart – Guess PC-type hard disk partitions gpart(8): guess PC-type hard disk partitions (Linux man page) CLI Magic: Salvage lost partitions with gpart (Linux.com) Original Gpart website

Worked examples

Example 1 — a first encounter with Gpart

Start with the simplest possible case. Write down what Gpart claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Gpart before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Gpart ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Gpart

In research
Gpart appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Gpart in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Gpart is common in secondary-school and first-year university syllabi. It links to neighbouring topics Free partitioning software, Unix file system-related software, so understanding it makes those chapters shorter.
In everyday life
Look for Gpart outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Gpart” →

How to study Gpart in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Gpart means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Gpart out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Gpart in simple terms?

gpart is a software utility which scans a storage device, examining the data in order to detect partitions which may exist but are absent from the disk's partition tables. Gpart was written by Michail Brzitwa of Germany.

Why does Gpart matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Gpart?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Gpart.

Tags

  • Free partitioning software
  • Unix file system-related software

Keep exploring