Index: stable/7/sbin/geom/class/part/geom_part.c =================================================================== --- stable/7/sbin/geom/class/part/geom_part.c (revision 180834) +++ stable/7/sbin/geom/class/part/geom_part.c (revision 180835) @@ -1,441 +1,494 @@ /*- - * Copyright (c) 2007 Marcel Moolenaar + * Copyright (c) 2007, 2008 Marcel Moolenaar * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include __FBSDID("$FreeBSD$"); #include #include #include #include #include #include #include #include #include #include #include #include #include #include "core/geom.h" #include "misc/subr.h" #ifdef STATIC_GEOM_CLASSES #define PUBSYM(x) gpart_##x #else #define PUBSYM(x) x #endif uint32_t PUBSYM(lib_version) = G_LIB_VERSION; uint32_t PUBSYM(version) = 0; static char optional[] = ""; static char flags[] = "C"; static char bootcode_param[] = "bootcode"; static char index_param[] = "index"; static char partcode_param[] = "partcode"; static void gpart_bootcode(struct gctl_req *, unsigned int); static void gpart_show(struct gctl_req *, unsigned int); struct g_command PUBSYM(class_commands)[] = { { "add", 0, NULL, { { 'b', "start", NULL, G_TYPE_STRING }, { 's', "size", NULL, G_TYPE_STRING }, { 't', "type", NULL, G_TYPE_STRING }, { 'i', index_param, optional, G_TYPE_STRING }, { 'l', "label", optional, G_TYPE_STRING }, { 'f', "flags", flags, G_TYPE_STRING }, G_OPT_SENTINEL }, "geom", NULL }, { "bootcode", 0, gpart_bootcode, { { 'b', bootcode_param, optional, G_TYPE_STRING }, { 'p', partcode_param, optional, G_TYPE_STRING }, { 'i', index_param, optional, G_TYPE_STRING }, { 'f', "flags", flags, G_TYPE_STRING }, G_OPT_SENTINEL }, "geom", NULL }, { "commit", 0, NULL, G_NULL_OPTS, "geom", NULL }, { "create", 0, NULL, { { 's', "scheme", NULL, G_TYPE_STRING }, { 'n', "entries", optional, G_TYPE_STRING }, { 'f', "flags", flags, G_TYPE_STRING }, G_OPT_SENTINEL }, "provider", NULL }, { "delete", 0, NULL, { { 'i', index_param, NULL, G_TYPE_STRING }, { 'f', "flags", flags, G_TYPE_STRING }, G_OPT_SENTINEL }, "geom", NULL }, { "destroy", 0, NULL, { { 'f', "flags", flags, G_TYPE_STRING }, G_OPT_SENTINEL }, "geom", NULL }, { "modify", 0, NULL, { { 'i', index_param, NULL, G_TYPE_STRING }, { 'l', "label", optional, G_TYPE_STRING }, { 't', "type", optional, G_TYPE_STRING }, { 'f', "flags", flags, G_TYPE_STRING }, G_OPT_SENTINEL }, "geom", NULL }, - { "show", 0, gpart_show, G_NULL_OPTS, NULL, "[geom ...]" }, + { "set", 0, NULL, { + { 'a', "attrib", NULL, G_TYPE_STRING }, + { 'i', index_param, NULL, G_TYPE_STRING }, + { 'f', "flags", flags, G_TYPE_STRING }, + G_OPT_SENTINEL }, + "geom", NULL + }, + { "show", 0, gpart_show, { + { 'l', "show_label", NULL, G_TYPE_BOOL }, + { 'r', "show_rawtype", NULL, G_TYPE_BOOL }, + G_OPT_SENTINEL }, + NULL, "[-lr] [geom ...]" + }, { "undo", 0, NULL, G_NULL_OPTS, "geom", NULL }, + { "unset", 0, NULL, { + { 'a', "attrib", NULL, G_TYPE_STRING }, + { 'i', index_param, NULL, G_TYPE_STRING }, + { 'f', "flags", flags, G_TYPE_STRING }, + G_OPT_SENTINEL }, + "geom", NULL + }, G_CMD_SENTINEL }; static struct gclass * find_class(struct gmesh *mesh, const char *name) { struct gclass *classp; LIST_FOREACH(classp, &mesh->lg_class, lg_class) { if (strcmp(classp->lg_name, name) == 0) return (classp); } return (NULL); } static struct ggeom * find_geom(struct gclass *classp, const char *name) { struct ggeom *gp; LIST_FOREACH(gp, &classp->lg_geom, lg_geom) { if (strcmp(gp->lg_name, name) == 0) return (gp); } return (NULL); } static const char * find_geomcfg(struct ggeom *gp, const char *cfg) { struct gconfig *gc; LIST_FOREACH(gc, &gp->lg_config, lg_config) { if (!strcmp(gc->lg_name, cfg)) return (gc->lg_val); } return (NULL); } static const char * find_provcfg(struct gprovider *pp, const char *cfg) { struct gconfig *gc; LIST_FOREACH(gc, &pp->lg_config, lg_config) { if (!strcmp(gc->lg_name, cfg)) return (gc->lg_val); } return (NULL); } static struct gprovider * find_provider(struct ggeom *gp, unsigned long long minsector) { struct gprovider *pp, *bestpp; unsigned long long offset; unsigned long long sector, bestsector; bestpp = NULL; LIST_FOREACH(pp, &gp->lg_provider, lg_provider) { offset = atoll(find_provcfg(pp, "offset")); sector = offset / pp->lg_sectorsize; if (sector < minsector) continue; if (bestpp != NULL && sector >= bestsector) continue; bestpp = pp; bestsector = sector; } return (bestpp); } static const char * fmtsize(long double rawsz) { static char buf[32]; static const char *sfx[] = { "B", "KB", "MB", "GB", "TB" }; long double sz; int sfxidx; sfxidx = 0; sz = (long double)rawsz; while (sfxidx < 4 && sz > 1099.0) { sz /= 1000; sfxidx++; } sprintf(buf, "%.1Lf%s", sz, sfx[sfxidx]); return (buf); } +static const char * +fmtattrib(struct gprovider *pp) +{ + static char buf[64]; + const char *val; + + val = find_provcfg(pp, "attrib"); + if (val == NULL) + return (""); + snprintf(buf, sizeof(buf), " [%s] ", val); + return (buf); +} + static void -gpart_show_geom(struct ggeom *gp) +gpart_show_geom(struct ggeom *gp, const char *element) { struct gprovider *pp; const char *s, *scheme; unsigned long long first, last, sector, end; unsigned long long offset, length, secsz; int idx, wblocks, wname; scheme = find_geomcfg(gp, "scheme"); s = find_geomcfg(gp, "first"); first = atoll(s); s = find_geomcfg(gp, "last"); last = atoll(s); wblocks = strlen(s); wname = strlen(gp->lg_name); pp = LIST_FIRST(&gp->lg_consumer)->lg_provider; secsz = pp->lg_sectorsize; printf("=>%*llu %*llu %*s %s (%s)\n", wblocks, first, wblocks, (last - first + 1), wname, gp->lg_name, scheme, fmtsize(pp->lg_mediasize)); while ((pp = find_provider(gp, first)) != NULL) { s = find_provcfg(pp, "offset"); offset = atoll(s); sector = offset / secsz; s = find_provcfg(pp, "length"); length = atoll(s); s = find_provcfg(pp, "index"); idx = atoi(s); end = sector + length / secsz; if (first < sector) { printf(" %*llu %*llu %*s - free - (%s)\n", wblocks, first, wblocks, sector - first, wname, "", fmtsize((sector - first) * secsz)); } - printf(" %*llu %*llu %*d %s (%s)\n", + printf(" %*llu %*llu %*d %s %s (%s)\n", wblocks, sector, wblocks, end - sector, - wname, idx, - find_provcfg(pp, "type"), fmtsize(pp->lg_mediasize)); + wname, idx, find_provcfg(pp, element), + fmtattrib(pp), fmtsize(pp->lg_mediasize)); first = end; } if (first <= last) { printf(" %*llu %*llu %*s - free - (%s)\n", wblocks, first, wblocks, last - first + 1, wname, "", fmtsize((last - first + 1) * secsz)); } printf("\n"); } +static int +gpart_show_hasopt(struct gctl_req *req, const char *opt, const char *elt) +{ + + if (!gctl_get_int(req, opt)) + return (0); + + if (elt != NULL) + errx(EXIT_FAILURE, "-l and -r are mutually exclusive"); + + return (1); +} + static void gpart_show(struct gctl_req *req, unsigned int fl __unused) { struct gmesh mesh; struct gclass *classp; struct ggeom *gp; - const char *name; + const char *element, *name; int error, i, nargs; + element = NULL; + if (gpart_show_hasopt(req, "show_label", element)) + element = "label"; + if (gpart_show_hasopt(req, "show_rawtype", element)) + element = "rawtype"; + if (element == NULL) + element = "type"; + name = gctl_get_ascii(req, "class"); if (name == NULL) abort(); error = geom_gettree(&mesh); if (error != 0) errc(EXIT_FAILURE, error, "Cannot get GEOM tree"); classp = find_class(&mesh, name); if (classp == NULL) { geom_deletetree(&mesh); errx(EXIT_FAILURE, "Class %s not found.", name); } nargs = gctl_get_int(req, "nargs"); if (nargs > 0) { for (i = 0; i < nargs; i++) { name = gctl_get_ascii(req, "arg%d", i); gp = find_geom(classp, name); if (gp != NULL) - gpart_show_geom(gp); + gpart_show_geom(gp, element); else errx(EXIT_FAILURE, "No such geom: %s.", name); } } else { LIST_FOREACH(gp, &classp->lg_geom, lg_geom) { - gpart_show_geom(gp); + gpart_show_geom(gp, element); } } geom_deletetree(&mesh); } static void * gpart_bootfile_read(const char *bootfile, ssize_t *size) { struct stat sb; void *code; int fd; if (stat(bootfile, &sb) == -1) err(EXIT_FAILURE, "%s", bootfile); if (!S_ISREG(sb.st_mode)) errx(EXIT_FAILURE, "%s: not a regular file", bootfile); if (sb.st_size == 0) errx(EXIT_FAILURE, "%s: empty file", bootfile); if (*size > 0 && sb.st_size >= *size) errx(EXIT_FAILURE, "%s: file too big (%zu limit)", bootfile, *size); *size = sb.st_size; fd = open(bootfile, O_RDONLY); if (fd == -1) err(EXIT_FAILURE, "%s", bootfile); code = malloc(*size); if (code == NULL) err(EXIT_FAILURE, NULL); if (read(fd, code, *size) != *size) err(EXIT_FAILURE, "%s", bootfile); close(fd); return (code); } static void gpart_write_partcode(struct gctl_req *req, int idx, void *code, ssize_t size) { char dsf[128]; struct gmesh mesh; struct gclass *classp; struct ggeom *gp; struct gprovider *pp; const char *s; int error, fd; s = gctl_get_ascii(req, "class"); if (s == NULL) abort(); error = geom_gettree(&mesh); if (error != 0) errc(EXIT_FAILURE, error, "Cannot get GEOM tree"); classp = find_class(&mesh, s); if (classp == NULL) { geom_deletetree(&mesh); errx(EXIT_FAILURE, "Class %s not found.", s); } s = gctl_get_ascii(req, "geom"); gp = find_geom(classp, s); if (gp == NULL) errx(EXIT_FAILURE, "No such geom: %s.", s); LIST_FOREACH(pp, &gp->lg_provider, lg_provider) { s = find_provcfg(pp, "index"); if (s == NULL) continue; if (atoi(s) == idx) break; } if (pp != NULL) { snprintf(dsf, sizeof(dsf), "/dev/%s", pp->lg_name); fd = open(dsf, O_WRONLY); if (fd == -1) err(EXIT_FAILURE, "%s", dsf); if (lseek(fd, size, SEEK_SET) != size) errx(EXIT_FAILURE, "%s: not enough space", dsf); if (lseek(fd, 0, SEEK_SET) != 0) err(EXIT_FAILURE, "%s", dsf); if (write(fd, code, size) != size) err(EXIT_FAILURE, "%s", dsf); close(fd); } else errx(EXIT_FAILURE, "invalid partition index"); geom_deletetree(&mesh); } static void gpart_bootcode(struct gctl_req *req, unsigned int fl __unused) { const char *s; char *sp; void *bootcode, *partcode; size_t bootsize, partsize; int error, idx; if (gctl_has_param(req, bootcode_param)) { s = gctl_get_ascii(req, bootcode_param); bootsize = 64 * 1024; /* Arbitrary limit. */ bootcode = gpart_bootfile_read(s, &bootsize); error = gctl_change_param(req, bootcode_param, bootsize, bootcode); if (error) errc(EXIT_FAILURE, error, "internal error"); } else { bootcode = NULL; bootsize = 0; } if (gctl_has_param(req, partcode_param)) { s = gctl_get_ascii(req, partcode_param); partsize = bootsize * 1024; partcode = gpart_bootfile_read(s, &partsize); error = gctl_delete_param(req, partcode_param); if (error) errc(EXIT_FAILURE, error, "internal error"); } else { partcode = NULL; partsize = 0; } if (gctl_has_param(req, index_param)) { if (partcode == NULL) errx(EXIT_FAILURE, "-i is only valid with -p"); s = gctl_get_ascii(req, index_param); idx = strtol(s, &sp, 10); if (idx < 1 || *s == '\0' || *sp != '\0') errx(EXIT_FAILURE, "invalid partition index"); error = gctl_delete_param(req, index_param); if (error) errc(EXIT_FAILURE, error, "internal error"); } else idx = 0; if (partcode != NULL) { if (idx == 0) errx(EXIT_FAILURE, "missing -i option"); gpart_write_partcode(req, idx, partcode, partsize); } else { if (bootcode == NULL) errx(EXIT_FAILURE, "no -b nor -p"); } if (bootcode != NULL) { s = gctl_issue(req); if (s != NULL) errx(EXIT_FAILURE, "%s", s); } } Index: stable/7/sbin/geom/class/part/gpart.8 =================================================================== --- stable/7/sbin/geom/class/part/gpart.8 (revision 180834) +++ stable/7/sbin/geom/class/part/gpart.8 (revision 180835) @@ -1,370 +1,416 @@ .\" Copyright (c) 2007, 2008 Marcel Moolenaar .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" $FreeBSD$ .\" -.Dd Jun 6, 2008 +.Dd Jun 17, 2008 .Dt GPART 8 .Os .Sh NAME .Nm gpart .Nd "control utility for the disk partitioning GEOM class" .Sh SYNOPSIS To add support for the disk partitioning GEOM class, place one or more of the following lines in your kernel configuration file: .Bd -ragged -offset indent .Cd "options GEOM_PART_APM" .Cd "options GEOM_PART_BSD" .Cd "options GEOM_PART_GPT" .Cd "options GEOM_PART_MBR" .Cd "options GEOM_PART_PC98" .Cd "options GEOM_PART_VTOC8" .Ed .Pp The GEOM_PART_APM option adds support for the Apple Partition Map (APM) found on Apple Macintosh computers. The GEOM_PART_BSD option adds support for the traditional BSD disklabel. The GEOM_PART_GPT option adds support for the GUID Partition Table (GPT) found on Intel Itanium computers and Intel-based Macintosh computers. The GEOM_PART_MBR option adds support for the Master Boot Record (MBR) found on PCs and used on many removable media. The GEOM_PART_PC98 option adds support for the MBR variant as used on NEC PC-98 computers. The GEOM_PART_VTOC8 option adds support for Sun's SMI VTOC8 label as found on UltraSPARC-based computers. .Pp Usage of the .Xr gpart 8 utility: .Pp .\" ==== ADD ==== .Nm .Cm add .Fl b Ar start .Fl s Ar size .Fl t Ar type .Op Fl i Ar index .Op Fl l Ar label .Op Fl f Ar flags .Ar geom .\" ==== BOOTCODE ==== .Nm .Cm bootcode .Op Fl b Ar bootcode .Op Fl p Ar partcode Fl i Ar index .Op Fl f Ar flags .Ar geom .\" ==== COMMIT ==== .Nm .Cm commit .Ar geom .\" ==== CREATE ==== .Nm .Cm create .Fl s Ar scheme .Op Fl n Ar entries .Op Fl f Ar flags .Ar provider .\" ==== DELETE ==== .Nm .Cm delete .Fl i Ar index .Op Fl f Ar flags .Ar geom .\" ==== DESTROY ==== .Nm .Cm destroy .Op Fl f Ar flags .Ar geom .\" ==== MODIFY ==== .Nm .Cm modify .Fl i Ar index .Op Fl l Ar label .Op Fl t Ar type .Op Fl f Ar flags .Ar geom +.\" ==== SET ==== +.Nm +.Cm set +.Fl a Ar attrib +.Fl i Ar index +.Op Fl f Ar flags +.Ar geom .\" ==== SHOW ==== .Nm .Cm show .Op Ar geom ... .\" ==== UNDO ==== .Nm .Cm undo .Ar geom +.\" ==== UNSET ==== +.Nm +.Cm unset +.Fl a Ar attrib +.Fl i Ar index +.Op Fl f Ar flags +.Ar geom .\" .Sh DESCRIPTION The .Nm utility is used to partition GEOM providers, normally disks. The first argument of which is the action to be taken: .Bl -tag -width ".Cm wwwwwww" .\" ==== ADD ==== .It Cm add Add a new partition to the partitioning scheme given by .Ar geom . The partition begins on the logical block address given by the .Fl b Ar start option. Its size is expressed in logical block numbers and given by the .Fl s Ar size option. The type of the partition is given by the .Fl t Ar type option. Partition types are discussed in the section entitled "Partition Types". .Pp Addition options include: .Bl -tag -width ".Fl w Ar wwwwwwww" .It Fl i Ar index The index in the partition table at which the new partition is to be placed. The index determines the name of the device special file used to represent the partition. .It Fl l Ar label The label attached to the partition. This option is only valid when used on partitioning schemes that support partition labels. .It Fl f Ar flags Additional operational flags. See the section entitled "Operational flags" below for a discussion about its use. .El .\" ==== BOOTCODE ==== .It Cm bootcode Embed bootstrap code into the partitioning scheme's metadata on the .Ar geom (using .Fl b Ar bootcode ) or write bootstrap code into a partition (using .Fl p Ar partcode and .Fl i Ar index ) . Not all partitioning schemes have embedded bootstrap code, so the .Fl b Ar bootcode option is scheme-specific in nature. For the GPT scheme, embedded bootstrap code is supported. The bootstrap code is embedded in the protective MBR rather than the GPT. The .Fl b Ar bootcode option specifies a file that contains the bootstrap code. The contents and size of the file are determined by the partitioning scheme. For the MBR scheme, it's a 512 byte file of which the first 446 bytes are installed as bootstrap code. The .Fl p Ar partcode option specifies a file that contains the bootstrap code intended to be written to a partition. The partition is specified by the .Fl i Ar index option. The size of the file must be smaller than the size of the partition. +.Pp +Addition options include: +.Bl -tag -width ".Fl w Ar wwwwwww" +.It Fl f Ar flags +Additional operational flags. +See the section entitled "Operational flags" below for a discussion +about its use. +.El .\" ==== COMMIT ==== .It Cm commit Commit any pending changes for geom .Ar geom . All actions are being committed by default and will not result in pending changes. Actions can be modified with the .Fl f Ar flags option so that they are not being committed by default. As such, they become pending. Pending changes are reflected by the geom and the .Nm utility, but they are not actually written to disk. The .Cm commit action will write any and all pending changes to disk. .\" ==== CREATE ==== .It Cm create Create a new partitioning scheme on a provider given by .Ar provider . The .Fl s Ar scheme option determines the scheme to use. The kernel needs to have support for a particular scheme before that scheme can be used to partition a disk. .Pp Addition options include: .Bl -tag -width ".Fl w Ar wwwwwww" .It Fl n Ar entries The number of entries in the partition table. Every partitioning scheme has a minimum and a maximum number of entries and this option allows tables to be created with the number of entries that lies anywhere between the minimum and the maximum. Some schemes have a maximum equal to the minimum and some schemes have a maximum large enough to be considered unlimited. By default, partition tables are created with the minimum number of entries. .It Fl f Ar flags Additional operational flags. See the section entitled "Operational flags" below for a discussion about its use. .El .\" ==== DELETE ==== .It Cm delete Delete a partition from geom .Ar geom and further identified by the .Fl i Ar index option. The partition cannot be actively used by the kernel. .Pp Addition options include: .Bl -tag -width ".Fl w Ar wwwwwww" .It Fl f Ar flags Additional operational flags. See the section entitled "Operational flags" below for a discussion about its use. .El .\" ==== DESTROY ==== .It Cm destroy Destroy the partitioning scheme as implemented by geom .Ar geom . .Pp Addition options include: .Bl -tag -width ".Fl w Ar wwwwwww" .It Fl f Ar flags Additional operational flags. See the section entitled "Operational flags" below for a discussion about its use. .El .\" ==== MODIFY ==== .It Cm modify Modify a partition from geom .Ar geom and further identified by the .Fl i Ar index option. Only the the type and/or label of the partition can be modified. To change the type of a partition, specify the new type with the .Fl t Ar type option. To change the label of a partition, specify the new label with the .Fl l Ar label option. Not all partitioning schemes support labels and it is invalid to try to change a partition label in such cases. .Pp Addition options include: .Bl -tag -width ".Fl w Ar wwwwwww" .It Fl f Ar flags Additional operational flags. See the section entitled "Operational flags" below for a discussion about its use. .El +.\" ==== SET ==== +.It Cm set +Set the named attribute on the partition entry. +.Pp +Addition options include: +.Bl -tag -width ".Fl w Ar wwwwwww" +.It Fl f Ar flags +Additional operational flags. +See the section entitled "Operational flags" below for a discussion +about its use. +.El .\" ==== SHOW ==== .It Cm show Show the current partition information of the specified geoms or all geoms if none are specified. .\" ==== UNDO ==== .It Cm undo Revert any pending changes. This action is the opposite of the .Cm commit action and can be used to undo any changes that have not been committed. +.\" ==== UNSET ==== +.It Cm unset +Clear the named attribute on the partition entry. +.Pp +Addition options include: +.Bl -tag -width ".Fl w Ar wwwwwww" +.It Fl f Ar flags +Additional operational flags. +See the section entitled "Operational flags" below for a discussion +about its use. .El +.El +.\" .Sh PARTITION TYPES The .Nm utility uses symbolic names for common partition types to avoid that the user needs to know what the partitioning scheme in question is and what the actual number or identification needs to be used for a particular type. the .Nm utility also allows the user to specify scheme-specific partition types for partition types that don't have symbol names. The symbolic names currently understood are: .Bl -tag -width "wwwwwwwwwwwww" .It efi The system partition for computers that use the Extensible Firmware Interface (EFI). In such cases, the GPT partitioning scheme is being used and the actual partition type for the system partition can also be specified as "!c12a7328-f81f-11d2-ba4b-00a0c93ec93ab". .It freebsd A FreeBSD partition that uses the BSD disklabel to sub-divide the partition into file systems. This is a legacy partition type and should not be used for the APM or GPT schemes. The scheme-specific types are "!165" for MBR, "!FreeBSD" for APM, and "!516e7cb4-6ecf-11d6-8ff8-00022d09712b" for GPT. +.It freebsd-boot +A FreeBSD partition dedicated to bootstrap code. +The scheme-specific type is "!83bd6b9d-7f41-11dc-be0b-001560b84f0f" for GPT. .It freebsd-swap A FreeBSD partition dedicated to swap space. The scheme-specific types are "!FreeBSD-swap" for APM, and "!516e7cb5-6ecf-11d6-8ff8-00022d09712b" for GPT. .It freebsd-ufs A FreeBSD partition that contains a UFS or UFS2 file system. the scheme-specific types are "!FreeBSD-UFS" for APM, and "!516e7cb6-6ecf-11d6-8ff8-00022d09712b" for GPT. .It freebsd-vinum A FreeBSD partition that contains a Vinum volume. The scheme-specific types are "!FreeBSD-Vinum" for APM, and "!516e7cb8-6ecf-11d6-8ff8-00022d09712b" for GPT. +.It freebsd-zfs +A FreeBSD partition that contains a ZFS volume. +The scheme-specific types are "!FreeBSD-ZFS" for APM, and +"!516e7cba-6ecf-11d6-8ff8-00022d09712b" for GPT. .It mbr A partition that is sub-partitioned by a master boot record (MBR). This type is known as "!024dee41-33e7-11d3-9d69-0008c781f39f" by GPT. .El .Sh OPERATIONAL FLAGS Actions other than the .Cm commit and .Cm undo actions take an optional .Fl f Ar flags option. This option is used to specify action-specific operational flags. By default, the .Nm utility defines the 'C' flag so that the action is immediately committed. The user can specify .Fl f Ar x to have the action result in a pending change that can later, with other pending changes, be committed as a single compound change with the .Cm commit action or reverted with the .Cm undo action. .Sh EXIT STATUS Exit status is 0 on success, and 1 if the command fails. .Sh SEE ALSO .Xr geom 4 , .Xr geom 8 , .Sh HISTORY The .Nm utility appeared in .Fx 7.0 . -.Sh BUGS -The MBR partitioning scheme cannot yet be used to create a bootable -MBR. -.Pp -Support for the PC98 or Sun partitioning schemes is not yet present. -The BSD disklabel is also not supported yet. .Sh AUTHORS .An Marcel Moolenaar Aq marcel@FreeBSD.org Index: stable/7/sbin/geom/class/part =================================================================== --- stable/7/sbin/geom/class/part (revision 180834) +++ stable/7/sbin/geom/class/part (revision 180835) Property changes on: stable/7/sbin/geom/class/part ___________________________________________________________________ Modified: svn:mergeinfo ## -0,0 +0,1 ## Merged /head/sbin/geom/class/part:r179689-179854 Index: stable/7/sbin/geom/misc =================================================================== --- stable/7/sbin/geom/misc (revision 180834) +++ stable/7/sbin/geom/misc (revision 180835) Property changes on: stable/7/sbin/geom/misc ___________________________________________________________________ Modified: svn:mergeinfo ## -0,0 +0,1 ## Merged /head/sbin/geom/misc:r179689-179854 Index: stable/7/sbin/geom =================================================================== --- stable/7/sbin/geom (revision 180834) +++ stable/7/sbin/geom (revision 180835) Property changes on: stable/7/sbin/geom ___________________________________________________________________ Added: svn:mergeinfo ## -0,0 +0,1 ## Merged /head/sbin/geom:r179689-179854