File: fixparts.html

package info (click to toggle)
gdisk 1.0.5-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 940 kB
  • sloc: cpp: 8,692; sh: 244; makefile: 48
file content (370 lines) | stat: -rw-r--r-- 12,926 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
Content-type: text/html; charset=UTF-8

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of FIXPARTS</TITLE>
</HEAD><BODY>
<H1>FIXPARTS</H1>
Section: FixParts Manual (8)<BR>Updated: 1.0.5<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>

<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>

fixparts - MBR partition table repair utility
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>

<B>fixparts </B>

<I>device</I>

<P>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>

<P>
FixParts (aka <B>fixparts</B>) is a text-mode menu-driven program for
repairing certain types of problems with Master Boot Record (MBR) partition
tables. The program has three design goals, although a few additional
features are supported, as well:
<P>
<DL COMPACT>
<DT><B>*</B>

<DD>
It can remove stray GUID Partition Table (GPT) data, which can be left
behind on a disk that was once used as a GPT disk but then incompletely
converted to the more common (as of 2011) MBR form.
<P>
<DT><B>*</B>

<DD>
It can repair mis-sized extended partitions -- either partitions that
extend beyond the physical end of the disk or that overlap with nearby
primary partitions. FixParts is designed in such a way that this type of
repair occurs automatically, so if it's the only problem with your disk,
you can launch the program and then immediately save the partition table,
making no manual changes, and the program will fix the problem.
<P>
<DT><B>*</B>

<DD>
You can change primary partitions into logical partitions or vice-versa,
within constraints imposed by the MBR data structures.
<P>
</DL>
<P>

<P>
Additional features include the ability to change partition type codes or
boot/active flags, to delete partitions, and to recompute CHS values. With
the possible exception of recomputing CHS values, these secondary features
are better performed with <B>fdisk</B>, because <B>fixparts</B>' design means
that it's likely to alter partition numbering even when such changes are
not requested.
<P>
The <B>fixparts</B> program employs a user interface similar to that of
Linux's <B>fdisk</B>, but <B>fixparts</B> is much more specialized. Most
importantly, you can't create new partitions with <B>fixparts</B>, although
you can change primary/logical assignment.
<P>
In the MBR scheme, partitions come in three varieties:
<P>
<DL COMPACT>
<DT><B>primary</B>

<DD>
These partitions are defined in the first sector of the hard disk and
are limited in number to four. Some OSes, such as Windows and FreeBSD, must
boot from a primary partition.
<P>
<DT><B>extended</B>

<DD>
Extended partitions are specialized primary partitions. They serve as
holding areas for logical partitions.
<P>
<DT><B>logical</B>

<DD>
A disk can contain an arbitrary number of logical partitions
(<B>fixparts</B>, however, imposes a limit of 124 logical partitions). All
the logical partitions reside inside a single extended partition, and are
defined using a linked-list data structure. This fact means that every
logical partition must be preceded by at least one sector of unallocated space
to hold its defining data structure (an Extended Boot Record, or EBR).
<P>
</DL>
<P>

<P>
These distinctions mean that primary and logical partitions cannot be
arbitrarily interspersed. A disk can contain one to three primary
partitions, a block of one or more logical partitions, and one to three
more primary partitions (for a total of three primary partitions, not
counting the extended partition). Primary partitions may not be sandwiched
between logical partitions, since this would mean placing a primary
partition within an extended partition (which is just a specific type of
primary partition).
<P>
Unlike most disk utilities, <B>fixparts</B>' user interface ignores extended
partitions. Internally, the program discards the information on the
original extended partition and, when you tell it to save its changes, it
generates a new extended partition to contain the then-defined logical
partitions. This is done because most of the repairs and manipulations the
tool performs require generating a fresh extended partition, so keeping the
original in the user interface would only be a complication.
<P>
Another unusual feature of <B>fixparts</B>' user interface is that partition
numbers do not necessarily correlate with primary/logical status. In most
utilities, partitions 1-4 correspond to primary partitions, whereas
partitions 5 and up are logical partitions. In <B>fixparts</B>, any partition
number may be assigned primary or logical status, so long as the rules for
layout described earlier are obeyed. When the partition table is saved,
partitions will be assigned appropriately and then tools such as the Linux
kernel and <B>fdisk</B> will give them conventional numbers.
<P>
When it first starts, <B>fixparts</B> performs a scan for GPT data. If the
disk looks like a conventional GPT disk, <B>fixparts</B> refuses to run. If
the disk appears to be a conventional MBR disk but GPT signatures are
present in the GPT primary or secondary header areas, <B>fixparts</B>
offers to delete this extraneous data. If you tell it to do so, the program
immediately wipes the GPT header or headers. (If only one header was found,
only that one header will be erased, to minimize the risk of damaging a
boot loader or other data that might have overwritten just one of the GPT
headers.)
<P>
With the exception of optionally erasing leftover GPT data when it first
starts, <B>fixparts</B> keeps all changes in memory until the user writes
changes with the <B>w</B> command. Thus, you can adjust your partitions in
the user interface and abort those changes by typing <B>q</B> to quit
without saving changes.
<P>
<A NAME="lbAE">&nbsp;</A>
<H2>OPTIONS</H2>

