blob: d840df23ba9bffa5d704626efb37f31dce25b3eb [file] [log] [blame]
Aurimas Liutikasbdbab022017-03-07 09:50:36 -08001.\" Copyright 2011-2013 Roderick W. Smith (rodsmith@rodsbooks.com)
srs5694886ac6c2011-03-13 11:50:59 -04002.\" May be distributed under the GNU General Public License
Aurimas Liutikasbdbab022017-03-07 09:50:36 -08003.TH "FIXPARTS" "8" "0.8.10" "Roderick W. Smith" "FixParts Manual"
srs5694886ac6c2011-03-13 11:50:59 -04004.SH "NAME"
5fixparts \- MBR partition table repair utility
6.SH "SYNOPSIS"
7.BI "fixparts "
8.I device
9
10.SH "DESCRIPTION"
11
12FixParts (aka \fBfixparts\fR) is a text\-mode menu\-driven program for
13repairing certain types of problems with Master Boot Record (MBR) partition
14tables. The program has three design goals, although a few additional
15features are supported, as well:
16
17.TP
18.B *
19It can remove stray GUID Partition Table (GPT) data, which can be left
20behind on a disk that was once used as a GPT disk but then incompletely
21converted to the more common (as of 2011) MBR form.
22
23.TP
24.B *
25It can repair mis-sized extended partitions \-\- either partitions that
26extend beyond the physical end of the disk or that overlap with nearby
27primary partitions. FixParts is designed in such a way that this type of
28repair occurs automatically, so if it's the only problem with your disk,
29you can launch the program and then immediately save the partition table,
30making no manual changes, and the program will fix the problem.
31
32.TP
33.B *
34You can change primary partitions into logical partitions or vice\-versa,
35within constraints imposed by the MBR data structures.
36
37.PP
38
39Additional features include the ability to change partition type codes or
40boot/active flags, to delete partitions, and to recompute CHS values. With
41the possible exception of recomputing CHS values, these secondary features
srs5694d8eed462012-12-15 01:55:21 -050042are better performed with \fBfdisk\fR, because \fBfixparts\fR' design means
srs5694886ac6c2011-03-13 11:50:59 -040043that it's likely to alter partition numbering even when such changes are
44not requested.
45
srs5694d8eed462012-12-15 01:55:21 -050046The \fBfixparts\fR program employs a user interface similar to that of
47Linux's \fBfdisk\fR, but \fBfixparts\fR is much more specialized. Most
48importantly, you can't create new partitions with \fBfixparts\fR, although
srs5694886ac6c2011-03-13 11:50:59 -040049you can change primary/logical assignment.
50
51In the MBR scheme, partitions come in three varieties:
52
53.TP
54.B primary
55These partitions are defined in the first sector of the hard disk and
56are limited in number to four. Some OSes, such as Windows and FreeBSD, must
57boot from a primary partition.
58
59.TP
60.B extended
61Extended partitions are specialized primary partitions. They serve as
62holding areas for logical partitions.
63
64.TP
65.B logical
66A disk can contain an arbitrary number of logical partitions
srs5694d8eed462012-12-15 01:55:21 -050067(\fBfixparts\fR, however, imposes a limit of 124 logical partitions). All
srs5694886ac6c2011-03-13 11:50:59 -040068the logical partitions reside inside a single extended partition, and are
69defined using a linked-list data structure. This fact means that every
srs5694d8eed462012-12-15 01:55:21 -050070logical partition must be preceded by at least one sector of unallocated space
srs5694886ac6c2011-03-13 11:50:59 -040071to hold its defining data structure (an Extended Boot Record, or EBR).
72
73.PP
74
75These distinctions mean that primary and logical partitions cannot be
76arbitrarily interspersed. A disk can contain one to three primary
77partitions, a block of one or more logical partitions, and one to three
78more primary partitions (for a total of three primary partitions, not
79counting the extended partition). Primary partitions may not be sandwiched
80between logical partitions, since this would mean placing a primary
81partition within an extended partition (which is just a specific type of
82primary partition).
83
srs5694d8eed462012-12-15 01:55:21 -050084Unlike most disk utilities, \fBfixparts\fR' user interface ignores extended
srs5694886ac6c2011-03-13 11:50:59 -040085partitions. Internally, the program discards the information on the
86original extended partition and, when you tell it to save its changes, it
87generates a new extended partition to contain the then-defined logical
88partitions. This is done because most of the repairs and manipulations the
89tool performs require generating a fresh extended partition, so keeping the
90original in the user interface would only be a complication.
91
srs5694d8eed462012-12-15 01:55:21 -050092Another unusual feature of \fBfixparts\fR' user interface is that partition
srs5694886ac6c2011-03-13 11:50:59 -040093numbers do not necessarily correlate with primary/logical status. In most
94utilities, partitions 1\-4 correspond to primary partitions, whereas
srs5694d8eed462012-12-15 01:55:21 -050095partitions 5 and up are logical partitions. In \fBfixparts\fR, any partition
srs5694886ac6c2011-03-13 11:50:59 -040096number may be assigned primary or logical status, so long as the rules for
97layout described earlier are obeyed. When the partition table is saved,
98partitions will be assigned appropriately and then tools such as the Linux
99kernel and \fBfdisk\fR will give them conventional numbers.
100
srs5694d8eed462012-12-15 01:55:21 -0500101When it first starts, \fBfixparts\fR performs a scan for GPT data. If the
102disk looks like a conventional GPT disk, \fBfixparts\fR refuses to run. If
srs5694886ac6c2011-03-13 11:50:59 -0400103the disk appears to be a conventional MBR disk but GPT signatures are
srs5694d8eed462012-12-15 01:55:21 -0500104present in the GPT primary or secondary header areas, \fBfixparts\fR
srs5694886ac6c2011-03-13 11:50:59 -0400105offers to delete this extraneous data. If you tell it to do so, the program
106immediately wipes the GPT header or headers. (If only one header was found,
107only that one header will be erased, to minimize the risk of damaging a
108boot loader or other data that might have overwritten just one of the GPT
109headers.)
110
111With the exception of optionally erasing leftover GPT data when it first
srs5694d8eed462012-12-15 01:55:21 -0500112starts, \fBfixparts\fR keeps all changes in memory until the user writes
srs5694886ac6c2011-03-13 11:50:59 -0400113changes with the \fBw\fR command. Thus, you can adjust your partitions in
114the user interface and abort those changes by typing \fBq\fR to quit
115without saving changes.
116
117.SH "OPTIONS"
118
119The \fBfixparts\fR utility supports no command\-line options, except for
120specification of the target device.
121
122Most interactions with \fBfixparts\fR occur with its interactive text\-mode
123menu. Specific functions are:
124
125.TP
126.B a
127Toggle the active/boot flag. This flag is required by some boot loaders and
128OSes.
129
130
131.TP
132.B c
133Recompute the cylinder/head/sector (CHS) values for all partitions. CHS
134addressing mode is largely obsolete, but some OSes and utilities complain
135if they don't like the CHS values. Note that \fBfixparts\fR' CHS values are
136likely to be incorrect on disks smaller than about 8 GiB except on Linux.
137
138.TP
139.B l
140Change a partition's status to logical. This option will only work if the
141current partition layout supports such a change. Note that if changing a
142partition's status in this way is not currently possible, making some other
143change may make it possible. For instance, omitting a partition that
144precedes the target partition may enable converting a partition to logical
145form if there had been no free sectors between the two partitions.
146
147.TP
148.B o
149Omit a partition. Once omitted, the partition will still appear in the
srs5694d8eed462012-12-15 01:55:21 -0500150\fBfixparts\fR partition list, but it will be flagged as omitted. You can
srs5694886ac6c2011-03-13 11:50:59 -0400151subsequently convert it to primary or logical form with the \fBr\fR or
152\fBl\fR commands, respectively. When you save your changes with \fBw\fR,
153though, the partition will be lost.
154
155.TP
156.B p
157Display basic partition summary data. This includes partition's number, the
158boot/active flag's status, starting and ending sector numbers,
159primary/logical/omitted status, whether or not the partition may be
160converted to logical form, and the partition's MBR types code.
161
162.TP
163.B q
164Quit from the program \fIwithout saving your changes\fR.
165Use this option if you just wanted to view information or if you make a
166mistake and want to back out of all your changes.
167
168.TP
169.B r
170Change a partition's status to primary. This option will only work if the
171current partition layout supports such a change. Note that every partition
172can theoretically become a primary partition, although in some
173configurations, making this change will require omitting some partitions.
174If \fBfixparts\fR refuses to allow changing a partition to primary, you may
175need to convert other partitions to logical form or omit them entirely.
176
177.TP
178.B s
179Sort partition entries. This option orders partitions in the display to
180match their on-disk positions, which can make understanding the disk layout
181easier in some cases. This option has no effect on the ultimate ordering of
182logical partitions, which are sorted before being saved. The order of
183primary partitions in the final saved partition table may be affected by
184this option. In both cases, as already noted, the partition numbers
185displayed by \fBfixparts\fR may not be the same as those used by the kernel
186or displayed by other partitioning tools.
187
188.TP
189.B t
190Change a partition's type code. You enter the type code using a one\-byte
191hexadecimal number.
192
193.TP
194.B w
195Write data. Use this command to save your changes and exit from the program.
196
197.TP
198.B ?
199Print the menu. Type this command (or any other unrecognized command) to
200see a summary of available options.
201
202.PP
203
204.SH "BUGS"
Aurimas Liutikasbdbab022017-03-07 09:50:36 -0800205As of March 2014 (version 0.8.10), \fBfixparts\fR
206should be considered beta software. Known bugs and limitations include:
srs5694886ac6c2011-03-13 11:50:59 -0400207
208.TP
209.B *
210The program compiles correctly only on Linux, FreeBSD, Mac OS X, and Windows.
211Linux versions for x86\-64 (64\-bit), x86 (32\-bit), and PowerPC (32\-bit) have been
212tested, with the x86\-64 version having seen the most testing. Under FreeBSD,
21332\-bit (x86) and 64\-bit (x86\-64) versions have been tested. Only 32\-bit
214versions for Mac OS X and Windows have been tested.
215
216.TP
217.B *
218The FreeBSD version of the program can't write changes to the partition
219table to a disk when existing partitions on that disk are mounted. (The
220same problem exists with many other FreeBSD utilities, such as
221\fBgpt\fR, \fBfdisk\fR, and \fBdd\fR.) This limitation can be overcome
222by typing \fBsysctl kern.geom.debugflags=16\fR at a shell prompt.
223
224.TP
225.B *
226The program can load only up to 128 partitions (4 primary partitions and
227124 logical partitions). This limit can be raised by changing the
228\fI#define MAX_MBR_PARTS\fR line in the \fIbasicmbr.h\fR source code file
229and recompiling.
230
231.TP
232.B *
233The program can read partitions only if the disk has correct LBA partition
234descriptors. These descriptors should be present on any disk over 8 GiB in
235size or on smaller disks partitioned with any but very ancient software.
236
237.TP
238.B *
239The program makes no effort to preserve partition numbers. This can have
240consequences for boot loaders and for mounting filesystems via
241\fB/etc/fstab\fR. It may be necessary to edit configuration files or even
242to re-install your boot loader.
243
244.TP
245.B *
246
247The program may change the order of partitions in the partition table.
248
249.PP
250
251.SH "AUTHORS"
252Primary author: Roderick W. Smith (rodsmith@rodsbooks.com)
253
254Contributors:
255
256* Yves Blusseau (1otnwmz02@sneakemail.com)
257
258* David Hubbard (david.c.hubbard@gmail.com)
259
260* Justin Maggard (justin.maggard@netgear.com)
261
Aurimas Liutikasbdbab022017-03-07 09:50:36 -0800262* Dwight Schauer (dschauer@ti.com)
srs5694886ac6c2011-03-13 11:50:59 -0400263
264* Florian Zumbiehl (florz@florz.de)
265
266
267.SH "SEE ALSO"
268\fBcfdisk (8)\fR,
srs5694a17fe692011-09-10 20:30:20 -0400269\fBcgdisk (8)\fR,
srs5694886ac6c2011-03-13 11:50:59 -0400270\fBfdisk (8)\fR,
271\fBmkfs (8)\fR,
272\fBparted (8)\fR,
273\fBsfdisk (8)\fR
274\fBgdisk (8)\fR
275\fBsgdisk (8)\fR
276
277\fIhttp://en.wikipedia.org/wiki/Master_boot_record\fR
278
279\fIhttp://www.rodsbooks.com/fixparts/\fR
280
281.SH "AVAILABILITY"
282The \fBfixparts\fR command is part of the \fIGPT fdisk\fR package and is
283available from Rod Smith.