This article is written like a personal reflection, personal essay, or argumentative essay that states a Wikipedia editor's personal feelings or presents an original argument about a topic.(May 2013) |
Stable release | 0.3675 |
---|---|
Repository | |
Operating system | Unix-like |
Type | Partition editor |
License | GNU General Public License |
Website | https://github.com/baruch/gpart |
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 [1] or Debian [2] ) 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 a good idea to use a utility such as ddrescue to make a backup. Then when you have a copy of the device, use gpart to guess the partitions on the copy. If it is successful, you can try writing them back to the device. You may find that when using ddrescue you get read errors because the device is damaged but if you can get the partitions readable with your copy then you can try using Mount (Unix) and 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.
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
Supported (guessable) filesystem or partition types:
XFS is a high-performance 64-bit journaling file system created by Silicon Graphics, Inc (SGI) in 1993. It was the default file system in SGI's IRIX operating system starting with its version 5.3. XFS was ported to the Linux kernel in 2001; as of June 2014, XFS is supported by most Linux distributions; Red Hat Enterprise Linux uses it as its default file system.
ext2, or second extended file system, is a file system for the Linux kernel. It was initially designed by French software developer Rémy Card as a replacement for the extended file system (ext). Having been designed according to the same principles as the Berkeley Fast File System from BSD, it was the first commercial-grade filesystem for Linux.
ext3, or third extended filesystem, is a journaled file system that is commonly used by the Linux kernel. It used to be the default file system for many popular Linux distributions. Stephen Tweedie first revealed that he was working on extending ext2 in Journaling the Linux ext2fs Filesystem in a 1998 paper, and later in a February 1999 kernel mailing list posting. The filesystem was merged with the mainline Linux kernel in November 2001 from 2.4.15 onward. Its main advantage over ext2 is journaling, which improves reliability and eliminates the need to check the file system after an unclean shutdown. Its successor is ext4.
Disk partitioning or disk slicing is the creation of one or more regions on secondary storage, so that each region can be managed separately. These regions are called partitions. It is typically the first step of preparing a newly installed disk, before any file system is created. The disk stores the information about the partitions' locations and sizes in an area known as the partition table that the operating system reads before any other part of the disk. Each partition then appears to the operating system as a distinct "logical" disk that uses part of the actual disk. System administrators use a program called a partition editor to create, resize, delete, and manipulate the partitions. Partitioning allows the use of different filesystems to be installed for different kinds of files. Separating user data from system data can prevent the system partition from becoming full and rendering the system unusable. Partitioning can also make backing up easier. A disadvantage is that it can be difficult to properly size partitions, resulting in having one partition with too much free space and another nearly totally allocated.
The system utility fsck
is a tool for checking the consistency of a file system in Unix and Unix-like operating systems, such as Linux, macOS, and FreeBSD. The equivalent programs on MS-DOS and Microsoft Windows are CHKDSK, SFC, and SCANDISK.
In the maintenance of file systems, defragmentation is a process that reduces the degree of fragmentation. It does this by physically organizing the contents of the mass storage device used to store files into the smallest number of contiguous regions. It also attempts to create larger regions of free space using compaction to impede the return of fragmentation. Some defragmentation utilities try to keep smaller files within a single directory together, as they are often accessed in sequence.
In computing, a file system or filesystem is a method and data structure that the operating system uses to control how data is stored and retrieved. Without a file system, data placed in a storage medium would be one large body of data with no way to tell where one piece of data stopped and the next began, or where any piece of data was located when it was time to retrieve it. By separating the data into pieces and giving each piece a name, the data are easily isolated and identified. Taking its name from the way a paper-based data management system is named, each group of data is called a "file". The structure and logic rules used to manage the groups of data and their names is called a "file system."
The GUID Partition Table (GPT) is a standard for the layout of partition tables of a physical computer storage device, such as a hard disk drive or solid-state drive, using universally unique identifiers, which are also known as globally unique identifiers (GUIDs). Forming a part of the Unified Extensible Firmware Interface (UEFI) standard, it is nevertheless also used for some BIOSs, because of the limitations of master boot record (MBR) partition tables, which use 32 bits for logical block addressing (LBA) of traditional 512-byte disk sectors.
GParted is a GTK front-end to GNU Parted and an official GNOME partition-editing application. GParted is used for creating, deleting, resizing, moving, checking, and copying disk partitions and their file systems. This is useful for creating space for new operating systems, reorganizing disk usage, copying data residing on hard disks, and mirroring one partition with another. It can also be used to format a USB drive.
In Linux systems, initrd
is a scheme for loading a temporary root file system into memory, to be used as part of the Linux startup process. initrd
and initramfs
refer to two different methods of achieving this. Both are commonly used to make preparations before the real root file system can be mounted.
An extended boot record (EBR), or extended partition boot record (EPBR), is a descriptor for a logical partition under the common DOS disk drive partitioning system. In that system, when one partition record entry in the master boot record (MBR) is designated an extended partition, then that partition can be subdivided into a number of logical partitions. The actual structure of that extended partition is described by one or more EBRs, which are located inside the extended partition. The first EBR will always be located on the very first sector of the extended partition.
The following tables compare general and technical information for a number of file systems.
e2fsprogs is a set of utilities for maintaining the ext2, ext3 and ext4 file systems. Since those file systems are often the default for Linux distributions, it is commonly considered to be essential software.
ext4 is a journaling file system for Linux, developed as the successor to ext3.
Partimage is a disk cloning utility for Linux/UNIX environments. Partimage can save partitions in many formats to a disk image. Utilities such as Partimage are useful in a number of situations which are commonly encountered by network administrators as well as advanced computer users who maintain their own systems. The last stable release was in 2010; since then, one of Partimage's authors has worked on FSArchiver, which has broader functionality than Partimage.
Btrfs is a computer storage format that combines a file system based on the copy-on-write (COW) principle with a logical volume manager, developed together. It was founded by Chris Mason in 2007 for use in Linux, and since November 2013, the file system's on-disk format has been declared stable in the Linux kernel.
In computer operating systems, mkfs
is a command used to format a block storage device with a specific file system. The command is part of Unix and Unix-like operating systems. In Unix, a block storage device must be formatted with a file system before it can be mounted and accessed through the operating system's filesystem hierarchy.
In Unix-like operating systems, a device file or special file is an interface to a device driver that appears in a file system as if it were an ordinary file. There are also special files in DOS, OS/2, and Windows. These special files allow an application program to interact with a device by using its device driver via standard input/output system calls. Using standard system calls simplifies many programming tasks, and leads to consistent user-space I/O mechanisms regardless of device features and functions.
libguestfs is a C library and a set of tools for accessing and modifying virtual disk images used in platform virtualization. The tools can be used for viewing and editing virtual machines (VMs) managed by libvirt and files inside VMs, scripting changes to VMs, creating VMs, and much else besides. It was created because of security issues, when virtual disk images are mounted directly on the host system.
A master boot record (MBR) is a special type of boot sector at the very beginning of partitioned computer mass storage devices like fixed disks or removable drives intended for use with IBM PC-compatible systems and beyond. The concept of MBRs was publicly introduced in 1983 with PC DOS 2.0.