<P>
The <B>fixparts</B> utility supports no command-line options, except for
specification of the target device.
<P>
Most interactions with <B>fixparts</B> occur with its interactive text-mode
menu. Specific functions are:
<P>
<DL COMPACT>
<DT><B>a</B>

<DD>
Toggle the active/boot flag. This flag is required by some boot loaders and
OSes.
<P>
<P>
<DT><B>c</B>

<DD>
Recompute the cylinder/head/sector (CHS) values for all partitions. CHS
addressing mode is largely obsolete, but some OSes and utilities complain
if they don't like the CHS values. Note that <B>fixparts</B>' CHS values are
likely to be incorrect on disks smaller than about 8 GiB except on Linux.
<P>
<DT><B>l</B>

<DD>
Change a partition's status to logical. This option will only work if the
current partition layout supports such a change. Note that if changing a
partition's status in this way is not currently possible, making some other
change may make it possible. For instance, omitting a partition that
precedes the target partition may enable converting a partition to logical
form if there had been no free sectors between the two partitions.
<P>
<DT><B>o</B>

<DD>
Omit a partition. Once omitted, the partition will still appear in the
<B>fixparts</B> partition list, but it will be flagged as omitted. You can
subsequently convert it to primary or logical form with the <B>r</B> or
<B>l</B> commands, respectively. When you save your changes with <B>w</B>,
though, the partition will be lost.
<P>
<DT><B>p</B>

<DD>
Display basic partition summary data. This includes partition's number, the
boot/active flag's status, starting and ending sector numbers,
primary/logical/omitted status, whether or not the partition may be
converted to logical form, and the partition's MBR types code.
<P>
<DT><B>q</B>

<DD>
Quit from the program <I>without saving your changes</I>.
Use this option if you just wanted to view information or if you make a
mistake and want to back out of all your changes.
<P>
<DT><B>r</B>

<DD>
Change a partition's status to primary. This option will only work if the
current partition layout supports such a change. Note that every partition
can theoretically become a primary partition, although in some
configurations, making this change will require omitting some partitions.
If <B>fixparts</B> refuses to allow changing a partition to primary, you may
need to convert other partitions to logical form or omit them entirely.
<P>
<DT><B>s</B>

<DD>
Sort partition entries. This option orders partitions in the display to
match their on-disk positions, which can make understanding the disk layout
easier in some cases. This option has no effect on the ultimate ordering of
logical partitions, which are sorted before being saved. The order of
primary partitions in the final saved partition table may be affected by
this option. In both cases, as already noted, the partition numbers
displayed by <B>fixparts</B> may not be the same as those used by the kernel
or displayed by other partitioning tools.
<P>
<DT><B>t</B>

<DD>
Change a partition's type code. You enter the type code using a one-byte
hexadecimal number.
<P>
<DT><B>w</B>

<DD>
Write data. Use this command to save your changes and exit from the program.
<P>
<DT><B>?</B>

<DD>
Print the menu. Type this command (or any other unrecognized command) to
see a summary of available options.
<P>
</DL>
<P>

<P>
<A NAME="lbAF">&nbsp;</A>
<H2>BUGS</H2>

Known bugs and limitations include:
<P>
<DL COMPACT>
<DT><B>*</B>

