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