OSDN Git Service

doc: mention the "bios_grub" flag
[android-x86/external-parted.git] / doc / parted.texi
1 \input texinfo    @c -*-texinfo-*-
2 @c %**start of header
3 @setfilename parted.info
4 @settitle Parted User's Manual
5 @include version.texi
6 @paragraphindent 2
7 @c %**end of header
8
9 @ifinfo
10 This file documents the use of GNU Parted, a program for creating,
11 resizing, checking and copy partitions and file systems on them.
12 @end ifinfo
13
14 @ifnottex @c texi2pdf don't understand copying and insertcopying ???
15 @c modifications must also be done in the titlepage
16 @copying
17 Copyright @copyright{} 1999-2009 Free Software Foundation, Inc.
18
19 Permission is granted to copy, distribute and/or modify this document
20 under the terms of the GNU Free Documentation License, Version 1.1 or
21 any later version published by the Free Software Foundation; with no
22 Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
23 Texts.  A copy of the license is included in the section entitled ``GNU
24 Free Documentation License''.
25 @end copying
26 @c WTF does the info get the copying output and the plaintext output not ????
27 @ifplaintext
28 @insertcopying
29 @end ifplaintext
30 @end ifnottex
31
32 @direntry
33 * parted: (parted).                         GNU partitioning software
34 @end direntry
35
36 @titlepage
37 @title GNU Parted User Manual
38 @subtitle GNU Parted, version @value{VERSION}, @value{UPDATED}
39 @author Andrew Clausen @email{clausen@@gnu.org}
40 @author Richard M. Kreuter @email{kreuter@@anduril.rutgers.edu}
41 @author Leslie Patrick Polzer @email{polzer@@gnu.org}
42
43
44 @c @page
45 @c @vskip 0pt plus 1filll
46
47 @c modifications must also be done in the copying block
48 Copyright @copyright{} 1999-2009 Free Software Foundation, Inc.
49
50 Permission is granted to copy, distribute and/or modify this document
51 under the terms of the GNU Free Documentation License, Version 1.1 or
52 any later version published by the Free Software Foundation; with no
53 Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
54 Texts.  A copy of the license is included in the section entitled ``GNU
55 Free Documentation License''.
56 @end titlepage
57
58 @ifnottex
59 @node Top
60 @top GNU Parted User Manual
61
62 @c WTF doesn't texi2html include the titlepage?
63 @ifhtml
64 @insertcopying
65 @end ifhtml
66
67 This document describes the use of GNU Parted, a program for creating,
68 destroying, resizing, checking and copying hard drive partitions, and
69 the file systems on them.
70
71 This document applies roughly to version @strong{@value{VERSION}} of GNU Parted.
72
73 The original version was written by Andrew Clausen in text format.
74 Richard M. Kreuter translated it into Texinfo format in 2002, to be heavily
75 edited by Leslie P. Polzer in 2006.
76 @end ifnottex
77
78 @shortcontents
79
80 @menu
81 * Introduction::                Overview
82 * Using Parted::                Partitioning a Hard Drive
83 * Related information::         Further reading on related topics
84 * Copying This Manual::         How to make copies of this manual
85 * History::                     This manual's history
86 @ifnotplaintext
87 * Index::                       Index of referenced concepts
88 @end ifnotplaintext
89 @end menu
90
91 @node    Introduction
92 @chapter Introduction
93
94 @menu
95 * Overview::                    GNU Parted and prerequisite knowledge
96 * Software Required::           GNU Parted's software dependencies
97 * Supported Platforms::         Where you can use GNU Parted
98 * License::                     What you may and may not do with GNU Parted
99 * Compiling::                   How to build GNU Parted
100 * Static binaries::             How to get and use a static version of GNU
101                                 Parted
102 @end menu
103
104 @node Overview
105 @section Overview of GNU Parted
106 @cindex description of parted
107 @cindex overview
108 @cindex parted description
109 @cindex bugs, reporting
110 @cindex reporting bugs
111 @cindex contacting developers
112
113 GNU Parted is a program for creating, destroying, resizing, checking
114 and copying partitions, and the file systems on them.
115
116 This is useful for creating space for new operating systems, for
117 reorganizing disk usage, for copying data between hard disks and for
118 ``disk imaging'' --- replicating an installation on another computer.
119
120 This documentation is written with the assumption that the reader
121 has some understanding of partitioning and file systems.  If you want to
122 learn more about these, the upcoming GNU Storage Guide is recommended
123 reading.
124
125 GNU Parted was designed to minimize the chance of data loss.  For
126 example, it was designed to avoid data loss during interruptions (like
127 power failure) and performs many safety checks.  However, there could
128 be bugs in GNU Parted, so you should back up your important files before
129 running Parted.
130 Also note that reiserfs support relies on libreiserfs, which does not
131 fulfil the aforementioned requirement.  The same holds for any external
132 tools like @kbd{ntfsresize}.
133
134 The GNU Parted homepage is @uref{http://www.gnu.org/software/parted}.  The
135 library and frontend themselves can be downloaded from
136 @uref{ftp://ftp.gnu.org/gnu/parted}.
137 You can also find a listing of mailing lists, notes for contributing and
138 more useful information on the web site.
139
140 Please send bug reports to @email{bug-parted@@gnu.org}.  When sending bug
141 reports, please include the version of GNU Parted.
142 Please include the output from these commands (for disk @file{/dev/hda}):
143
144 @example
145 @group
146 # @kbd{parted /dev/hda print unit s print unit chs print}
147 @end group
148 @end example
149
150 Feel free to ask for help on this list --- just check that your question
151 isn't answered here first.  If you don't understand the documentation,
152 please tell us, so we can explain it better.  General philosophy is:
153 if you need to ask for help, then something needs to be fixed so you
154 (and others) don't need to ask for help.
155
156 Also, we'd love to hear your ideas :-)
157
158 @node Software Required
159 @section Software Required for the use of Parted
160 @cindex software dependencies
161 @cindex required software
162 @cindex libuuid
163 @cindex e2fsprogs
164 @cindex readline
165 @cindex gettext
166
167 If you're installing or compiling Parted yourself, you'll need to
168 have some other programs installed.  If you are compiling Parted,
169 you will need both the normal and devel packages of these programs
170 installed:
171
172 @itemize @bullet
173
174 @item libuuid, part of the e2fsprogs package.  If you don't have this,
175 you can get it from:
176
177         @uref{http://web.mit.edu/tytso/www/linux/e2fsprogs.html}
178
179 If you want to compile Parted and e2fsprogs, note that you will need to
180 @kbd{make install} and @kbd{make install-libs} e2fsprogs.
181
182 @item GNU Readline (optional), available from
183
184         @uref{ftp://ftp.gnu.org/gnu/readline}
185
186 If you are compiling Parted, and you don't have readline, you can
187 disable Parted's readline support with the @kbd{--disable-readline}
188 option for @command{configure}.
189
190 @item GNU gettext (or compatible software) for compilation, if
191 internationalisation support is desired.
192
193         @uref{ftp://ftp.gnu.org/gnu/gettext}
194
195 @item libreiserfs, if you want reiserfs support:
196
197         @uref{http://reiserfs.osdn.org.ua}
198
199 Note that parted will automatically detect libreiserfs at runtime, and enable
200 reiserfs support.  libreiserfs is new, and hasn't been widely tested yet.
201
202 @end itemize
203
204 @node Supported Platforms
205 @section Platforms on which GNU Parted runs
206 @cindex supported platforms
207 @cindex platforms, supported
208
209 Hopefully, this list will grow a lot.  If you do not have one of these
210 platforms, then you can use a rescue disk and a static binary of GNU Parted.
211 @xref{Static binaries}.
212
213 @table @asis
214 @item GNU/Linux
215 Linux versions 2.0 and up, on Alpha, x86 PCs, PC98, Macintosh PowerPC, Sun hardware.
216
217 @item GNU/Hurd
218 @end table
219
220 GNU libc 2.1 or higher is required.  You can probably use older versions
221 by using the @samp{--disable-nls} option. @xref{Compiling, Building GNU
222 Parted}. (Note: I think we have now dropped this requirement.  TODO:
223 check if libc 2.0 works!)
224
225 @node License
226 @section Terms of distribution for GNU Parted
227 @cindex license terms
228 @cindex terms of distribution
229 @cindex gnu gpl
230 @cindex gpl
231
232 GNU Parted is free software, covered by the GNU General Public License
233 Version 2.  This should have been included with the Parted distribution,
234 in the COPYING file.  If not, write to the Free Software Foundation,
235 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
236
237 Libparted is considered part of GNU Parted.  It is covered by the GNU
238 General Public License.  It is NOT released under the GNU Lesser General
239 Public License (LGPL).
240
241 @node Compiling
242 @section Building GNU Parted
243 @cindex compiling parted
244 @cindex building parted
245
246 If you want to compile GNU Parted, this is generally done with:
247
248 @example
249 @group
250 $ @kbd{./configure}
251 $ @kbd{make}
252 @end group
253 @end example
254
255 However, there are a few options for @command{configure}:
256
257 @table @code
258 @item --without-readline
259 turns off use of readline.  This is useful for making rescue disks,
260 etc., where few libraries are available.
261
262 @item --disable-debug
263 don't include assertions
264
265 @item --disable-dynamic-loading
266 disables dynamic loading of some libraries (only libreiserfs for now,
267 although we hope to expand this).  Dynamic loading is useful because it
268 allows you to reuse libparted shared libraries even when you don't know
269 if some libraries will be available.  It has a small overhead (mainly
270 linking with libdl), so it may be useful to disable it on bootdisks if
271 you don't need the flexibility.
272
273 @item --disable-fs
274 disable all file system support
275
276 @item --disable-nls
277 turns off native language support.  This is useful for use with old
278 versions of glibc, or a trimmed down version of glibc suitable for
279 rescue disks.
280
281 @item --disable-shared
282 turns off shared libraries.  This may be necessary for use with old
283 versions of GNU libc, if you get a compile error about a ``spilled
284 register''.  Also useful for boot/rescue disks.
285
286 @item --disable-Werror
287 ignore warning messages in compilation
288
289 @item --enable-discover-only
290 support only reading/probing (reduces size considerably)
291
292 @item --enable-mtrace
293 enable malloc() debugging
294
295 @item --enable-read-only
296 disable writing (for debugging)
297
298 @end table
299
300 @node Static binaries
301 @section Using static binaries of GNU Parted
302 @cindex static binary
303 @cindex unsupported platforms
304 @cindex resizing root device
305
306 @subsection Introduction
307 If you want to run GNU Parted on a machine without GNU/Linux installed, or you
308 want to resize a root or boot partition, you will need to use a boot disk.
309
310 Special boot disk images for GNU Parted used to be available, but with the
311 emergence of a plethora of rescue disks and Live CDs that all
312 include GNU Parted this is no longer necessary.
313 However, please note that these disks often ship with out-of-date
314 versions of Parted.  To compensate for this a static binary
315 of the latest GNU Parted version is available, which you can use thus:
316
317 @c There should be instructions for CD and USB here.
318
319 @subsection Creating the Parted disk
320 @enumerate
321 @item Boot your system
322
323 @item Download @file{parted-static-VERSION.tgz} from @uref{ftp://ftp.gnu.org/gnu/parted/static}
324 @item Unpack the tarball, resulting in a file called ``parted.static".
325
326 @item Insert a floppy.
327
328 @item Do a low-level format on it (on GNU/Linux this can be achieved with
329       the tool ``fdformat" from the ``util-linux" package.
330       This is basically a sanity check because floppy disks often
331       contain bad blocks.
332
333 @item Create a file system. Example:
334
335 @example
336 $ @kbd{parted /dev/fd0 mklabel loop mkpartfs ext2 0 1.4}
337 @end example
338
339 @item Mount the floppy disk, e.g.,
340
341 @example
342 $ @kbd{mount -t ext2 /dev/fd0 /mnt/floppy}
343 @end example
344
345 @item Copy @file{parted.static} to the floppy, e.g.,
346
347 @example
348 $ @kbd{cp parted.static /mnt/floppy}
349 @end example
350
351 @item Unmount the floppy, e.g.,
352
353 @example
354 $ @kbd{umount /mnt/floppy}
355 @end example
356 @end enumerate
357
358 @subsection Using the Parted disk
359 @enumerate
360 @item Choose a rescue disk that suits you.
361
362 @item Boot off your rescue disk.  Mount the disk you copied Parted onto.
363
364 @item Run Parted.  For example,
365
366 @example
367 # @kbd{cd /mnt/floppy}
368 # @kbd{./parted-static}
369 @end example
370 @end enumerate
371
372 @node    Using Parted
373 @chapter Using Parted
374 @cindex commands
375
376 @menu
377 * Partitioning::                    Disk partitioning in context
378 * Running Parted::                  Partitioning with Parted
379 * Invoking Parted::                 Parted's invocation options and commands
380 * Command explanations::            Full explanation of parted's commands
381 @end menu
382
383 @node Partitioning
384 @section Introduction to Partitioning
385 @cindex partitioning overview
386
387 Unfortunately, partitioning your disk is rather complicated.  This is
388 because there are interactions between many different systems that need
389 to be taken into consideration.
390
391 This manual used to introduce the reader to these systems and their
392 working.  This content has moved to the GNU Storage Guide.
393
394 @node Running Parted
395 @section Using GNU Parted
396 @cindex modes of use
397
398 Parted has two modes: command line and interactive.  Parted should
399 always be started with:
400
401 @example
402 # @kbd{parted @var{device}}
403 @end example
404
405 @noindent where @var{device} is the hard disk device to edit.  (If you're
406 lazy and omit the DEVICE argument, Parted will attempt to guess which
407 device you want.)
408
409 In command line mode, this is followed by one or more commands.  For
410 example:
411
412 @example
413 # @kbd{parted /dev/sda resize 1 52Mb 104Mb mkfs 2 fat16}
414 @end example
415
416 @noindent Options (like @kbd{--help}) can only be specified on the
417 command line.
418
419 In interactive mode, commands are entered one at a time at a prompt, and
420 modify the disk immediately.  For example:
421
422 @example
423 (parted) @kbd{resize 1 52.0005Mb 104.5Mb}
424 (parted) @kbd{mkfs 2 fat16}
425 @end example
426
427 @noindent Unambiguous abbreviations are allowed.  For example, you can
428 type ``p'' instead of ``print'', and ``resi'' instead of ``resize''.
429 Commands can be typed either in English, or your native language (if
430 your language has been translated).  This may create ambiguities.
431 Commands are case-insensitive.
432
433 Numbers indicating partition locations can be whole numbers or decimals.
434 The suffix selects the unit, which may be one of those described in
435 @ref{unit}, except CHS and compact.  If no suffix is given, then the default
436 unit is assumed.  Negative numbers count back from the end of the disk,
437 with ``-1s'' indicating the end of the disk.  Parted will compute sensible
438 ranges for the locations you specify (e.g. a range of +/- 500 MB when you
439 specify the location in ``G''). Use the sector unit ``s'' to specify exact
440 locations.
441
442 If you don't give a parameter to a command, Parted will prompt you for it.
443 For example:
444
445 @example
446 (parted) @kbd{resize 1}
447 Start? @kbd{0Gb}
448 End? @kbd{40Gb}
449 @end example
450
451 Parted will always warn you before doing something that is potentially
452 dangerous, unless the command is one of those that is inherently
453 dangerous (viz., rm, mklabel and mkfs).  For example, if you attempt to
454 shrink a partition ``too much'' (i.e., by more than the free space
455 available), Parted will automatically reduce the shrinkage so that the
456 partition is the smallest it can be without losing data.  If this size is
457 significantly different from the size requested, Parted will warn you.
458 Since many partitioning systems have complicated constraints, Parted will
459 usually do something slightly different to what you asked.  (For example,
460 create a partition starting at 10.352Mb, not 10.4Mb)
461 If the calculated values differ too much, Parted will ask you for
462 confirmation.
463
464 Currently ext3 filesystem functionality does not work. To manage ext3 type
465 filesystems use tools like resize2fs or mke2fs.  Note that the currently
466 supported ext2 filesystem will be deprecated once ext3 support is finalized.
467 Further note that ext3 support will have limited functionality that is yet
468 to be defined.  Use tools like resize2fs (8) and mke2fs (8) to manage these
469 types of filesystems.
470
471
472 @node Invoking Parted
473 @section Command Line Options
474 @cindex options at invocation
475 @cindex commands, overview
476 @cindex invocation options
477
478 When invoked from the command line, Parted supports the following syntax:
479
480 @example
481 # @kbd{parted [@var{option}] @var{device} [@var{command} [@var{argument}]]}
482 @end example
483
484 Available options and commands follow.  For detailed explanations of the
485 use of Parted commands, see @ref{Command explanations}. Options begin
486 with a hyphen, commands do not:
487
488 Options:
489
490 @table @samp
491 @item -h
492 @itemx --help
493 display a help message
494
495 @item -s
496 @itemx --script
497 never prompt the user
498
499 @item -v
500 @itemx --version
501 display the version
502 @end table
503
504 @node Command explanations
505 @section Parted Session Commands
506 @cindex command syntax
507 @cindex detailed command listing
508 @cindex commands, detailed listing
509
510 GNU Parted provides the following commands:
511
512 @menu
513 * check::
514 * cp::
515 * help::
516 * mklabel::
517 * mkfs::
518 * mkpart::
519 * mkpartfs::
520 * move::
521 * name::
522 * print::
523 * quit::
524 * rescue::
525 * resize::
526 * rm::
527 * select::
528 * set::
529 * unit::
530 @end menu
531
532 @node check
533 @subsection check
534 @cindex check, command description
535 @cindex command description, check
536
537 @deffn Command check @var{number}
538
539 Checks if the file system on partition @var{number} has
540 any errors.
541
542 Example:
543
544 @example
545 (parted) @kbd{check 1}
546 @end example
547
548 Check the file system on partition 1.
549 @end deffn
550
551 @node cp
552 @subsection cp
553 @cindex cp, command description
554 @cindex command description, cp
555
556 @deffn Command cp [@var{from-device}] @var{from-number} @var{to-number}
557
558 Copies the file system on the partition @var{from-number} to partition
559 @var{to-number}, deleting the original contents of the destination
560 partition.
561
562 An optional device parameter, @var{from-device} can be given, which
563 specifies which device the source partition is on.
564
565 Supported file systems:
566 @itemize @bullet
567 @item ext2
568 (provided the destination partition is larger than the source partition)
569
570 @item fat16, fat32
571 @item linux-swap
572 (equivalent to mkswap on destination partition)
573 @item reiserfs (if libreiserfs is installed)
574
575 @end itemize
576
577 Example:
578
579 @example
580 (parted) @kbd{cp /dev/hdb 2 3}
581 @end example
582
583 @c FIXME: this doesn't format right.
584 Copy partition 2 of @file{/dev/hdb} (i.e., @file{/dev/hdb2}) to partition
585 on 3, on the device Parted was loaded with, destroying the original
586 contents of partition 3.
587 @end deffn
588
589 @node help
590 @subsection help
591 @cindex help, command description
592 @cindex command description, help
593
594 @deffn Command help [@var{command}]
595
596 Prints general help, or help on @var{command}.
597
598 Example:
599
600 @example
601 (parted) @kbd{help resize}
602 @end example
603
604 Print help for the resize command.
605 @end deffn
606
607 @node mklabel
608 @subsection mklabel
609 @cindex mklabel, command description
610 @cindex command description, mkindex
611
612 @deffn Command mklabel @var{label-type}
613
614 Creates a new disk label, of type @var{label-type}.  The new disk label
615 will have no partitions.  This command (normally) won't technically
616 destroy your data, but it will make it basically unusable,
617 and you will need to use the rescue command (@pxref{Related information})
618 to recover any partitions.
619 Parted works on all partition tables.  @footnote{Everyone seems to
620 have a different word for ``disk label'' --- these are all the same
621 thing: partition table, partition map.}
622
623 @var{label-type} must be one of these supported disk labels:
624 @itemize @bullet
625 @item bsd
626 @item loop (raw disk access)
627 @item gpt
628 @item mac
629 @item msdos
630 @item pc98
631 @item sun
632 @end itemize
633
634 Example:
635
636 @example
637 (parted) @kbd{mklabel msdos}
638 @end example
639
640 Create an MS-DOS disk label.  This is still the most common disk label for
641 PCs.
642 @end deffn
643
644 @node mkfs
645 @subsection mkfs
646 @cindex mkfs, command description
647 @cindex command description, mkfs
648
649 @deffn Command mkfs @var{number} @var{fs-type}
650
651 Makes a file system @var{fs-type} on partition @var{number}, destroying
652 all data that resides on that partition.
653
654 Supported file systems:
655 @itemize @bullet
656 @item ext2
657 @item fat16, fat32
658 @item linux-swap
659 @item reiserfs (if libreiserfs is installed)
660 @end itemize
661
662 Example:
663
664 @example
665 (parted) @kbd{mkfs 2 fat32}
666 @end example
667
668 Make a @var{fat32} file system on partition 2.
669 @end deffn
670
671 @node mkpart
672 @subsection mkpart
673 @cindex mkpart, command description
674 @cindex command description, mkpart
675
676 @deffn Command mkpart [@var{part-type} @var{fs-type} @var{name}] @var{start} @var{end}
677
678 Creates a new partition, @emph{without} creating a new file system on
679 that partition.  This is useful for creating partitions for file systems
680 (or LVM, etc.) that Parted doesn't support.  You may specify a file
681 system type, to set the appropriate partition code in the partition
682 table for the new partition.  @var{fs-type} is required for data
683 partitions (i.e., non-extended partitions).  @var{start} and @var{end}
684 are the offset from the beginning of the disk, that is, the ``distance''
685 from the start of the disk.
686
687 @var{part-type} is one of @samp{primary}, @samp{extended} or @samp{logical},
688 and may be specified only with @samp{msdos} or @samp{dvh} partition tables.
689 A @var{name} must be specified for a @samp{gpt} partition table.
690 Neither @var{part-type} nor @var{name} may be used with a @samp{sun}
691 partition table.
692
693 @var{fs-type} must be one of these supported file systems:
694 @itemize @bullet
695 @item ext2
696 @item fat16, fat32
697 @item hfs, hfs+, hfsx
698 @item linux-swap
699 @item NTFS
700 @item reiserfs
701 @item ufs
702 @end itemize
703
704 Example:
705
706 @example
707 (parted) @kbd{mkpart logical 0.0 692.1}
708 @end example
709
710 Create a logical partition that will contain an ext2 file system.  The
711 partition will start at the beginning of the disk, and end 692.1
712 megabytes into the disk.
713
714 @end deffn
715
716 @node mkpartfs
717 @subsection mkpartfs
718 @cindex mkpartfs, command description
719 @cindex command description, mkpartfs
720
721 @deffn Command mkpartfs @var{part-type} @var{fs-type} @var{start} @var{end}
722
723 Creates a new partition of type @var{part-type} with a new file system
724 of type @var{fs-type} on it.  The new partition will start @var{start}
725 megabytes, and end @var{end} megabytes from the beginning of the disk.
726 Do not use this command to recover a deleted partition (use mkpart
727 instead).  Using this command is discouraged.  Instead use mkpart
728 to create an empty partition, and then use external tools like mke2fs (8)
729 to create the filesystem.
730
731 @var{part-type} is one of: primary, extended, logical.  Extended and logical
732 are only used for msdos and dvh disk labels.
733
734 @var{fs-type} must be one of these supported file systems:
735 @itemize @bullet
736 @item ext2
737 @item fat16, fat32
738 @item linux-swap
739 @item reiserfs (if libreiserfs is installed)
740 @end itemize
741
742 Example:
743
744 @example
745 (parted) @kbd{mkpartfs logical ext2 440 670}
746 @end example
747
748 Make a logical partition and write an ext2 file system, starting 440
749 megabytes and ending 670 megabytes from the beginning of the disk.
750 @end deffn
751
752 @node move
753 @subsection move
754 @cindex move, command description
755 @cindex command description, move
756
757 @deffn Command move @var{number} @var{start} @var{end}
758
759 Moves partition on the disk, by moving its beginning to @var{start}.
760 You can't move a partition so that the old and new positions overlap.
761 That is, you can only move partitions into free space.  If you want
762 to resize a partition in-place, use @command{resize}.
763
764 Move never changes the partition number.
765
766 Supported file systems:
767 @itemize @bullet
768 @item ext2
769 (provided the destination partition is larger than the source partition)
770
771 @item fat16, fat32
772
773 @item linux-swap
774
775 @item reiserfs (if libreiserfs is installed)
776 @end itemize
777
778 Example:
779
780 @example
781 (parted) move 2 150M 500M
782 @end example
783
784 Move the partition numbered 2 so that it begins 150 megabytes from the start of
785 the disk, and ends 500 megabytes from the start.
786
787 @end deffn
788
789 @node name
790 @subsection name
791 @cindex name, command description
792 @cindex command description, name
793
794 @deffn Command name @var{number} @var{name}
795
796 Sets the name for the partition @var{number} (GPT, Mac, MIPS and PC98 only).
797 The name can be placed in quotes.
798
799 Example:
800
801 @example
802 (parted) @kbd{name 2 'Secret Documents'}
803 @end example
804
805 Set the name of partition 2 to `Secret Documents'.
806 @end deffn
807
808 @node print
809 @subsection print
810 @cindex print, command description
811 @cindex command description, print
812
813 @deffn Command print [@var{number}]
814
815 Displays the partition table on the device parted is editing, or
816 detailed information about a particular partition.
817
818 Example:
819
820 @example
821 @group
822 (parted) @kbd{print}
823 Disk geometry for /dev/hda: 0.000-2445.679 megabytes
824 Disk label type: msdos
825 Minor    Start       End     Type      Filesystem  Flags
826 1          0.031    945.000  primary   fat32       boot, lba
827 2        945.000   2358.562  primary   ext2
828 3       2358.562   2445.187  primary   linux-swap
829 (parted) @kbd{print 1}
830 Minor: 1
831 Flags: boot, lba
832 File System: fat32
833 Size:            945.000Mb (0%)
834 Minimum size:     84.361Mb (0%)
835 Maximum size:   2445.679Mb (100%)
836 @end group
837 @end example
838 @end deffn
839
840 @node quit
841 @subsection quit
842 @cindex quit, command description
843 @cindex command description, quit
844
845 @deffn Command quit
846
847 Quits Parted.
848
849 @c RMK: generality: the following will apply to any operating system on
850 @c which parted will run, not only Linux-based ones.
851 @c clausen: yeah... just that the way hurd and linux work are totally
852 @c different, and it's actually very hard to speak in general.  Need to
853 @c discuss this more
854 It is only after Parted exits that the Linux kernel knows about the changes
855 Parted has made to the disks.  However, the changes caused by typing your
856 commands will @emph{probably} be made to the disk immediately after typing a
857 command.  However, the operating system's cache and the disk's hardware cache
858 may delay this.
859 @end deffn
860
861 @node rescue
862 @subsection rescue
863 @cindex rescue, command description
864 @cindex command description, rescue
865
866 @deffn Command rescue @var{start} @var{end}
867 Rescue a lost partition that used to be located approximately between
868 @var{start} and @var{end}.  If such a partition is found, Parted will
869 ask you if you want to create a partition for it.  This is useful if you
870 accidently deleted a partition with parted's rm command, for example.
871
872 Example:
873
874 @example
875 (parted) @kbd{print}
876 @group
877 Disk geometry for /dev/hdc: 0.000-8063.507 megabytes
878 Disk label type: msdos
879 Minor    Start       End     Type      Filesystem  Flags
880 1          0.031   8056.032  primary   ext3
881 @end group
882 (parted) @kbd{rm}
883 Partition number? 1
884 (parted) @kbd{print}
885 @group
886 Disk geometry for /dev/hdc: 0.000-8063.507 megabytes
887 Disk label type: msdos
888 Minor    Start       End     Type      Filesystem  Flags
889 @end group
890 @end example
891
892 OUCH!  We deleted our ext3 partition!!!  Parted comes to the rescue...
893
894 @example
895 (parted) @kbd{rescue}
896 Start? 0
897 End? 8056
898 Information: A ext3 primary partition was found at 0.031MB ->
899 8056.030MB.  Do you want to add it to the partition table?
900 Yes/No/Cancel? @kbd{y}
901 (parted) @kbd{print}
902 @group
903 Disk geometry for /dev/hdc: 0.000-8063.507 megabytes
904 Disk label type: msdos
905 Minor    Start       End     Type      Filesystem  Flags
906 1          0.031   8056.032  primary   ext3
907 @end group
908 @end example
909
910 It's back!  :)
911
912 @end deffn
913
914 @node resize
915 @subsection resize
916 @cindex resize, command description
917 @cindex command description, resize
918
919 @deffn Command resize @var{number} @var{start} @var{end}
920
921 Resizes the partition with number @var{number}.  The partition will start
922 @var{start} from the beginning of the disk, and end @var{end} from the
923 beginning of the disk.  resize never changes the partition number.  Extended
924 partitions can be resized only so long as the new extended partition
925 completely contains all logical partitions.
926
927 Note that Parted can manipulate partitions whether or not they have been
928 defragmented, so you do not need to defragment the disk before
929 using Parted.
930
931 Supported file systems:
932 @itemize @bullet
933 @item ext2 -- restriction: the new @var{start} must be the same as
934 the old @var{start}.
935 @item fat16, fat32
936 @item hfs, hfs+, hfsx -- restriction: the new @var{start} must be the same as
937 the old @var{start} and the new @var{end} must be smaller than the old
938 @var{end}.
939 @item linux-swap
940 @item reiserfs (if libreiserfs is installed)
941 @end itemize
942
943 Example:
944
945 @example
946 (parted) @kbd{resize 3 200M 850M}
947 @end example
948
949 Resize partition 3, so that it begins 200 megabytes and ends 850
950 megabytes from the beginning of the disk.
951 @end deffn
952
953 @node rm
954 @subsection rm
955 @cindex rm, command description
956 @cindex command description, rm
957
958
959 @deffn Command rm @var{number}
960
961 Removes the partition with number @var{number}.  If you accidently delete
962 a partition with this command, use mkpart (@emph{not} mkpartfs) to
963 recover it.  Also, you can use the gpart program (@pxref{Related information})
964 to recover damaged disk labels.
965
966 Note for msdos disk labels: if you delete a logical partition, all
967 logical partitions with a larger partition number will be renumbered.  For
968 example, if you delete a logical partition with a partition number of 6,
969 then logical partitions that were number 7, 8 and 9 would be renumbered
970 to 6, 7 and 8 respectively.  This means, for example, that you have to
971 update @file{/etc/fstab} on GNU/Linux systems.
972
973 Example:
974
975 @example
976 (parted) @kbd{rm 3}
977 @end example
978
979 Remove partition 3.
980 @end deffn
981
982 @node select
983 @subsection select
984 @cindex select, command description
985 @cindex command description, select
986
987 @deffn Command select @var{device}
988
989 Selects the device, @var{device}, for Parted to edit.  The device can
990 be a Linux hard disk device, a partition, a software RAID device or
991 LVM logical volume.
992
993 Example:
994
995 @example
996 (parted) @kbd{select /dev/hdb}
997 @end example
998
999 Select @file{/dev/hdb} (the slave device on the first ide controller on
1000 Linux) as the device to edit.
1001 @end deffn
1002
1003 @node set
1004 @subsection set
1005 @cindex set, command description
1006 @cindex command description, set
1007
1008 @deffn Command set @var{number} @var{flag} @var{state}
1009
1010 Changes a flag on the partition with number @var{number}.  A flag can be
1011 either ``on'' or ``off''.  Some or all of these flags will be available,
1012 depending on what disk label you are using:
1013
1014 @table @samp
1015
1016 @item bios_grub
1017 (GPT) - Enable this to record that the selected partition is a
1018 GRUB BIOS partition.
1019
1020 @item boot
1021 (Mac, MS-DOS, PC98) - should be enabled if you want to boot off the
1022 partition.  The semantics vary between disk labels.  For MS-DOS disk
1023 labels, only one partition can be bootable.  If you are installing LILO
1024 on a partition that partition must be bootable.
1025 For PC98 disk labels, all ext2 partitions must be bootable (this is
1026 enforced by Parted).
1027
1028 @item lba
1029 (MS-DOS) - this flag can be enabled to tell MS DOS, MS Windows 9x and
1030 MS Windows ME based operating systems to use Linear (LBA) mode.
1031
1032 @item root
1033 (Mac) - this flag should be enabled if the partition is the root device
1034 to be used by Linux.
1035
1036 @item swap
1037 (Mac) - this flag should be enabled if the partition is the swap
1038 device to be used by Linux.
1039
1040 @item hidden
1041 (MS-DOS, PC98) - this flag can be enabled to hide partitions from
1042 Microsoft operating systems.
1043
1044 @item raid
1045 (MS-DOS) - this flag can be enabled to tell linux the partition is a
1046 software RAID partition.
1047
1048 @item LVM
1049 (MS-DOS) - this flag can be enabled to tell linux the partition is a
1050 physical volume.
1051
1052 @item PALO
1053 (MS-DOS) - this flag can be enabled so that the partition can be used
1054 by the Linux/PA-RISC boot loader, palo.
1055
1056 @item PREP
1057 (MS-DOS) - this flag can be enabled so that the partition can be used
1058 as a PReP boot partition on PowerPC PReP or IBM RS6K/CHRP hardware.
1059
1060 @end table
1061
1062 The print command displays all enabled flags for each partition.
1063
1064 Example:
1065
1066 @example
1067 (parted) @kbd{set 1 boot on}
1068 @end example
1069
1070 Set the @samp{boot} flag on partition 1.
1071 @end deffn
1072
1073 @node unit
1074 @subsection unit
1075 @cindex unit, command description
1076 @cindex command description, unit
1077
1078 @deffn Command unit @var{unit}
1079
1080 Selects the current default unit that Parted will use to display
1081 locations and capacities on the disk and to interpret those given
1082 by the user if they are not suffixed by an @var{unit}.
1083
1084 @var{unit} may be one of:
1085
1086 @table @samp
1087 @item s
1088 sector (n bytes depending on the sector size, often 512)
1089
1090 @item B
1091 byte
1092
1093 @item kB
1094 kilobyte (1000 bytes)
1095
1096 @item MB
1097 megabyte (1000000 bytes)
1098
1099 @item GB
1100 gigabyte (1000000000 bytes)
1101
1102 @item TB
1103 terabyte (1000000000000 bytes)
1104
1105 @item %
1106 percentage of the device (between 0 and 100)
1107
1108 @item cyl
1109 cylinders (related to the BIOS CHS geometry)
1110
1111 @item chs
1112 cylinders, heads, sectors addressing (related to the BIOS CHS geometry)
1113
1114 @item compact
1115 This is a special unit that defaults to megabytes for input, and picks a
1116 unit that gives a compact human readable representation for output.
1117 @end table
1118
1119 The default unit apply only for the output and when no unit is
1120 specified after an input number.  Input numbers can be followed by
1121 an unit (without any space or other character between them), in
1122 which case this unit apply instead of the default unit for this
1123 particular number, but CHS and cylinder units are not supported as
1124 a suffix.  If no suffix is given, then the default unit is assumed.
1125 Parted will compute sensible ranges for the locations you specify
1126 (e.g. a range of +/- 500 MB when you specify the location in ``G'')
1127 and will select the nearest location in this range from the one you
1128 wrote that satisfies constraints from both the operation, the
1129 filesystem being worked on, the disk label, other partitions and so
1130 on.  Use the sector unit ``s'' to specify exact locations (if they
1131 do not satisfy all onstraints, Parted will ask you for the nearest
1132 solution).  Note that negative numbers count back from the end of
1133 the disk, with ``-1s'' pointing to the end of the disk.
1134
1135 Example:
1136
1137 @example
1138 @group
1139 (parted) unit compact
1140 (parted) print
1141 Disk geometry for /dev/hda: 0kB - 123GB
1142 Disk label type: msdos
1143 Number  Start   End     Size    Type      File system  Flags
1144 1       32kB    1078MB  1077MB  primary   reiserfs     boot
1145 2       1078MB  2155MB  1078MB  primary   linux-swap
1146 3       2155MB  123GB   121GB   extended
1147 5       2155MB  7452MB  5297MB  logical   reiserfs
1148 @end group
1149 @group
1150 (parted) unit chs print
1151 Disk geometry for /dev/hda: 0,0,0 - 14946,225,62
1152 BIOS cylinder,head,sector geometry: 14946,255,63.  Each cylinder
1153 is 8225kB.
1154 Disk label type: msdos
1155 Number  Start       End         Type      File system  Flags
1156 1       0,1,0       130,254,62  primary   reiserfs     boot
1157 2       131,0,0     261,254,62  primary   linux-swap
1158 3       262,0,0     14945,254,62 extended
1159 5       262,2,0     905,254,62  logical   reiserfs
1160 @end group
1161 @group
1162 (parted) unit mb print
1163 Disk geometry for /dev/hda: 0MB - 122942MB
1164 Disk label type: msdos
1165 Number  Start   End     Size    Type      File system  Flags
1166 1       0MB     1078MB  1077MB  primary   reiserfs     boot
1167 2       1078MB  2155MB  1078MB  primary   linux-swap
1168 3       2155MB  122935MB 120780MB extended
1169 5       2155MB  7452MB  5297MB  logical   reiserfs
1170 @end group
1171 @end example
1172
1173 @end deffn
1174
1175 @node Related information
1176 @chapter Related information
1177 @cindex further reading
1178 @cindex related documentation
1179
1180 If you want to find out more information, please see the GNU Parted web site.
1181
1182 These files in the Parted distribution contain further information:
1183
1184 @itemize @bullet
1185
1186 @item @kbd{ABOUT-NLS} - information about using Native Language Support, and the Free Translation Project.
1187
1188 @item @kbd{AUTHORS} - who wrote what.
1189
1190 @item @kbd{ChangeLog} - record of changes made to Parted.
1191
1192 @item @kbd{COPYING} - the GNU General Public License, the terms under which GNU Parted may be distributed.
1193
1194 @item @kbd{COPYING.DOC} - the GNU Free Documentation Licence, the term under
1195 which Parted's documentation may be distributed.
1196
1197 @item @kbd{INSTALL} --- how to compile and install Parted, and most other free
1198 software
1199
1200 @end itemize
1201
1202 @node Copying This Manual
1203 @appendix Copying This Manual
1204
1205 @menu
1206 * GNU Free Documentation License::  License for copying this manual
1207 @end menu
1208
1209 @include fdl.texi
1210
1211 @node History
1212 @appendix This manual's history
1213 @cindex  history of this manual
1214
1215 This manual was based on the file @kbd{USER} included in GNU Parted version
1216 1.4.22 source distribution.  The GNU Parted source distribution is
1217 available at @uref{ftp.gnu.org/gnu/parted}.
1218
1219 Initial Texinfo formatting by Richard M. Kreuter, 2002.
1220
1221 Maintainance by Andrew Clausen from 2002 to 2005 and by Leslie P. Polzer
1222 from July 2005 onwards.
1223
1224 This manual is distributed under the GNU Free Documentation License,
1225 version 1.1 or later, at your discretion, any later version published
1226 by the Free Software Foundation; with no Invariant Sections, with no
1227 Front-Cover Texts, and with no Back-Cover Texts.  @xref{Copying
1228 This Manual}, for details.
1229
1230 @c FIXME: why doesn't this @ifnotplaintext work?!
1231 @c @ifnotplaintext
1232 @node Index
1233 @unnumbered Index
1234 @printindex cp
1235 @c @end ifnotplaintext
1236
1237 @bye
1238
1239 @ignore
1240
1241 Notes by RMK:
1242 Notes on possible (unimplemented!) modifications:
1243
1244 The output samples from parted's print command, fdisk's p command, etc.,
1245 might be made into tables (multi-column tables) to ensure spiffy formatting.
1246
1247 I'd like to find a way to make *entry: see *synonym type references in
1248 the index, so, e.g., to refer people looking for Apple to Macintosh, and
1249 PowerPC to Macintosh, etc.  Probably texinfo does this already; I dunno.
1250
1251 Notes by Leslie:
1252
1253 TODO:
1254      - add "version" command.
1255      - read through and correct.
1256      - role of FreeDOS?
1257
1258 @end ignore