<DD>
The program compiles correctly only on Linux, FreeBSD, Mac OS X, and Windows.
Linux versions for x86-64 (64-bit), x86 (32-bit), and PowerPC (32-bit) have been
tested, with the x86-64 version having seen the most testing. Under FreeBSD,
32-bit (x86) and 64-bit (x86-64) versions have been tested. Only 32-bit
versions for Mac OS X and Windows have been tested.
<P>
<DT><B>*</B>

<DD>
The FreeBSD version of the program can't write changes to the partition
table to a disk when existing partitions on that disk are mounted. (The
same problem exists with many other FreeBSD utilities, such as
<B>gpt</B>, <B>fdisk</B>, and <B>dd</B>.) This limitation can be overcome
by typing <B>sysctl kern.geom.debugflags=16</B> at a shell prompt.
<P>
<DT><B>*</B>

<DD>
The program can load only up to 128 partitions (4 primary partitions and
124 logical partitions). This limit can be raised by changing the
<I>#define MAX_MBR_PARTS</I> line in the <I>basicmbr.h</I> source code file
and recompiling.
<P>
<DT><B>*</B>

<DD>
The program can read partitions only if the disk has correct LBA partition
descriptors. These descriptors should be present on any disk over 8 GiB in
size or on smaller disks partitioned with any but very ancient software.
<P>
<DT><B>*</B>

<DD>
The program makes no effort to preserve partition numbers. This can have
consequences for boot loaders and for mounting filesystems via
<B>/etc/fstab</B>. It may be necessary to edit configuration files or even
to re-install your boot loader.
<P>
<DT><B>*</B>

<DD>
<P>
The program may change the order of partitions in the partition table.
<P>
</DL>
<P>

<P>
<A NAME="lbAG">&nbsp;</A>
<H2>AUTHORS</H2>

Primary author: Roderick W. Smith (<A HREF="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com</A>)
<P>
Contributors:
<P>
* Yves Blusseau (<A HREF="mailto:1otnwmz02@sneakemail.com">1otnwmz02@sneakemail.com</A>)
<P>
* David Hubbard (<A HREF="mailto:david.c.hubbard@gmail.com">david.c.hubbard@gmail.com</A>)
<P>
* Justin Maggard (<A HREF="mailto:justin.maggard@netgear.com">justin.maggard@netgear.com</A>)
<P>
* Dwight Schauer (<A HREF="mailto:dschauer@gmail.com">dschauer@gmail.com</A>)
<P>
* Florian Zumbiehl (<A HREF="mailto:florz@florz.de">florz@florz.de</A>)
<P>
<P>
<A NAME="lbAH">&nbsp;</A>
<H2>SEE ALSO</H2>

<B><A HREF="/cgi-bin/man/man2html?8+cfdisk">cfdisk</A></B>(8),

<B><A HREF="/cgi-bin/man/man2html?8+cgdisk">cgdisk</A></B>(8),

<B><A HREF="/cgi-bin/man/man2html?8+fdisk">fdisk</A></B>(8),

<B><A HREF="/cgi-bin/man/man2html?8+mkfs">mkfs</A></B>(8),

<B><A HREF="/cgi-bin/man/man2html?8+parted">parted</A></B>(8),

<B><A HREF="/cgi-bin/man/man2html?8+sfdisk">sfdisk</A></B>(8),

<B><A HREF="/cgi-bin/man/man2html?8+gdisk">gdisk</A></B>(8),

<B><A HREF="/cgi-bin/man/man2html?8+sgdisk">sgdisk</A></B>(8).

<P>
<I><A HREF="http://en.wikipedia.org/wiki/Master_boot_record">http://en.wikipedia.org/wiki/Master_boot_record</A></I>
<P>
<I><A HREF="http://www.rodsbooks.com/fixparts/">http://www.rodsbooks.com/fixparts/</A></I>
<P>
<A NAME="lbAI">&nbsp;</A>
<H2>AVAILABILITY</H2>

The <B>fixparts</B> command is part of the <I>GPT fdisk</I> package and is
available from Rod Smith.
<P>

<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT><A HREF="#lbAB">NAME</A><DD>
<DT><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT><A HREF="#lbAE">OPTIONS</A><DD>
<DT><A HREF="#lbAF">BUGS</A><DD>
<DT><A HREF="#lbAG">AUTHORS</A><DD>
<DT><A HREF="#lbAH">SEE ALSO</A><DD>
<DT><A HREF="#lbAI">AVAILABILITY</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 22:34:11 GMT, February 17, 2020
</BODY>
</HTML>