resetting manifest requested domain to floor
[platform/upstream/gptfdisk.git] / sgdisk.html
1 Content-type: text/html
2
3 <HTML><HEAD><TITLE>Manpage of SGDISK</TITLE>
4 </HEAD><BODY>
5 <H1>SGDISK</H1>
6 Section: GPT fdisk Manual (8)<BR>Updated: 0.8.5<BR><A HREF="#index">Index</A>
7 <A HREF="http://localhost/cgi-bin/man/man2html">Return to Main Contents</A><HR>
8
9 <A NAME="lbAB">&nbsp;</A>
10 <H2>NAME</H2>
11
12 sgdisk - Command-line GUID partition table (GPT) manipulator for Linux and Unix
13 <A NAME="lbAC">&nbsp;</A>
14 <H2>SYNOPSIS</H2>
15
16 <B>sgdisk </B>
17
18 [ options ]
19 <I>device</I>
20
21 <P>
22 <A NAME="lbAD">&nbsp;</A>
23 <H2>DESCRIPTION</H2>
24
25 GPT fdisk is a text-mode menu-driven package for creation and manipulation of
26 partition tables. It consists of two programs: the text-mode interactive
27 <B>gdisk</B> and the command-line <B>sgdisk</B>. Either program will
28 automatically convert an old-style Master Boot Record (MBR) partition table
29 or BSD disklabel stored without an MBR carrier partition to the newer Globally
30 Unique Identifier (GUID) Partition Table (GPT) format, or will load a GUID
31 partition table. This man page documents the command-line <B>sgdisk</B>
32 program.
33 <P>
34 Some advanced data manipulation and
35 recovery options require you to understand the distinctions between the
36 main and backup data, as well as between the GPT headers and the partition
37 tables. For information on MBR vs. GPT, as well as GPT terminology and
38 structure, see the extended <B>gdisk</B> documentation at
39 <I><A HREF="http://www.rodsbooks.com/gdisk/">http://www.rodsbooks.com/gdisk/</A></I> or consult Wikipedia.
40 <P>
41 The <B>sgdisk</B> program employs a user interface that's based entirely on
42 the command line, making it suitable for use in scripts or by experts who
43 want to make one or two quick changes to a disk. (The program may query the
44 user when certain errors are encountered, though.) The program's name is
45 based on <B>sfdisk</B>, but the user options of the two programs are
46 entirely different from one another.
47 <P>
48 Ordinarily, <B>sgdisk</B> operates on disk device files, such as
49 <I>/dev/sda</I> or <I>/dev/hda</I> under Linux, <I>/dev/disk0</I> under
50 Mac OS X, or <I>/dev/ad0</I> or <I>/dev/da0</I> under FreeBSD. The program
51 can also operate on disk image files, which can be either copies of whole
52 disks (made with <B>dd</B>, for instance) or raw disk images used by
53 emulators such as QEMU or VMWare. Note that only <I>raw</I> disk images
54 are supported; <B>sgdisk</B> cannot work on compressed or other advanced
55 disk image formats.
56 <P>
57 The MBR partitioning system uses a combination of cylinder/head/sector
58 (CHS) addressing and logical block addressing (LBA). The former is klunky
59 and limiting. GPT drops CHS addressing and uses 64-bit LBA mode
60 exclusively. Thus, GPT data structures, and therefore
61 <B>sgdisk</B>, do not need to deal with CHS geometries and all the problems
62 they create.
63 <P>
64 For best results, you should use an OS-specific partition table
65 program whenever possible. For example, you should make Mac OS X
66 partitions with the Mac OS X Disk Utility program and Linux partitions
67 with the Linux <B>gdisk</B>, <B>sgdisk</B>, or GNU Parted programs.
68 <P>
69 Upon start, <B>sgdisk</B> attempts to identify the partition type in use on
70 the disk. If it finds valid GPT data, <B>sgdisk</B> will use it. If
71 <B>sgdisk</B> finds a valid MBR or BSD disklabel but no GPT data, it will
72 attempt to convert the MBR or disklabel into GPT form. (BSD disklabels are
73 likely to have unusable first and/or final partitions because they overlap
74 with the GPT data structures, though.) GPT fdisk can identify, but not use
75 data in, Apple Partition Map (APM) disks, which are used on 680x0- and
76 PowerPC-based Macintoshes. If you specify any option that results in
77 changes to an MBR or BSD disklabel, <B>sgdisk</B> ignores those changes
78 unless the <I>-g</I> (<I>--mbrtogpt</I>), <I>-z</I> (<I>--zap</I>), or
79 <I>-Z</I> (<I>--zap-all</I>) option is used. If you use the <I>-g</I>
80 option, <B>sgdisk</B> replaces the MBR or disklabel with a GPT. <I>This
81 action is potentially dangerous!</I> Your system may become unbootable, and
82 partition type codes may become corrupted if the disk uses unrecognized
83 type codes. Boot problems are particularly likely if you're multi-booting
84 with any GPT-unaware OS.
85 <P>
86 The MBR-to-GPT conversion will leave at least one gap in the partition
87 numbering if the original MBR used logical partitions. These gaps are
88 harmless, but you can eliminate them by using the <I>-s</I> (<I>--sort</I>)
89 option, if you like. (Doing this may require you to update your
90 <I>/etc/fstab</I> file.)
91 <P>
92 When creating a fresh partition table, certain considerations may be in
93 order:
94 <P>
95 <DL COMPACT>
96 <DT><B>*</B>
97
98 <DD>
99 For data (non-boot) disks, and for boot disks used on BIOS-based computers
100 with GRUB as the boot loader, partitions may be created in whatever order
101 and in whatever sizes are desired.
102 <P>
103 <DT><B>*</B>
104
105 <DD>
106 Boot disks for EFI-based systems require an <I>EFI System
107 Partition</I> (<B>sgdisk</B> internal code 0xEF00) formatted as FAT-32.
108 The recommended size of this partition is between 100 and 300 MiB.
109 Boot-related files are stored here. (Note that GNU Parted identifies
110 such partitions as having the &quot;boot flag&quot; set.)
111 <P>
112 <DT><B>*</B>
113
114 <DD>
115 Some boot loaders for BIOS-based systems make use of a <I>BIOS Boot
116 Partition</I> (<B>sgdisk</B> internal code 0xEF02), in which the secondary
117 boot loader is stored, possibly without the benefit of a filesystem. This
118 partition can typically be quite small (roughly 32 to 200 KiB), but you
119 should consult your boot loader documentation for details.
120 <P>
121 <DT><B>*</B>
122
123 <DD>
124 If Windows is to boot from a GPT disk, a partition of type <I>Microsoft
125 Reserved</I> (<B>sgdisk</B>
126 internal code 0x0C01) is recommended. This partition should be about 128 MiB
127 in size. It ordinarily follows the EFI System Partition and immediately
128 precedes the Windows data partitions. (Note that GNU Parted creates all
129 FAT partitions as this type, which actually makes the partition unusable
130 for normal file storage in both Windows and Mac OS X.)
131 <P>
132 <DT><B>*</B>
133
134 <DD>
135 Some OSes' GPT utilities create some blank space (typically 128 MiB) after
136 each partition. The intent is to enable future disk utilities to use this
137 space. Such free space is not required of GPT disks, but creating it may
138 help in future disk maintenance.
139 <P>
140 </DL>
141 <A NAME="lbAE">&nbsp;</A>
142 <H2>OPTIONS</H2>
143
144 Some options take no arguments, others take one argument (typically a partition
145 number), and others take compound arguments with colon delimitation. For
146 instance, <I>-n</I> (<I>--new</I>) takes a partition number, a starting
147 sector number, and an ending sector number, as in <B>sgdisk -n 2:2000:50000
148 /dev/sdc</B>, which creates a new partition, numbered 2, starting at sector
149 2000 an ending at sector 50,000, on <I>/dev/sdc</I>.
150 <P>
151 Unrelated options may be combined; however, some such combinations will be
152 nonsense (such as deleting a partition and then changing its GUID type code).
153 <B>sgdisk</B> interprets options in the order in which they're entered, so
154 effects can vary depending on order. For instance, <B>sgdisk -s -d 2</B>
155 sorts the partition table entries and then deletes partition 2 from the
156 newly-sorted list; but <B>sgdisk -d 2 -s</B> deletes the original partition
157 2 and then sorts the modified partition table.
158 <P>
159 Error checking and opportunities to correct mistakes in <B>sgdisk</B> are
160 minimal. Although the program endeavors to keep the GPT data structures legal,
161 it does not prompt for verification before performing its actions. Unless you
162 require a command-line-driven program, you should use the interactive
163 <B>gdisk</B> instead of <B>sgdisk</B>, since <B>gdisk</B> allows you to
164 quit without saving your changes, should you make a mistake.
165 <P>
166 Although <B>sgdisk</B> is based on the same partition-manipulation code as
167 <B>gdisk</B>, <B>sgdisk</B> implements fewer features than its interactive
168 sibling. Options available in <B>sgdisk</B> are:
169 <P>
170 <DL COMPACT>
171 <DT><B>-a, --set-alignment=value</B>
172
173 <DD>
174 Set the sector alignment multiple. GPT fdisk aligns the start of partitions
175 to sectors that are multiples of this value, which defaults to 2048 on
176 freshly formatted disks. This alignment value is necessary to obtain optimum
177 performance with Western Digital Advanced Format and similar drives with larger
178 physical than logical sector sizes, with some types of RAID arrays, and
179 with SSD devices.
180 <P>
181 <DT><B>-A, --attributes=list|[partnum:show|or|nand|xor|=|set|clear|toggle|get[:bitnum|hexbitmask]]</B>
182
183 <DD>
184 View or set partition attributes. Use <I>list</I> to see defined (known)
185 attribute values. Omit the partition number (and even the device filename)
186 when using this option. The others require a partition number. The
187 <I>show</I> and <I>get</I> options show the current attribute settings
188 (all attributes or for a particular bit, respectively). The <I>or</I>,
189 <I>nand</I>, <I>xor</I>, <I>=</I>, <I>set</I>, <I>clear</I>, and
190 <I>toggle</I> options enable you to change the attribute bit value. The
191 <I>set</I>, <I>clear</I>, <I>toggle</I>, and <I>get</I> options work on a
192 bit number; the others work on a hexadecimal bit mask. For example, type 
193 <B>sgdisk -A 4:set:2 /dev/sdc</B> to set the bit 2 attribute (legacy BIOS
194 bootable) on partition 4 on <I>/dev/sdc</I>.
195 <P>
196 <DT><B>-b, --backup=file</B>
197
198 <DD>
199 Save partition data to a backup file. You can back up your current
200 in-memory partition table to a disk file using this option. The resulting
201 file is a binary file consisting of the protective MBR, the main GPT
202 header, the backup GPT header, and one copy of the partition table, in that
203 order. Note that the backup is of the current in-memory data structures, so
204 if you launch the program, make changes, and then use this option, the
205 backup will reflect your changes. If the GPT data structures are damaged,
206 the backup may not accurately reflect the damaged state; instead, they
207 will reflect GPT fdisk's first-pass interpretation of the GPT.
208 <P>
209 <DT><B>-c, --change-name=partnum:name</B>
210
211 <DD>
212 Change the GPT name of a partition. This name is encoded as a UTF-16
213 string, but proper entry and display of anything beyond basic ASCII values
214 requires suitable locale and font support. For the most part, Linux ignores
215 the partition name, but it may be important in some OSes. GPT fdisk sets
216 a default name based on the partition type code. If you want to set a name
217 that includes a space, enclose it in quotation marks, as in
218 <I>sgdisk -c 1:&quot;Sample Name&quot; /dev/sdb</I>. Note that the GPT name of a
219 partition is distinct from the filesystem name, which is encoded in the
220 filesystem's data structures.
221 <P>
222 <DT><B>-C, --recompute-chs</B>
223
224 <DD>
225 Recompute CHS values in protective or hybrid MBR. This option can sometimes
226 help if a disk utility, OS, or BIOS doesn't like the CHS values used by the
227 partitions in the protective or hybrid MBR. In particular, the GPT
228 specification requires a CHS value of 0xFFFFFF for over-8GiB partitions,
229 but this value is technically illegal by the usual standards. Some BIOSes
230 hang if they encounter this value. This option will recompute a more normal
231 CHS value -- 0xFEFFFF for over-8GiB partitions, enabling these BIOSes to
232 boot.
233 <P>
234 <DT><B>-d, --delete=partnum</B>
235
236 <DD>
237 Delete a partition. This action deletes the entry from the partition table
238 but does not disturb the data within the sectors originally allocated to
239 the partition on the disk. If a corresponding hybrid MBR partition exists,
240 <B>gdisk</B> deletes it, as well, and expands any adjacent 0xEE (EFI GPT)
241 MBR protective partition to fill the new free space.
242 <P>
243 <DT><B>-D, --display-alignment</B>
244
245 <DD>
246 Display current sector alignment value. Partitions will be created on multiples
247 of the sector value reported by this option. You can change the alignment value
248 with the -a option.
249 <P>
250 <DT><B>e, --move-second-header</B>
251
252 <DD>
253 Move backup GPT data structures to the end of the disk. Use this option if
254 you've added disks to a RAID array, thus creating a virtual disk with space
255 that follows the backup GPT data structures. This command moves the backup
256 GPT data structures to the end of the disk, where they belong.
257 <P>
258 <DT><B>-E, --end-of-largest</B>
259
260 <DD>
261 Displays the sector number of the end of the largest available block of
262 sectors on the disk. A script may store this value and pass it back as
263 part of <I>-n</I>'s option to create a partition. If no unallocated
264 sectors are available, this function returns the value 0.
265 <P>
266 <DT><B>-f, --first-in-largest</B>
267
268 <DD>
269 Displays the sector number of the start of the largest available block of
270 sectors on the disk. A script may store this value and pass it back as
271 part of <I>-n</I>'s option to create a partition. If no unallocated
272 sectors are available, this function returns the value 0. Note that this
273 parameter is blind to partition alignment; when you actually create a
274 partition, its start point might be changed from this value.
275 <P>
276 <DT><B>-F, --first-aligned-in-largest</B>
277
278 <DD>
279 Similar to <I>-f</I> (<I>--first-in-largest</I>), except returns the
280 sector number with the current alignment correction applied. Use this
281 function if you need to compute the actual partition start point rather
282 than a theoretical start point or the actual start point if you set the
283 alignment value to 1.
284 <P>
285 <DT><B>-g, --mbrtogpt</B>
286
287 <DD>
288 Convert an MBR or BSD disklabel disk to a GPT disk. As a safety measure, use of
289 this option is required on MBR or BSD disklabel disks if you intend to save your
290 changes, in order to prevent accidentally damaging such disks.
291 <P>
292 <DT><B>-G, --randomize-guids</B>
293
294 <DD>
295 Randomize the disk's GUID and all partitions' unique GUIDs (but not their
296 partition type code GUIDs). This function may be used after cloning a disk
297 in order to render all GUIDs once again unique.
298 <P>
299 <DT><B>-h, --hybrid</B>
300
301 <DD>
302 Create a hybrid MBR. This option takes from one to three partition numbers,
303 separated by colons, as arguments. The created hybrid MBR places an EFI GPT
304 (type 0xEE) partition first in the table, followed by the partition(s) you
305 specify. Their type codes are based on the GPT fdisk type codes divided by
306 0x0100, which is usually correct for Windows partitions. If the
307 active/bootable flag should be set, you must do so in another program, such
308 as <B>fdisk</B>. The <B>gdisk</B> program offers additional hybrid MBR
309 creation options.
310 <P>
311 <DT><B>-i, --info=partnum</B>
312
313 <DD>
314 Show detailed partition information. The summary information produced by
315 the <I>-p</I> command necessarily omits many details, such as the partition's
316 unique GUID and the translation of <B>sgdisk</B>'s
317 internal partition type code to a plain type name. The <I>-i</I> option
318 displays this information for a single partition.
319 <P>
320 <DT><B>-l, --load-backup=file</B>
321
322 <DD>
323 Load partition data from a backup file. This option is the reverse of the
324 <I>-b</I> option. Note that restoring partition data from anything
325 but the original disk is not recommended. This option will work even if the
326 disk's original partition table is bad; however, most other options on the
327 same command line will be ignored.
328 <P>
329 <DT><B>-L, --list-types</B>
330
331 <DD>
332 Display a summary of partition types. GPT uses a GUID to identify partition
333 types for particular OSes and purposes. For ease of data entry,
334 <B>sgdisk</B> compresses these into two-byte (four-digit hexadecimal)
335 values that are related to their equivalent MBR codes. Specifically, the
336 MBR code is multiplied by hexadecimal 0x0100. For instance, the code for
337 Linux swap space in MBR is 0x82, and it's 0x8200 in <B>gdisk</B>. A
338 one-to-one correspondence is impossible, though. Most notably, the codes
339 for all varieties of FAT and NTFS partition correspond to a single GPT code
340 (entered as 0x0700 in <B>sgdisk</B>). Some OSes use a single MBR code but
341 employ many more codes in GPT. For these, <B>sgdisk</B> adds code numbers
342 sequentially, such as 0xa500 for a FreeBSD disklabel, 0xa501 for FreeBSD
343 boot, 0xa502 for FreeBSD swap, and so on. Note that these two-byte codes
344 are unique to <B>gdisk</B> and <B>sgdisk</B>. This option does not require
345 you to specify a valid disk device filename.
346 <P>
347 <DT><B>-m, --gpttombr</B>
348
349 <DD>
350 Convert disk from GPT to MBR form. This option takes from one to four
351 partition numbers, separated by colons, as arguments. Their type codes are
352 based on the GPT fdisk type codes divided by 0x0100. If the active/bootable
353 flag should be set, you must do so in another program, such as <B>fdisk</B>.
354 The <B>gdisk</B> program offers additional MBR conversion options. It is not
355 possible to convert more than four partitions from GPT to MBR form or to
356 convert partitions that start above the 2TiB mark or that are larger than
357 2TiB.
358 <P>
359 <DT><B>-n, --new=partnum:start:end</B>
360
361 <DD>
362 Create a new partition. You enter a partition number, starting sector, and
363 an ending sector. Both start and end sectors can be specified in absolute
364 terms as sector numbers or as positions measured in kibibytes (K),
365 mebibytes (M), gibibytes (G), tebibytes (T), or pebibytes (P); for
366 instance, <I></I><B>40M</B> specifies a position 40MiB from the start of the
367 disk. You can specify locations relative to the start or end of the
368 specified default range by preceding the number by a '+' or '-' symbol, as
369 in <I></I><B>+2G</B> to specify a point 2GiB after the default start sector,
370 or <I></I><B>-200M</B> to specify a point 200MiB before the last available
371 sector. A start or end value of 0 specifies the default value, which is the
372 start of the largest available block for the start sector and the end of
373 the same block for the end sector. A partnum value of 0 causes the program
374 to use the first available partition number.
375 <P>
376 <DT><B>-N, --largest-new=num</B>
377
378 <DD>
379 Create a new partition that fills the largest available block of space on
380 the disk. Note that if used on a completely blank disk, this is likely to
381 result in a sector-moved warning, since the first available sector
382 (normally 34) doesn't fall on a 2048-sector boundary (the default for
383 alignment). You can use the <I>-a</I> (<I>--set-alignment</I>) option to
384 adjust the alignment, if desired. A num value of 0 causes the program to
385 use the first available partition number.
386 <P>
387 <DT><B>-o, --clear</B>
388
389 <DD>
390 Clear out all partition data. This includes GPT header data, all partition
391 definitions, and the protective MBR. Note that this operation will, like
392 most other operations, fail on a damaged disk. If you want to prepare a
393 disk you know to be damaged for GPT use, you should first wipe it with -Z
394 and then partition it normally. This option will work even if the
395 disk's original partition table is bad; however, most other options on the
396 same command line will be ignored.
397 <P>
398 <DT><B>-p, --print</B>
399
400 <DD>
401 Display basic partition summary data. This includes partition
402 numbers, starting and ending sector numbers, partition sizes,
403 <B>sgdisk</B>'s partition types codes, and partition names. For
404 additional information, use the <I>-i</I> (<I>--info</I>) option.
405 <P>
406 <DT><B>-P, --pretend</B>
407
408 <DD>
409 Pretend to make specified changes. In-memory GPT data structures are
410 altered according to other parameters, but changes are not written
411 to disk.
412 <P>
413 <DT><B>-r, --transpose</B>
414
415 <DD>
416 Swap two partitions' entries in the partition table. One or both partitions
417 may be empty, although swapping two empty partitions is pointless. For
418 instance, if partitions 1-4 are defined, transposing 1 and 5 results in a
419 table with partitions numbered from 2-5. Transposing partitions in this
420 way has no effect on their disk space allocation; it only alters their
421 order in the partition table.
422 <P>
423 <DT><B>-R, --replicate=second_device_filename</B>
424
425 <DD>
426 Replicate the main device's partition table on the specified second device.
427 Note that the replicated partition table is an exact copy, including all
428 GUIDs; if the device should have its own unique GUIDs, you should use the
429 -G option on the new disk.
430 <P>
431 <DT><B>-s, --sort</B>
432
433 <DD>
434 Sort partition entries. GPT partition numbers need not match the order of
435 partitions on the disk. If you want them to match, you can use this option.
436 Note that some partitioning utilities sort partitions whenever they make
437 changes. Such changes will be reflected in your device filenames, so you
438 may need to edit <I>/etc/fstab</I> if you use this option.
439 <P>
440 <DT><B>-t, --typecode=partnum:{hexcode|GUID}</B>
441
442 <DD>
443 Change a single partition's type code. You enter the type code using either
444 a two-byte hexadecimal number, as described earlier, or a fully-specified
445 GUID value, such as EBD0A0A2-B9E5-4433-87C0-68B6B72699C7.
446 <P>
447 <DT><B>-T, --transform-bsd=partnum</B>
448
449 <DD>
450 Transform BSD partitions into GPT partitions. This option works on BSD
451 disklabels held within GPT (or converted MBR) partitions. Converted
452 partitions' type codes are likely to need manual adjustment. <B>sgdisk</B>
453 will attempt to convert BSD disklabels stored on the main disk when
454 launched, but this conversion is likely to produce first and/or last
455 partitions that are unusable. The many BSD variants means that the
456 probability of <B>sgdisk</B> being unable to convert a BSD disklabel is
457 high compared to the likelihood of problems with an MBR conversion.
458 <P>
459 <DT><B>-u, --partition-guid=partnum:guid</B>
460
461 <DD>
462 Set the partition unique GUID for an individual partition. The GUID may be
463 a complete GUID or 'R' to set a random GUID.
464 <P>
465 <DT><B>-U, --disk-guid=guid</B>
466
467 <DD>
468 Set the GUID for the disk. The GUID may be a complete GUID or 'R' to set a
469 random GUID.
470 <P>
471 <DT><B>--usage</B>
472
473 <DD>
474 Print a brief summary of available options.
475 <P>
476 <DT><B>-v, --verify</B>
477
478 <DD>
479 Verify disk. This option checks for a variety of problems, such as
480 incorrect CRCs and mismatched main and backup data. This option does not
481 automatically correct most problems, though; for that, you must use options
482 on the recovery &amp; transformation menu. If no problems are found, this
483 command displays a summary of unallocated disk space. This option will work
484 even if the disk's original partition table is bad; however, most other
485 options on the same command line will be ignored.
486 <P>
487 <DT><B>-V, --version</B>
488
489 <DD>
490 Display program version information. This option may be used without
491 specifying a device filename.
492 <P>
493 <DT><B>-z, --zap</B>
494
495 <DD>
496 Zap (destroy) the GPT data structures and then exit. Use this option if you
497 want to repartition a GPT disk using <B>fdisk</B> or some other GPT-unaware
498 program. This option destroys only the GPT data structures; it leaves the
499 MBR intact. This makes it useful for wiping out GPT data structures after a
500 disk has been repartitioned for MBR using a GPT-unaware utility; however,
501 there's a risk that it will damage boot loaders or even the start of the
502 first or end of the last MBR partition. If you use it on a valid GPT disk,
503 the MBR will be left with an inappropriate EFI GPT (0xEE) partition
504 definition, which you can delete using another utility.
505 <P>
506 <DT><B>-Z, --zap-all</B>
507
508 <DD>
509 Zap (destroy) the GPT and MBR data structures and then exit. This option
510 works much like <I>-z</I>, but as it wipes the MBR as well as the GPT, it's
511 more suitable if you want to repartition a disk after using this option,
512 and completely unsuitable if you've already repartitioned the disk.
513 <P>
514 <DT><B>-?, --help</B>
515
516 <DD>
517 Print a summary of options.
518 <P>
519 </DL>
520 <A NAME="lbAF">&nbsp;</A>
521 <H2>RETURN VALUES</H2>
522
523 <B>sgdisk</B> returns various values depending on its success or failure:
524 <P>
525 <DL COMPACT>
526 <DT><B>0</B>
527
528 <DD>
529 Normal program execution
530 <P>
531 <DT><B>1</B>
532
533 <DD>
534 Too few arguments
535 <P>
536 <DT><B>2</B>
537
538 <DD>
539 An error occurred while reading the partition table
540 <P>
541 <DT><B>3</B>
542
543 <DD>
544 Non-GPT disk detected and no <I>-g</I> option
545 <P>
546 <DT><B>4</B>
547
548 <DD>
549 An error prevented saving changes
550 <P>
551 <DT><B>5</B>
552
553 <DD>
554 An error occurred while reading standard input (should never occur with
555 sgdisk, but may with gdisk)
556 <P>
557 <DT><B>8</B>
558
559 <DD>
560 Disk replication operation (-R) failed
561 <P>
562 </DL>
563 <A NAME="lbAG">&nbsp;</A>
564 <H2>BUGS</H2>
565
566 As of May 2012 (version 0.8.5), <B>sgdisk</B>
567 should be considered beta software. Known bugs and limitations include:
568 <P>
569 <DL COMPACT>
570 <DT><B>*</B>
571
572 <DD>
573 The program compiles correctly only on Linux, FreeBSD, and Mac OS X. Linux
574 versions for x86-64 (64-bit), x86 (32-bit), and PowerPC (32-bit) have been
575 tested, with the x86-64 version having seen the most testing.
576 <P>
577 <DT><B>*</B>
578
579 <DD>
580 The FreeBSD version of the program can't write changes to the partition
581 table to a disk when existing partitions on that disk are mounted. (The
582 same problem exists with many other FreeBSD utilities, such as
583 <B>gpt</B>, <B>fdisk</B>, and <B>dd</B>.) This limitation can be overcome
584 by typing <B>sysctl kern.geom.debugflags=16</B> at a shell prompt.
585 <P>
586 <DT><B>*</B>
587
588 <DD>
589 The fields used to display the start and end sector numbers for partitions
590 in the <I>-p</I> option are 14 characters wide. This translates to a limitation
591 of about 45 PiB. On larger disks, the displayed columns will go out of
592 alignment.
593 <P>
594 <DT><B>*</B>
595
596 <DD>
597 The program can load only up to 128 partitions (4 primary partitions and
598 124 logical partitions) when converting from MBR format. This limit can
599 be raised by changing the <I>#define MAX_MBR_PARTS</I> line in the
600 <I>basicmbr.h</I> source code file and recompiling; however, such a change
601 will require using a larger-than-normal partition table. (The limit
602 of 128 partitions was chosen because that number equals the 128 partitions
603 supported by the most common partition table size.)
604 <P>
605 <DT><B>*</B>
606
607 <DD>
608 Converting from MBR format sometimes fails because of insufficient space at
609 the start or (more commonly) the end of the disk. Resizing the partition
610 table (using the 's' option in the experts' menu) can sometimes overcome
611 this problem; however, in extreme cases it may be necessary to resize a
612 partition using GNU Parted or a similar tool prior to conversion with
613 <B>gdisk</B>.
614 <P>
615 <DT><B>*</B>
616
617 <DD>
618 MBR conversions work only if the disk has correct LBA partition
619 descriptors. These descriptors should be present on any disk over 8 GiB in
620 size or on smaller disks partitioned with any but very ancient software.
621 <P>
622 <DT><B>*</B>
623
624 <DD>
625 BSD disklabel support can create first and/or last partitions that overlap
626 with the GPT data structures. This can sometimes be compensated by
627 adjusting the partition table size, but in extreme cases the affected
628 partition(s) may need to be deleted.
629 <P>
630 <DT><B>*</B>
631
632 <DD>
633 Because of the highly variable nature of BSD disklabel structures,
634 conversions from this form may be unreliable -- partitions may be dropped,
635 converted in a way that creates overlaps with other partitions, or
636 converted with incorrect start or end values. Use this feature with
637 caution!
638 <P>
639 <DT><B>*</B>
640
641 <DD>
642 Booting after converting an MBR or BSD disklabel disk is likely to be
643 disrupted. Sometimes re-installing a boot loader will fix the problem, but
644 other times you may need to switch boot loaders. Except on EFI-based
645 platforms, Windows through at least Windows 7 RC doesn't support booting
646 from GPT disks. Creating a hybrid MBR (using the 'h' option on the recovery &amp;
647 transformation menu) or abandoning GPT in favor of MBR may be your only
648 options in this case.
649 <P>
650 </DL>
651 <P>
652
653 <P>
654 <A NAME="lbAH">&nbsp;</A>
655 <H2>AUTHORS</H2>
656
657 Primary author: Roderick W. Smith (<A HREF="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com</A>)
658 <P>
659 Contributors:
660 <P>
661 * Yves Blusseau (<A HREF="mailto:1otnwmz02@sneakemail.com">1otnwmz02@sneakemail.com</A>)
662 <P>
663 * David Hubbard (<A HREF="mailto:david.c.hubbard@gmail.com">david.c.hubbard@gmail.com</A>)
664 <P>
665 * Justin Maggard (<A HREF="mailto:justin.maggard@netgear.com">justin.maggard@netgear.com</A>)
666 <P>
667 * Dwight Schauer (<A HREF="mailto:dschauer@ti.com">dschauer@ti.com</A>)
668 <P>
669 * Florian Zumbiehl (<A HREF="mailto:florz@florz.de">florz@florz.de</A>)
670 <P>
671 <P>
672 <A NAME="lbAI">&nbsp;</A>
673 <H2>SEE ALSO</H2>
674
675 <B>cfdisk (8)</B>,
676 <B>cgdisk (8)</B>,
677 <B>fdisk (8)</B>,
678 <B>gdisk (8)</B>,
679 <B>mkfs (8)</B>,
680 <B>parted (8)</B>,
681 <B>sfdisk (8)</B>
682 <B>fixparts (8)</B>
683 <P>
684 <I><A HREF="http://en.wikipedia.org/wiki/GUID_Partition_Table">http://en.wikipedia.org/wiki/GUID_Partition_Table</A></I>
685 <P>
686 <I><A HREF="http://developer.apple.com/technotes/tn2006/tn2166.html">http://developer.apple.com/technotes/tn2006/tn2166.html</A></I>
687 <P>
688 <I><A HREF="http://www.rodsbooks.com/gdisk/">http://www.rodsbooks.com/gdisk/</A></I>
689 <P>
690 <A NAME="lbAJ">&nbsp;</A>
691 <H2>AVAILABILITY</H2>
692
693 The <B>sgdisk</B> command is part of the <I>GPT fdisk</I> package and is
694 available from Rod Smith.
695 <P>
696
697 <HR>
698 <A NAME="index">&nbsp;</A><H2>Index</H2>
699 <DL>
700 <DT><A HREF="#lbAB">NAME</A><DD>
701 <DT><A HREF="#lbAC">SYNOPSIS</A><DD>
702 <DT><A HREF="#lbAD">DESCRIPTION</A><DD>
703 <DT><A HREF="#lbAE">OPTIONS</A><DD>
704 <DT><A HREF="#lbAF">RETURN VALUES</A><DD>
705 <DT><A HREF="#lbAG">BUGS</A><DD>
706 <DT><A HREF="#lbAH">AUTHORS</A><DD>
707 <DT><A HREF="#lbAI">SEE ALSO</A><DD>
708 <DT><A HREF="#lbAJ">AVAILABILITY</A><DD>
709 </DL>
710 <HR>
711 This document was created by
712 <A HREF="http://localhost/cgi-bin/man/man2html">man2html</A>,
713 using the manual pages.<BR>
714 Time: 15:38:43 GMT, May 30, 2012
715 </BODY>
716 </HTML>