Commit Graph

45 Commits

Author SHA1 Message Date
Ruslan Ermilov
4e9e907d63 -mdoc sweep. 2005-11-18 10:36:29 +00:00
Marcel Moolenaar
5201042924 Add support for setting GPT partition labels. The partitions to be
labeled are selected in the same way as with the remove command.
Update the manpage to have the selection options described for the
label command and referenced to it from the remove command.
The label can be specified on the command line with the -l option
or read from a file with the -f option. In both cases, the label
is assumed to be encoded in UTF-8.

PR: ia64/83124
MFC after: 1 week
2005-09-01 02:49:20 +00:00
Marcel Moolenaar
376e47e284 Dot the i's: multiple devices can be specified, so the usage should
have ellipsis following the device.
2005-09-01 02:42:52 +00:00
Marcel Moolenaar
bdcb67f435 Add a comment before the statement that is responsible for the
removal of the GPT entry. There's a bit of code around that one
statement that it's good to have it stand out a bit more.
2005-09-01 01:15:22 +00:00
Marcel Moolenaar
6918ad7096 Document the -l and -u options of the show command. 2005-08-31 05:56:21 +00:00
Marcel Moolenaar
06185c565b o Replace unicode16() by utf8_to_utf16().
o  Introduce utf16_to_utf8().
o  Add option -l to the show command to display the GPT label instead
   of the friendly partition type.
o  Add option -u to the show command to suppress the friendly output
   and print th raw UUIDs instead.
