blob: 6a317cfe4d8245835add87150364e97b7911f2f4 [file] [log] [blame] [edit]
\input texinfo @c -*-texinfo-*-
@c %**start of header
@setfilename parted.info
@settitle Parted User's Manual
@include version.texi
@paragraphindent 2
@c %**end of header
@ifinfo
This file documents the use of GNU Parted, a program for creating,
resizing, checking and copy partitions and file systems on them.
@end ifinfo
@ifnottex @c texi2pdf don't understand copying and insertcopying ???
@c modifications must also be done in the titlepage
@copying
Copyright @copyright{} 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.1 or
any later version published by the Free Software Foundation; with no
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
Texts. A copy of the license is included in the section entitled ``GNU
Free Documentation License''.
@end copying
@c WTF does the info get the copying output and the plaintext output not ????
@ifplaintext
@insertcopying
@end ifplaintext
@end ifnottex
@direntry
* parted: (parted). GNU partitioning software
@end direntry
@titlepage
@title GNU Parted User Manual
@subtitle GNU Parted, version @value{VERSION}, @value{UPDATED}
@author Andrew Clausen @email{clausen@@gnu.org}
@author Richard M. Kreuter @email{kreuter@@anduril.rutgers.edu}
@author Leslie Patrick Polzer @email{polzer@@gnu.org}
@c @page
@c @vskip 0pt plus 1filll
@c modifications must also be done in the copying block
Copyright @copyright{} 1999, 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.1 or
any later version published by the Free Software Foundation; with no
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
Texts. A copy of the license is included in the section entitled ``GNU
Free Documentation License''.
@end titlepage
@ifnottex
@node Top
@top GNU Parted User Manual
@c WTF doesn't texi2html include the titlepage?
@ifhtml
@insertcopying
@end ifhtml
This document describes the use of GNU Parted, a program for creating,
destroying, resizing, checking and copying hard drive partitions, and
the file systems on them.
This document applies roughly to version @strong{@value{VERSION}} of GNU Parted.
The original version was written by Andrew Clausen in text format.
Richard M. Kreuter translated it into Texinfo format in 2002, to be heavily
edited by Leslie P. Polzer in 2006.
@end ifnottex
@shortcontents
@menu
* Introduction:: Overview
* Using Parted:: Partitioning a Hard Drive
* Related information:: Further reading on related topics
* Copying This Manual:: How to make copies of this manual
* History:: This manual's history
@ifnotplaintext
* Index:: Index of referenced concepts
@end ifnotplaintext
@end menu
@node Introduction
@chapter Introduction
@menu
* Overview:: GNU Parted and prerequisite knowledge
* Software Required:: GNU Parted's software dependencies
* Supported Platforms:: Where you can use GNU Parted
* License:: What you may and may not do with GNU Parted
* Compiling:: How to build GNU Parted
* Static binaries:: How to get and use a static version of GNU
Parted
@end menu
@node Overview
@section Overview of GNU Parted
@cindex description of parted
@cindex overview
@cindex parted description
@cindex bugs, reporting
@cindex reporting bugs
@cindex contacting developers
GNU Parted is a program for creating, destroying, resizing, checking
and copying partitions, and the file systems on them.
This is useful for creating space for new operating systems, for
reorganizing disk usage, for copying data between hard disks and for
``disk imaging'' --- replicating an installation on another computer.
This documentation is written with the assumption that the reader
has some understanding of partitioning and file systems. If you want to
learn more about these, the upcoming GNU Storage Guide is recommended
reading.
GNU Parted was designed to minimize the chance of data loss. For
example, it was designed to avoid data loss during interruptions (like
power failure) and performs many safety checks. However, there could
be bugs in GNU Parted, so you should back up your important files before
running Parted.
Also note that reiserfs support relies on libreiserfs, which does not
fulfil the aforementioned requirement. The same holds for any external
tools like @kbd{ntfsresize}.
The GNU Parted homepage is @uref{http://www.gnu.org/software/parted}. The
library and frontend themselves can be downloaded from
@uref{ftp://ftp.gnu.org/gnu/parted}.
You can also find a listing of mailing lists, notes for contributing and
more useful information on the web site.
Please send bug reports to @email{bug-parted@@gnu.org}. When sending bug
reports, please include the version of GNU Parted.
Please include the output from these commands (for disk @file{/dev/hda}):
@example
@group
# @kbd{parted /dev/hda print unit s print unit chs print}
@end group
@end example
Feel free to ask for help on this list --- just check that your question
isn't answered here first. If you don't understand the documentation,
please tell us, so we can explain it better. General philosophy is:
if you need to ask for help, then something needs to be fixed so you
(and others) don't need to ask for help.
Also, we'd love to hear your ideas :-)
@node Software Required
@section Software Required for the use of Parted
@cindex software dependencies
@cindex required software
@cindex libuuid
@cindex e2fsprogs
@cindex readline
@cindex gettext
If you're installing or compiling Parted yourself, you'll need to
have some other programs installed. If you are compiling Parted,
you will need both the normal and devel packages of these programs
installed:
@itemize @bullet
@item libuuid, part of the e2fsprogs package. If you don't have this,
you can get it from:
@uref{http://web.mit.edu/tytso/www/linux/e2fsprogs.html}
If you want to compile Parted and e2fsprogs, note that you will need to
@kbd{make install} and @kbd{make install-libs} e2fsprogs.
@item GNU Readline (optional), available from
@uref{ftp://ftp.gnu.org/gnu/readline}
If you are compiling Parted, and you don't have readline, you can
disable Parted's readline support with the @kbd{--disable-readline}
option for @command{configure}.
@item GNU gettext (or compatible software) for compilation, if
internationalisation support is desired.
@uref{ftp://ftp.gnu.org/gnu/gettext}
@item libreiserfs, if you want reiserfs support:
@uref{http://reiserfs.osdn.org.ua}
Note that parted will automatically detect libreiserfs at runtime, and enable
reiserfs support. libreiserfs is new, and hasn't been widely tested yet.
@end itemize
@node Supported Platforms
@section Platforms on which GNU Parted runs
@cindex supported platforms
@cindex platforms, supported
Hopefully, this list will grow a lot. If you do not have one of these
platforms, then you can use a rescue disk and a static binary of GNU Parted.
@xref{Static binaries}.
@table @asis
@item GNU/Linux
Linux versions 2.0 and up, on Alpha, x86 PCs, PC98, Macintosh PowerPC, Sun hardware.
@item GNU/Hurd
@end table
GNU libc 2.1 or higher is required. You can probably use older versions
by using the @samp{--disable-nls} option. @xref{Compiling, Building GNU
Parted}. (Note: I think we have now dropped this requirement. TODO:
check if libc 2.0 works!)
@node License
@section Terms of distribution for GNU Parted
@cindex license terms
@cindex terms of distribution
@cindex gnu gpl
@cindex gpl
GNU Parted is free software, covered by the GNU General Public License
Version 2. This should have been included with the Parted distribution,
in the COPYING file. If not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
Libparted is considered part of GNU Parted. It is covered by the GNU
General Public License. It is NOT released under the GNU Lesser General
Public License (LGPL).
@node Compiling
@section Building GNU Parted
@cindex compiling parted
@cindex building parted
If you want to compile GNU Parted, this is generally done with:
@example
@group
$ @kbd{./configure}
$ @kbd{make}
@end group
@end example
However, there are a few options for @command{configure}:
@table @code
@item --without-readline
turns off use of readline. This is useful for making rescue disks,
etc., where few libraries are available.
@item --disable-debug
don't include assertions
@item --disable-dynamic-loading
disables dynamic loading of some libraries (only libreiserfs for now,
although we hope to expand this). Dynamic loading is useful because it
allows you to reuse libparted shared libraries even when you don't know
if some libraries will be available. It has a small overhead (mainly
linking with libdl), so it may be useful to disable it on bootdisks if
you don't need the flexibility.
@item --disable-fs
disable all file system support
@item --disable-nls
turns off native language support. This is useful for use with old
versions of glibc, or a trimmed down version of glibc suitable for
rescue disks.
@item --disable-shared
turns off shared libraries. This may be necessary for use with old
versions of GNU libc, if you get a compile error about a ``spilled
register''. Also useful for boot/rescue disks.
@item --disable-Werror
ignore warning messages in compilation
@item --enable-discover-only
support only reading/probing (reduces size considerably)
@item --enable-mtrace
enable malloc() debugging
@item --enable-read-only
disable writing (for debugging)
@end table
@node Static binaries
@section Using static binaries of GNU Parted
@cindex static binary
@cindex unsupported platforms
@cindex resizing root device
@subsection Introduction
If you want to run GNU Parted on a machine without GNU/Linux installed, or you
want to resize a root or boot partition, you will need to use a boot disk.
Special boot disk images for GNU Parted used to be available, but with the
emergence of a plethora of rescue disks and Live CDs that all
include GNU Parted this is no longer necessary.
However, please note that these disks often ship with out-of-date
versions of Parted. To compensate for this a static binary
of the latest GNU Parted version is available, which you can use thus:
@c There should be instructions for CD and USB here.
@subsection Creating the Parted disk
@enumerate
@item Boot your system
@item Download @file{parted-static-VERSION.tgz} from @uref{ftp://ftp.gnu.org/gnu/parted/static}
@item Unpack the tarball, resulting in a file called ``parted.static".
@item Insert a floppy.
@item Do a low-level format on it (on GNU/Linux this can be achieved with
the tool ``fdformat" from the ``util-linux" package.
This is basically a sanity check because floppy disks often
contain bad blocks.
@item Create a file system. Example:
@example
$ @kbd{parted /dev/fd0 mklabel loop mkpartfs primary ext2 0 1.4}
@end example
@item Mount the floppy disk, e.g.,
@example
$ @kbd{mount -t ext2 /dev/fd0 /mnt/floppy}
@end example
@item Copy @file{parted.static} to the floppy, e.g.,
@example
$ @kbd{cp parted.static /mnt/floppy}
@end example
@item Unmount the floppy, e.g.,
@example
$ @kbd{umount /mnt/floppy}
@end example
@end enumerate
@subsection Using the Parted disk
@enumerate
@item Choose a rescue disk that suits you.
@item Boot off your rescue disk. Mount the disk you copied Parted onto.
@item Run Parted. For example,
@example
# @kbd{cd /mnt/floppy}
# @kbd{./parted-static}
@end example
@end enumerate
@node Using Parted
@chapter Using Parted
@cindex commands
@menu
* Partitioning:: Disk partitioning in context
* Running Parted:: Partitioning with Parted
* Invoking Parted:: Parted's invocation options and commands
* Command explanations:: Full explanation of parted's commands
@end menu
@node Partitioning
@section Introduction to Partitioning
@cindex partitioning overview
Unfortunately, partitioning your disk is rather complicated. This is
because there are interactions between many different systems that need
to be taken into consideration.
This manual used to introduce the reader to these systems and their
working. This content has moved to the GNU Storage Guide.
@node Running Parted
@section Using GNU Parted
@cindex modes of use
Parted has two modes: command line and interactive. Parted should
always be started with:
@example
# @kbd{parted @var{device}}
@end example
@noindent where @var{device} is the hard disk device to edit. (If you're
lazy and omit the DEVICE argument, Parted will attempt to guess which
device you want.)
In command line mode, this is followed by one or more commands. For
example:
@example
# @kbd{parted /dev/sda resize 1 52Mb 104Mb mkfs 2 fat16}
@end example
@noindent Options (like @kbd{--help}) can only be specified on the
command line.
In interactive mode, commands are entered one at a time at a prompt, and
modify the disk immediately. For example:
@example
(parted) @kbd{resize 1 52.0005Mb 104.5Mb}
(parted) @kbd{mkfs 2 fat16}
@end example
@noindent Unambiguous abbreviations are allowed. For example, you can
type ``p'' instead of ``print'', and ``resi'' instead of ``resize''.
Commands can be typed either in English, or your native language (if
your language has been translated). This may create ambiguities.
Commands are case-insensitive.
Numbers indicating partition locations can be whole numbers or decimals.
The suffix selects the unit, which may be one of those described in
@ref{unit}, except CHS and compact. If no suffix is given, then the default
unit is assumed. Negative numbers count back from the end of the disk,
with ``-1s'' indicating the end of the disk. Parted will compute sensible
ranges for the locations you specify (e.g. a range of +/- 500 MB when you
specify the location in ``G''). Use the sector unit ``s'' to specify exact
locations.
If you don't give a parameter to a command, Parted will prompt you for it.
For example:
@example
(parted) @kbd{resize 1}
Start? @kbd{0Gb}
End? @kbd{40Gb}
@end example
Parted will always warn you before doing something that is potentially
dangerous, unless the command is one of those that is inherently
dangerous (viz., rm, mklabel and mkfs). For example, if you attempt to
shrink a partition ``too much'' (i.e., by more than the free space
available), Parted will automatically reduce the shrinkage so that the
partition is the smallest it can be without losing data. If this size is
significantly different from the size requested, Parted will warn you.
Since many partitioning systems have complicated constraints, Parted will
usually do something slightly different to what you asked. (For example,
create a partition starting at 10.352Mb, not 10.4Mb)
If the calculated values differ too much, Parted will ask you for
confirmation.
@node Invoking Parted
@section Command Line Options
@cindex options at invocation
@cindex commands, overview
@cindex invocation options
When invoked from the command line, Parted supports the following syntax:
@example
# @kbd{parted [@var{option}] @var{device} [@var{command} [@var{argument}]]}
@end example
Available options and commands follow. For detailed explanations of the
use of Parted commands, see @ref{Command explanations}. Options begin
with a hyphen, commands do not:
Options:
@table @samp
@item -h
@itemx --help
display a help message
@item -i
@itemx --interactive
prompt for user intervention
@item -s
@itemx --script
never prompt the user
@item -v
@itemx --version
display the version
@end table
@node Command explanations
@section Parted Session Commands
@cindex command syntax
@cindex detailed command listing
@cindex commands, detailed listing
GNU Parted provides the following commands:
@menu
* check::
* cp::
* help::
* mklabel::
* mkfs::
* mkpart::
* mkpartfs::
* move::
* name::
* print::
* quit::
* rescue::
* resize::
* rm::
* select::
* set::
* unit::
@end menu
@node check
@subsection check
@cindex check, command description
@cindex command description, check
@deffn Command check @var{number}
Checks if the file system on partition @var{number} has
any errors.
Example:
@example
(parted) @kbd{check 1}
@end example
Check the file system on partition 1.
@end deffn
@node cp
@subsection cp
@cindex cp, command description
@cindex command description, cp
@deffn Command cp [@var{from-device}] @var{from-number} @var{to-number}
Copies the file system on the partition @var{from-number} to partition
@var{to-number}, deleting the original contents of the destination
partition.
An optional device parameter, @var{from-device} can be given, which
specifies which device the source partition is on.
Supported file systems:
@itemize @bullet
@item ext2, ext3
(provided the destination partition is larger than the source partition)
@item fat16, fat32
@item linux-swap
(equivalent to mkswap on destination partition)
@item reiserfs (if libreiserfs is installed)
@end itemize
Example:
@example
(parted) @kbd{cp /dev/hdb 2 3}
@end example
@c FIXME: this doesn't format right.
Copy partition 2 of @file{/dev/hdb} (i.e., @file{/dev/hdb2}) to partition
on 3, on the device Parted was loaded with, destroying the original
contents of partition 3.
@end deffn
@node help
@subsection help
@cindex help, command description
@cindex command description, help
@deffn Command help [@var{command}]
Prints general help, or help on @var{command}.
Example:
@example
(parted) @kbd{help resize}
@end example
Print help for the resize command.
@end deffn
@node mklabel
@subsection mklabel
@cindex mklabel, command description
@cindex command description, mkindex
@deffn Command mklabel @var{label-type}
Creates a new disk label, of type @var{label-type}. The new disk label
will have no partitions. This command (normally) won't technically
destroy your data, but it will make it basically unusable,
and you will need to use the rescue command (@pxref{Related information})
to recover any partitions.
Parted works on all partition tables. @footnote{Everyone seems to
have a different word for ``disk label'' --- these are all the same
thing: partition table, partition map.}
@var{label-type} must be one of these supported disk labels:
@itemize @bullet
@item bsd
@item loop (raw disk access)
@item gpt
@item mac
@item msdos
@item pc98
@item sun
@end itemize
Example:
@example
(parted) @kbd{mklabel msdos}
@end example
Create an MS-DOS disk label. This is still the most common disk label for
PCs.
@end deffn
@node mkfs
@subsection mkfs
@cindex mkfs, command description
@cindex command description, mkfs
@deffn Command mkfs @var{number} @var{fs-type}
Makes a file system @var{fs-type} on partition @var{number}, destroying
all data that resides on that partition.
Supported file systems:
@itemize @bullet
@item ext2
@item fat16, fat32
@item linux-swap
@item reiserfs (if libreiserfs is installed)
@end itemize
Example:
@example
(parted) @kbd{mkfs 2 fat32}
@end example
Make a @var{fat32} file system on partition 2.
@end deffn
@node mkpart
@subsection mkpart
@cindex mkpart, command description
@cindex command description, mkpart
@deffn Command mkpart @var{part-type} [@var{fs-type}] @var{start} @var{end}
Creates a new partition, @emph{without} creating a new file system on
that partition. This is useful for creating partitions for file systems
(or LVM, etc.) that Parted doesn't support. You may specify a file
system type, to set the appropriate partition code in the partition
table for the new partition. @var{fs-type} is required for data
partitions (i.e., non-extended partitions). @var{start} and @var{end}
are the offset from the beginning of the disk, that is, the ``distance''
from the start of the disk.
@var{part-type} is one of: primary, extended, logical. Extended and
logical are only used for msdos and dvh disk labels.
@var{fs-type} must be on of these supported file systems:
@itemize @bullet
@item ext2
@item fat16, fat32
@item hfs, hfs+, hfsx
@item linux-swap
@item NTFS
@item reiserfs
@item ufs
@end itemize
Example:
@example
(parted) @kbd{mkpart logical 0.0 692.1}
@end example
Create a logical partition that will contain an ext2 file system. The
partition will start at the beginning of the disk, and end 692.1
megabytes into the disk.
@end deffn
@node mkpartfs
@subsection mkpartfs
@cindex mkpartfs, command description
@cindex command description, mkpartfs
@deffn Command mkpartfs @var{part-type} @var{fs-type} @var{start} @var{end}
Creates a new partition of type @var{part-type} with a new file system
of type @var{fs-type} on it. The new partition will start @var{start}
megabytes, and end @var{end} megabytes from the beginning of the disk.
Do not use this command to recover a deleted partition (use mkpart
instead).
@var{part-type} is one of: primary, extended, logical. Extended and logical
are only used for msdos and dvh disk labels.
@var{fs-type} must be one of these supported file systems:
@itemize @bullet
@item ext2
@item fat16, fat32
@item linux-swap
@item reiserfs (if libreiserfs is installed)
@end itemize
Example:
@example
(parted) @kbd{mkpartfs logical ext2 440 670}
@end example
Make a logical partition and write an ext2 file system, starting 440
megabytes and ending 670 megabytes from the beginning of the disk.
@end deffn
@node move
@subsection move
@cindex move, command description
@cindex command description, move
@deffn Command move @var{number} @var{start} @var{end}
Moves partition on the disk, by moving its beginning to @var{start}.
You can't move a partition so that the old and new positions overlap.
That is, you can only move partitions into free space. If you want
to resize a partition in-place, use @command{resize}.
Move never changes the partition number.
Supported file systems:
@itemize @bullet
@item ext2, ext3
(provided the destination partition is larger than the source partition)
@item fat16, fat32
@item linux-swap
@item reiserfs (if libreiserfs is installed)
@end itemize
Example:
@example
(parted) move 2 150M 500M
@end example
Move the partition numbered 2 so that it begins 150 megabytes from the start of
the disk, and ends 500 megabytes from the start.
@end deffn
@node name
@subsection name
@cindex name, command description
@cindex command description, name
@deffn Command name @var{number} @var{name}
Sets the name for the partition @var{number} (GPT, Mac, MIPS and PC98 only).
The name can be placed in quotes.
Example:
@example
(parted) @kbd{name 2 'Secret Documents'}
@end example
Set the name of partition 2 to `Secret Documents'.
@end deffn
@node print
@subsection print
@cindex print, command description
@cindex command description, print
@deffn Command print [@var{number}]
Displays the partition table on the device parted is editing, or
detailed information about a particular partition.
Example:
@example
@group
(parted) @kbd{print}
Disk geometry for /dev/hda: 0.000-2445.679 megabytes
Disk label type: msdos
Minor Start End Type Filesystem Flags
1 0.031 945.000 primary fat32 boot, lba
2 945.000 2358.562 primary ext2
3 2358.562 2445.187 primary linux-swap
(parted) @kbd{print 1}
Minor: 1
Flags: boot, lba
File System: fat32
Size: 945.000Mb (0%)
Minimum size: 84.361Mb (0%)
Maximum size: 2445.679Mb (100%)
@end group
@end example
@end deffn
@node quit
@subsection quit
@cindex quit, command description
@cindex command description, quit
@deffn Command quit
Quits Parted.
@c RMK: generality: the following will apply to any operating system on
@c which parted will run, not only Linux-based ones.
@c clausen: yeah... just that the way hurd and linux work are totally
@c different, and it's actually very hard to speak in general. Need to
@c discuss this more
It is only after Parted exits that the Linux kernel knows about the changes
Parted has made to the disks. However, the changes caused by typing your
commands will @emph{probably} be made to the disk immediately after typing a
command. However, the operating system's cache and the disk's hardware cache
may delay this.
@end deffn
@node rescue
@subsection rescue
@cindex rescue, command description
@cindex command description, rescue
@deffn Command rescue @var{start} @var{end}
Rescue a lost partition that used to be located approximately between
@var{start} and @var{end}. If such a partition is found, Parted will
ask you if you want to create a partition for it. This is useful if you
accidently deleted a partition with parted's rm command, for example.
Example:
@example
(parted) @kbd{print}
@group
Disk geometry for /dev/hdc: 0.000-8063.507 megabytes
Disk label type: msdos
Minor Start End Type Filesystem Flags
1 0.031 8056.032 primary ext3
@end group
(parted) @kbd{rm}
Partition number? 1
(parted) @kbd{print}
@group
Disk geometry for /dev/hdc: 0.000-8063.507 megabytes
Disk label type: msdos
Minor Start End Type Filesystem Flags
@end group
@end example
OUCH! We deleted our ext3 partition!!! Parted comes to the rescue...
@example
(parted) @kbd{rescue}
Start? 0
End? 8056
Information: A ext3 primary partition was found at 0.031MB ->
8056.030MB. Do you want to add it to the partition table?
Yes/No/Cancel? @kbd{y}
(parted) @kbd{print}
@group
Disk geometry for /dev/hdc: 0.000-8063.507 megabytes
Disk label type: msdos
Minor Start End Type Filesystem Flags
1 0.031 8056.032 primary ext3
@end group
@end example
It's back! :)
@end deffn
@node resize
@subsection resize
@cindex resize, command description
@cindex command description, resize
@deffn Command resize @var{number} @var{start} @var{end}
Resizes the partition with number @var{number}. The partition will start
@var{start} from the beginning of the disk, and end @var{end} from the
beginning of the disk. resize never changes the partition number. Extended
partitions can be resized only so long as the new extended partition
completely contains all logical partitions.
Note that Parted can manipulate partitions whether or not they have been
defragmented, so you do not need to defragmenting the disk before
using Parted.
Supported file systems:
@itemize @bullet
@item ext2, ext3 -- restriction: the new @var{start} must be the same as
the old @var{start}.
@item fat16, fat32
@item hfs, hfs+, hfsx -- restriction: the new @var{start} must be the same as
the old @var{start} and the new @var{end} must be smaller than the old
@var{end}.
@item linux-swap
@item reiserfs (if libreiserfs is installed)
@end itemize
Example:
@example
(parted) @kbd{resize 3 200M 850M}
@end example
Resize partition 3, so that it begins 200 megabytes and ends 850
megabytes from the beginning of the disk.
@end deffn
@node rm
@subsection rm
@cindex rm, command description
@cindex command description, rm
@deffn Command rm @var{number}
Removes the partition with number @var{number}. If you accidently delete
a partition with this command, use mkpart (@emph{not} mkpartfs) to
recover it. Also, you can use the gpart program (@pxref{Related information})
to recover damaged disk labels.
Note for msdos disk labels: if you delete a logical partition, all
logical partitions with a larger partition number will be renumbered. For
example, if you delete a logical partition with a partition number of 6,
then logical partitions that were number 7, 8 and 9 would be renumbered
to 6, 7 and 8 respectively. This means, for example, that you have to
update @file{/etc/fstab} on GNU/Linux systems.
Example:
@example
(parted) @kbd{rm 3}
@end example
Remove partition 3.
@end deffn
@node select
@subsection select
@cindex select, command description
@cindex command description, select
@deffn Command select @var{device}
Selects the device, @var{device}, for Parted to edit. The device can
be a Linux hard disk device, a partition, a software RAID device or
LVM logical volume.
Example:
@example
(parted) @kbd{select /dev/hdb}
@end example
Select @file{/dev/hdb} (the slave device on the first ide controller on
Linux) as the device to edit.
@end deffn
@node set
@subsection set
@cindex set, command description
@cindex command description, set
@deffn Command set @var{number} @var{flag} @var{state}
Changes a flag on the partition with number @var{number}. A flag can be
either ``on'' or ``off''. Some or all of these flags will be available,
depending on what disk label you are using:
@table @samp
@item boot
(Mac, MS-DOS, PC98) - should be enabled if you want to boot off the
partition. The semantics vary between disk labels. For MS-DOS disk
labels, only one partition can be bootable. If you are installing LILO
on a partition that partition must be bootable.
For PC98 disk labels, all ext2 partitions must be bootable (this is
enforced by Parted).
@item lba
(MS-DOS) - this flag can be enabled to tell MS DOS, MS Windows 9x and
MS Windows ME based operating systems to use Linear (LBA) mode.
@item root
(Mac) - this flag should be enabled if the partition is the root device
to be used by Linux.
@item swap
(Mac) - this flag should be enabled if the partition is the swap
device to be used by Linux.
@item hidden
(MS-DOS, PC98) - this flag can be enabled to hide partitions from
Microsoft operating systems.
@item raid
(MS-DOS) - this flag can be enabled to tell linux the partition is a
software RAID partition.
@item LVM
(MS-DOS) - this flag can be enabled to tell linux the partition is a
physical volume.
@item PALO
(MS-DOS) - this flag can be enabled so that the partition can be used
by the Linux/PA-RISC boot loader, palo.
@item PREP
(MS-DOS) - this flag can be enabled so that the partition can be used
as a PReP boot partition on PowerPC PReP or IBM RS6K/CHRP hardware.
@end table
The print command displays all enabled flags for each partition.
Example:
@example
(parted) @kbd{set 1 boot on}
@end example
Set the @samp{boot} flag on partition 1.
@end deffn
@node unit
@subsection unit
@cindex unit, command description
@cindex command description, unit
@deffn Command unit @var{unit}
Selects the current default unit that Parted will use to display
locations and capacities on the disk and to interpret those given
by the user if they are not suffixed by an @var{unit}.
@var{unit} may be one of:
@table @samp
@item s
sector (n bytes depending on the sector size, often 512)
@item B
byte
@item kB
kilobyte (1000 bytes)
@item MB
megabyte (1000000 bytes)
@item GB
gigabyte (1000000000 bytes)
@item TB
terabyte (1000000000000 bytes)
@item %
percentage of the device (between 0 and 100)
@item cyl
cylinders (related to the BIOS CHS geometry)
@item chs
cylinders, heads, sectors addressing (related to the BIOS CHS geometry)
@item compact
This is a special unit that defaults to megabytes for input, and picks a
unit that gives a compact human readable representation for output.
@end table
The default unit apply only for the output and when no unit is
specified after an input number. Input numbers can be followed by
an unit (without any space or other character between them), in
which case this unit apply instead of the default unit for this
particular number, but CHS and cylinder units are not supported as
a suffix. If no suffix is given, then the default unit is assumed.
Parted will compute sensible ranges for the locations you specify
(e.g. a range of +/- 500 MB when you specify the location in ``G'')
and will select the nearest location in this range from the one you
wrote that satisfies constraints from both the operation, the
filesystem being worked on, the disk label, other partitions and so
on. Use the sector unit ``s'' to specify exact locations (if they
do not satisfy all onstraints, Parted will ask you for the nearest
solution). Note that negative numbers count back from the end of
the disk, with ``-1s'' pointing to the end of the disk.
Example:
@example
@group
(parted) unit compact
(parted) print
Disk geometry for /dev/hda: 0kB - 123GB
Disk label type: msdos
Number Start End Size Type File system Flags
1 32kB 1078MB 1077MB primary reiserfs boot
2 1078MB 2155MB 1078MB primary linux-swap
3 2155MB 123GB 121GB extended
5 2155MB 7452MB 5297MB logical reiserfs
@end group
@group
(parted) unit chs print
Disk geometry for /dev/hda: 0,0,0 - 14946,225,62
BIOS cylinder,head,sector geometry: 14946,255,63. Each cylinder
is 8225kB.
Disk label type: msdos
Number Start End Type File system Flags
1 0,1,0 130,254,62 primary reiserfs boot
2 131,0,0 261,254,62 primary linux-swap
3 262,0,0 14945,254,62 extended
5 262,2,0 905,254,62 logical reiserfs
@end group
@group
(parted) unit mb print
Disk geometry for /dev/hda: 0MB - 122942MB
Disk label type: msdos
Number Start End Size Type File system Flags
1 0MB 1078MB 1077MB primary reiserfs boot
2 1078MB 2155MB 1078MB primary linux-swap
3 2155MB 122935MB 120780MB extended
5 2155MB 7452MB 5297MB logical reiserfs
@end group
@end example
@end deffn
@node Related information
@chapter Related information
@cindex further reading
@cindex related documentation
If you want to find out more information, please see the GNU Parted web site.
These files in the Parted distribution contain further information:
@itemize @bullet
@item @kbd{ABOUT-NLS} - information about using Native Language Support, and the Free Translation Project.
@item @kbd{AUTHORS} - who wrote what.
@item @kbd{ChangeLog} - record of changes made to Parted.
@item @kbd{COPYING} - the GNU General Public License, the terms under which GNU Parted may be distributed.
@item @kbd{COPYING.DOC} - the GNU Free Documentation Licence, the term under
which Parted's documentation may be distributed.
@item @kbd{INSTALL} --- how to compile and install Parted, and most other free
software
@end itemize
@node Copying This Manual
@appendix Copying This Manual
@menu
* GNU Free Documentation License:: License for copying this manual
@end menu
@include fdl.texi
@node History
@appendix This manual's history
@cindex history of this manual
This manual was based on the file @kbd{USER} included in GNU Parted version
1.4.22 source distribution. The GNU Parted source distribution is
available at @uref{ftp.gnu.org/gnu/parted}.
Initial Texinfo formatting by Richard M. Kreuter, 2002.
Maintainance by Andrew Clausen from 2002 to 2005 and by Leslie P. Polzer
from July 2005 onwards.
This manual is distributed under the GNU Free Documentation License,
version 1.1 or later, at your discretion, any later version published
by the Free Software Foundation; with no Invariant Sections, with no
Front-Cover Texts, and with no Back-Cover Texts. @xref{Copying
This Manual}, for details.
@c FIXME: why doesn't this @ifnotplaintext work?!
@c @ifnotplaintext
@node Index
@unnumbered Index
@printindex cp
@c @end ifnotplaintext
@bye
@ignore
Notes by RMK:
Notes on possible (unimplemented!) modifications:
The output samples from parted's print command, fdisk's p command, etc.,
might be made into tables (multi-column tables) to ensure spiffy formatting.
I'd like to find a way to make *entry: see *synonym type references in
the index, so, e.g., to refer people looking for Apple to Macintosh, and
PowerPC to Macintosh, etc. Probably texinfo does this already; I dunno.
Notes by Leslie:
TODO:
- add "version" command.
- read through and correct.
- role of FreeDOS?
@end ignore