2005-08-31 05:40:41 +00:00
Marcel Moolenaar
27e701229c /* -> /*- for license. 2005-08-31 01:47:19 +00:00
Marcel Moolenaar
4a8718928d This script was helpful during development, but has no reason to
be kept alive. Removal is long overdue as it is.
2005-08-30 06:20:20 +00:00
Marcel Moolenaar
14cbcc591c Don't print the total number of partitions removed now that we print
the name of the partitions that we remove. A summary is unnecessary
and even makes parsing of the output more difficult.

MFC after: 1 week
2005-08-30 06:16:31 +00:00
Ruslan Ermilov
55c82bf0d4 Markup fixes.
Approved by:	re (blanket)
2005-06-14 11:24:56 +00:00
Dag-Erling Smørgrav
8a399540fa - distinguish between the device name (what the user called it on the
command line) and the device path (what we passed to open()).  Use
  the former in diagnostics.
- when adding or removing partitions, print a single line to stdout for
  each partition that was added or removed, indicating its name.
- add an -a option to 'gpt remove' which must be explicitly specified
  to remove all partitions.

Approved by:	marcel (in prinicple)
MFC after:	2 weeks
2005-04-24 20:08:29 +00:00
Ruslan Ermilov
214144704b Scheduled mdoc(7) sweep. 2005-01-10 16:17:34 +00:00
Marcel Moolenaar
6c377348e6 For create and migrate, remove the `.Op Fl f' introduced in the
previous two commits and combine them with the existing flags
that were already there.

Pointed out by: ru@
2004-11-13 08:01:48 +00:00
Marcel Moolenaar
9e57e1869c Add an -f option (for force) to the migrate command. Normally an MBR
with unknown partitions is not migrated. By specifying the -f option
migration will happen and unknown partitions will be lost.
2004-11-13 05:44:02 +00:00
Marcel Moolenaar
597c201050 Add an -f option (for force) to the create command. The -f option
allows the user to force the creation of a GPT even when there's a
MBR on the device. The MBR is simply wiped and any partitions
described by it are lost. Without the -f option one cannot create
a GPT when there's a MBR.
2004-11-13 05:13:33 +00:00
Marcel Moolenaar
b8bd838882 Fix a braino: the partition size in the PMBR is in sectors, not bytes
and 'mediasz' is in bytes. As it so happens, we define 'last' as the
sector number of the last sector on the medium which also is the size
of the PMBR partition. Therefore, use 'last' instead of 'mediasz'.

Submitted by: Dan Markarian <markarian at apple dot com>
2004-11-12 04:34:46 +00:00
Marcel Moolenaar
d88642fe52 Remove the -k option to migrate. The option causes gpt(8) to preserve
the MBR after it is migrated to a GPT. While this was useful during
the early days when GPT support was under development, it's something
that users can use without knowing what they're getting themselves
into. The possible harm outweights the marginal usefulness it now has.
2004-10-31 02:20:17 +00:00
Marcel Moolenaar
ac582d7b7f Remove useless inclusion of <sys/disklabel.h>
Obtained from: Dan Markarian <markarian at apple dot com>
2004-10-25 03:44:10 +00:00
Marcel Moolenaar
e3f8c5aa65 Declare variables as static, like I intended.
Obtained from: Dan Markarian <markarian at apple dot com>
2004-10-25 03:39:31 +00:00
Marcel Moolenaar
7d744baf22 Fix bogon. Create the BSD label in the FreeBSD slice. 2004-10-25 03:29:21 +00:00
Marcel Moolenaar
e80c38cd22 Catch up with the BSD label changes. The partition offsets are relative
to the partition now. While here, make sure we skip unused partition
entries.
2004-10-25 03:27:31 +00:00
Marcel Moolenaar
6ebab76180 Add byte swapping and UUID encoding/decoding to allow gpt to be compiled
on big-endian machines.

Obtained from: Dan Markarian <markarian at apple dot com>
2004-10-25 02:23:39 +00:00
Marcel Moolenaar
7eece0972d Document the remove command. 2004-08-07 07:52:31 +00:00
Marcel Moolenaar
6686e95fef Implement a remove command. The remove command iterates the GPT
partitions and removes any that matches the pre-conditions. The
options are the same for the add command and are used to select
the partitions to remove.
Currently the remove command without any options deletes all GPT
partitions. This is rather harmful and will need anti-footshooting
measures.
2004-08-07 07:41:37 +00:00
Marcel Moolenaar
2cedbd6ee8 Use __FBSDID. 2004-08-07 06:24:25 +00:00
Marcel Moolenaar
f61bdfe072 o Save the partition number (=index) in the internal map. The index
starts at 1. No index is represented by 0.
o  Change the show command to display the partition number at the expense
   of the partition end columm. We already display the start and size.
o  Enhance the add command to accept the -i option. The -i option allows
   the user to specify which partition number the new partition should
   get.
o  Update the manpage accordingly.
2004-08-07 06:10:45 +00:00
Marcel Moolenaar
2ef70adc0c Add Linux swap partition and MS reserved partition descriptions.
While here:
o  Make the UUIDs static to avoid runtime initialization,
o  Rename ext to mslinux,
o  Replace the use of memcmp() with uuid_equal(),
o  Various style(9) improvements,
o  Order the comparisons based on importance,
o  Remove the word partition from all the descriptions,
o  Other description improvements.

Includes patch from: T. Muthu Mohan < Muthu_T at dell dot com >
2004-08-02 19:28:03 +00:00
Marcel Moolenaar
814db82be5 What's in a name: s/disklabel/bsdlabel/ 2004-08-02 19:22:11 +00:00
Arun Sharma
8c21c19305 Bump up the date and add spaces around commas. Thanks to ru@ for noticing. 2004-07-02 18:39:15 +00:00
Arun Sharma
6fc92a7a9d Added the ability to create and display Linux/Windows GPT partitions to gpt(8). 2004-07-01 22:27:12 +00:00
Johan Karlsson
604d24db95 style.Makefile(5):
Use WARNS?= instead of WARNS=.
2004-02-23 20:25:27 +00:00
Ken Smith
12ce12716f - Add GPT header/table recovery command
- Minor related cleanup in add command

Approved by:	marcel
2003-11-16 06:45:26 +00:00
Ken Smith
3834ba7920 - Provide default values for LABELOFFSET and LABELSECTOR so
it compiles on all architectures.

Approved by:	marcel
2003-11-16 06:43:25 +00:00
Ruslan Ermilov
f937c268cf Assorted mdoc(7) fixes. 2003-06-02 11:19:24 +00:00
Peter Wemm
7201d7b009 Show the paritition types that we recognize in human readable format. eg:
pluto2# gpt show da0
     start       end      size  contents
         0         0         1  PMBR
         1         1         1  Pri GPT header
         2        33        32  Pri GPT table
        34    401595    401562  GPT part - EFI System partition
    401596    925883    524288  GPT part - FreeBSD ufs partition
    925884   9314491   8388608  GPT part - FreeBSD swap partition
...
It'll print a plain uuid string for unrecognized types.
2003-02-13 01:00:26 +00:00
Marcel Moolenaar
2a944ecdef o Newer EFI implementations require that a GPT is preceeded by
a PMBR. Make sure the create command creates a PMBR as well
   (if not already present).
o  When parsing the MBR, explicitly check for a PMBR and create
   a PMBR map node if one is found.
o  When parsing the MBR, recurse to handle extended partitions.
   This allows us to flatten nested MBRs when migrating to a
   GPT.
o  Have the migrate command bail out if it encounters a partition
   it doesn't know how to migrate. This avoids data loss.
o  Change the output of the show command so that the UUIDs of the
   GPT partitions fit on the same line.
o  Show when partitions are extended partitions and add the PMBR
   type.

Approved by: re (blanket)
2002-12-02 01:42:03 +00:00
Marcel Moolenaar
1efbdbe23b Add a manpage. Nobody expects the spanish inquisition, but the
mdoc(7) police... It's all yours ru :-)

Approved by: re (blanket)
2002-12-01 02:10:34 +00:00
Marcel Moolenaar
b103cd4113 Allow aliases to be used when specifying partition types. The use of
UUIDs can then be limited to those cases when an alias doesn't exist.
This greatly increases the likelyhood that a sysadmin finishes the
partitioning without intermittent mental breakdowns. Current aliases
are "efi", "swap" and "ufs".

While here, staticize global variables and expand the usage message.

Approved by: re (blanket)
2002-11-30 22:51:46 +00:00
Marcel Moolenaar
78edc0fda2 Remove inclusion of <sys/uuid.h>. We now include <sys/uuid.h> in
<sys/gpt.h>. This avoids having to include both <sys/uuid.h> and
<uuid.h>, which is considered by your friendly committer to be
aestheticly displeasing (= ballyhoo barf barf :-)
2002-11-10 20:22:25 +00:00
Marcel Moolenaar
c1fd52ba74 o Remove the fallback implementations of uuid_create(),
uuid_from_string(), uuid_is_nil() and uuid_to_string().
o  Include <uuid.h> where appropriate.
2002-11-02 07:08:15 +00:00
Marcel Moolenaar
5d5e1c2b12 o Add functionality to add a GPT partition,
o  Use DCE compliant UUID functions and provide local
   implementations if they don't exist,
o  Move dumping of the map to show.c and print the
   partition type,
o  Some cleanups and rearrangements.

The default GPT partition type is UFS. When no starting block
or size are specified, the tool will create a partition in the
first free space it find (or that fits, depending on the size).
2002-10-27 03:23:05 +00:00
Marcel Moolenaar
e6f737b346 Add the functionality to create an (empty) GPT from scratch. The
code is directly copied from migrate.c. The intend is to express
migrate in terms of create and add. The functionality to add
partitions is not yet there.
2002-10-25 05:23:08 +00:00
Marcel Moolenaar
fec26e0e4c Don't complain if we have an inconsistent map that may be the
result of an incomplete migration. An incomplete migration is
one where the MBR is not turned into a PMBR after creating the
GPT. This early in the game it's more convenient to allow the
inconsistency, because that avoids that we have to destroy the
MBR partitioning for now.
2002-10-23 03:33:06 +00:00
Peter Wemm
6bc11ae00c Make this compile without needing NO_WERROR. 2002-08-25 02:51:13 +00:00
Peter Wemm
80643c90e3 Grab a snapshot of Marcel's gpt tool. This is still a work-in-progress
but is useful to have handy.  EFI GPT partitions are used instead of the
fdisk+disklabel combination.  They are pure 64 bit LBA, are fully
extensible, support up to 16383 partitons per disk, etc.
2002-07-20 19:27:43 +00:00