aboutsummaryrefslogtreecommitdiff
path: root/sbin/geom
Commit message (Collapse)AuthorAgeFilesLines
* sbin: Automated cleanup of cdefs and other formattingWarner Losh2023-11-272-2/+0
| | | | | | | | | | | | | | | | Apply the following automated changes to try to eliminate no-longer-needed sys/cdefs.h includes as well as now-empty blank lines in a row. Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/ Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/ Remove /\n+#if.*\n#endif.*\n+/ Remove /^#if.*\n#endif.*\n/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/ Sponsored by: Netflix
* Remove $FreeBSD$: two-line nroff patternWarner Losh2023-08-161-2/+0
| | | | Remove /^\.\\"\n\.\\"\s*\$FreeBSD\$$\n/
* Remove $FreeBSD$: one-line sh patternWarner Losh2023-08-163-3/+0
| | | | Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
* Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-162-4/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* Remove $FreeBSD$: two-line .h patternWarner Losh2023-08-162-4/+0
| | | | Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-05-124-4/+4
| | | | | | | | | The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
* geom.8: Fix typos and wordsmithMateusz Piotrowski2023-05-091-3/+7
| | | | MFC after: 3 days
* geom: minor man page updates suggested by igor(1)Ed Maste2022-12-131-3/+3
| | | | | | Reviewed by: pauamma Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D37681
* geom: add vinum as a recognized classEd Maste2022-12-121-1/+4
| | | | | | | | | | And note that it is deprecated. PR: 236569 Reported by: bcran Reviewed by: imp Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D37678
* pkgbase: Put geom utilities in their own packageEmmanuel Vadot2022-10-261-1/+1
| | | | | | | | For most users it's not needed to boot and they are also available in the FreeBSD-rescue package in case an update break and FreeBSD-geom package isn't updated correctly. Differential Revision: https://reviews.freebsd.org/D36224
* Fix for 90e2971 that caused some geli commands to return the wrong exit status.Kirk McKusick2022-07-291-0/+2
| | | | | | | | | | | | | | | | | | | | | The reported problem is that some geli commands exit with a success status when they should exit with a failed status. The gctl_error() function is defined differently in the kernel (in sys/geom/geom_ctl.c) versus in the geom user facilities (in sbin/geom/misc/subr.c). In the kernel, calling gctl_error() causes an error return to be set while in the user version it does not. It was only by a quirk that had been added to the user geom return processing that I "cleaned up" that the lack of the user implementaion to set the error return showed up. This patch adds the missing setting of the error code when calling the user facility gctl_error(). Reported by: Jenkins Debugging by: Alan Somers Debugging by: Cy Schubert Debugging by: Li-Wen Hsu
* Clarify when GEOM utilities exit with success or failure.Kirk McKusick2022-07-161-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | Historically, GEOM utilities (gpart(8), gstripe(8), gmirror(8), etc) used the gctl_error() routine to report errors. If they called gctl_error() they would exit with EXIT_FAILURE, otherwise they would return with EXIT_SUCCESS. If they used gctl_error() to output an informational message, for example when run with the -v (verbose) option, they would mistakenly exit with EXIT_FAILURE. A further limitation of the gctl_error() function was that it could only be called once. Messages from any additional calls to gctl_error() would be silently discarded. To resolve these problems a new function, gctl_msg() has been added. It can be called multiple times to output multiple messages. It also has an additional errno argument which should be zero if it is an informational message or an errno value (EINVAL, EBUSY, etc) if it is an error. When done the gctl_post_messages() function should be called to indicate that all messages have been posted. If any of the messages had a non-zero errno, the utility will EXIT_FAILURE. If only informational messages (with zero errno) were posted, the utility will EXIT_SUCCESS. Tested by: Peter Holm PR: 265184 MFC after: 1 week
* geom(4): Fix a typo in a source code commentGordon Bergling2022-03-281-1/+1
| | | | | | - s/comand/command/ MFC after: 3 days
* GEOM: Introduce partial confxml APIAlexander Motin2022-03-121-3/+7
| | | | | | | | | | | | | | | | | | | | | | Traditionally the GEOM's primary channel of information from kernel to user-space was confxml, fetched by libgeom through kern.geom.confxml sysctl. It is convenient and informative, representing full state of GEOM in a single XML document. But problems start to arise on systems with hundreds of disks, where the full confxml size reaches many megabytes, taking significant time to first write it and then parse. This patch introduces alternative solution, allowing to fetch much smaller XML document, subset of the full confxml, limited to 64KB and representing only one specified geom and optionally its parents. It uses existing GEOM control interface, extended with new "getxml" verb. In case of any error, such as the buffer overflow, it just transparently falls back to traditional full confxml. This patch uses the new API in user-space GEOM tools where it is possible. Reviewed by: imp MFC after: 2 month Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D34529
* geom: Allow "load" command for already loaded modules.Alexander Motin2022-03-081-3/+5
| | | | | | | | | | I see more user-friendly to do nothing if the module is already loaded, rather than returning quite confusing error message. As side effect it allows to avoid std_list_available() call, using quite expensive on large systems geom_gettree(). MFC after: 1 month
* GEOM: Introduce gctl_add_param() API.Alexander Motin2022-03-071-2/+3
| | | | | | | | | Make gctl_add_param() API public, allowing more precise control over parameter flags. Previously it was impossible to properly declare write-only ASCII parameters, used for result reporting, they were declared as read-write binary instead, that was not nice. MFC after: 1 month
* Create a new GEOM utility, gunion(8).Kirk McKusick2022-03-011-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The gunion(8) utility is used to track changes to a read-only disk on a writable disk. Logically, a writable disk is placed over a read-only disk. Write requests are intercepted and stored on the writable disk. Read requests are first checked to see if they have been written on the top (writable disk) and if found are returned. If they have not been written on the top disk, then they are read from the lower disk. The gunion(8) utility can be especially useful if you have a large disk with a corrupted filesystem that you are unsure of how to repair. You can use gunion(8) to place another disk over the corrupted disk and then attempt to repair the filesystem. If the repair fails, you can revert all the changes in the upper disk and be back to the unchanged state of the lower disk thus allowing you to try another approach to repairing it. If the repair is successful you can commit all the writes recorded on the top disk to the lower disk. Another use of the gunion(8) utility is to try out upgrades to your system. Place the upper disk over the disk holding your filesystem that is to be upgraded and then run the upgrade on it. If it works, commit it; if it fails, revert the upgrade. Further details can be found in the gunion(8) manual page. Reviewed by: Chuck Silvers, kib (earlier version) tested by: Peter Holm Differential Revision: https://reviews.freebsd.org/D32697
* Fix regression to verbose behavior introduced in 68bff4a07e.Kirk McKusick2021-11-111-1/+1
| | | | | | | | Reported by: Brad Davis (brd) Reviewed by: Kristof Provost (kp) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D32736 Sponsored by: Netflix
* Allow GEOM utilities to specify a -v option.Kirk McKusick2021-10-292-7/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Geom utilities (geli(8), glabel(8), gmirror(8), gpart(8), gmirror(8), gmountver(8), etc) all use the geom(8) utility as their back end to process their commands and pass them into the kernel. Creating a new utility requires no more than filling out a template describing the commands and arguments that the utility supports. Consider the specification for the very simple gmountver(8) utility: struct g_command class_commands[] = { { "create", G_FLAG_VERBOSE | G_FLAG_LOADKLD, NULL, { G_OPT_SENTINEL }, "[-v] prov ..." }, { "destroy", G_FLAG_VERBOSE, NULL, { { 'f', "force", NULL, G_TYPE_BOOL }, G_OPT_SENTINEL }, "[-fv] name" }, G_CMD_SENTINEL }; It has just two commands of its own: "create" and "destroy" along with the four standard commands "list", "status", "load", and "unload" provided by the base geom(8) utility. The base geom(8) utility allows each command to use the G_FLAG_VERBOSE flag to specify that a command should accept the -v flag and when the -v flag is given the utility prints "Done." if the command completes successfully. In the above example, both of the commands set the G_FLAG_VERBOSE, so have the -v option available. In addition the "destroy" command accepts the -f boolean flag to force the destruction. If the "destroy" command wanted to also print out verbose information, it would need to explicitly declare its intent by adding a line: { 'v', "verbose", NULL, G_TYPE_BOOL }, Before this change, the geom utility would silently ignore the above line in the configuration file, so it was impossible for the utility to know that the -v flag had been set on the command. With this change a geom command can explicitly specify a -v option with a line as given above and handle it as it would any other option. If both a -v option and G_FLAG_VERBOSE are specified for a command then both types of verbose information will be output when that command is run with -v. MFC after: 1 week Sponsored by: Netflix
* geom(8): list geoms with /dev/ prefixRobert Wing2020-12-121-0/+4
| | | | | | | | | | | | | | | | | | | Allow geom(8) to list geoms with the '/dev/' prefix. `geom part show` accepts the '/dev/' prefix but `geom part list` does not. Modify find_geom() in sbin/geom/core/geom.c to be consistent with the behavior of find_geom() in lib/geom/part/geom_part.c. PR: 188213 Reported by: Ronald F. Guilmette <rfg@tristatelogic.com> Reviewed by: imp, kevans Approved by: kevans (mentor) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D27556 Notes: svn path=/head/; revision=368576
* Remove all the RELEASE_CRUNCH defines, they are useless.Warner Losh2019-12-161-1/+1
| | | | | | | | RELEASE_CRUNCH has been broken for a very long time. Remove the last remants from the tree. Notes: svn path=/head/; revision=355821
* Update Makefile.depend filesSimon J. Gerraty2019-12-111-0/+20
| | | | | | | | | | | | | Update a bunch of Makefile.depend files as a result of adding Makefile.depend.options files Reviewed by: bdrewery MFC after: 1 week Sponsored by: Juniper Networks Differential Revision: https://reviews.freebsd.org/D22494 Notes: svn path=/head/; revision=355617
* Add the "-t" option to geom(8) utility, to display geoms hierarchy.Edward Tomasz Napierala2018-09-142-4/+142
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Sample output: % geom -t Geom Class Provider da0 DISK da0 da0 PART da0s1 da0s1 PART da0s1a ffs.da0s1a VFS da0s1a DEV da0s1 DEV da0 DEV da1 DISK da1 swap SWAP da1 DEV cd0 DISK cd0 cd0 DEV Reviewed by: oshogbo Approved by: re (kib) MFC after: 2 weeks Relnotes: yes Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D17151 Notes: svn path=/head/; revision=338684
* Add new option to the geom(8) utility, "-p". It makes it easy to look upEdward Tomasz Napierala2018-09-132-1/+80
| | | | | | | | | | | | | | the GEOM class instance from the provider name. Reviewed by: oshogbo, 0mp Approved by: re (kib) MFC after: 2 weeks Relnotes: yes Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D17116 Notes: svn path=/head/; revision=338640
* Minor usability improvements to geom(8).Edward Tomasz Napierala2018-09-111-9/+12
| | | | | | | | | Approved by: re (kib) MFC after: 2 weeks Sponsored by: DARPA, AFRL Notes: svn path=/head/; revision=338589
* Normalize the g(eom,cache,part,...) build.Brooks Davis2018-06-2571-13609/+20
| | | | | | | | | | | | | | | | | | | | | | | Rather then combining hardlink creation for the geom(8) binary with shared library build, move libraries to src/lib/geom so they are built and installed normally. Create a common Makefile.classes which is included by both lib/geom/Makefile and sbin/geom/Makefile so the symlink and libraries stay in sync. The relocation of libraries allows libraries to be build for 32-bit compat. This also reduces the number of non-standard builds in the system. This commit is not sufficent to run a 32-bit /sbin/geom on a 64-bit system out of the box as it will look in the wrong place for libraries unless GEOM_LIBRARY_PATH is set appropriatly in the environment. Reviewed by: bdrewery Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D15360 Notes: svn path=/head/; revision=335645
* gpart: add EFI alias for MBR partition schemeEd Maste2018-06-171-4/+6
| | | | | | | | Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D15870 Notes: svn path=/head/; revision=335301
* Follow r333233, add fat32lba description to gpart(8)Li-Wen Hsu2018-06-121-1/+6
| | | | | | | | | | | Reviewed by: emaste MFC after: 3 days X-MFC with: r333233 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D15767 Notes: svn path=/head/; revision=334985
* gpart.8: list all options in table form for each commandEd Maste2018-05-111-64/+107
| | | | | | | | | | | | Previously gpart's man page listed some command options in prose, and some in table form, which made it more difficult to use as a reference. Reviewed by: bcr Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D15135 Notes: svn path=/head/; revision=333488
* gpart.8: sort suboptions per mdoc(7)Ed Maste2018-05-111-14/+14
| | | | | | | | | | Alphabetical order, uppercase before lowercase for each letter and with no regard to whether an option takes an argument. Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=333487
* Introduce the 'n' flag for the geli attach command.Mariusz Zaborski2018-05-092-3/+8
| | | | | | | | | | | | | If the 'n' flag is provided the provided key number will be used to decrypt device. This can be used combined with dryrun to verify if the key is set correctly. This can be also used to determine which key slot we want to change on already attached device. Reviewed by: allanjude Differential Revision: https://reviews.freebsd.org/D15309 Notes: svn path=/head/; revision=333439
* Change option dry-run from 'n' to 'C' in geli attach command.Mariusz Zaborski2018-05-092-8/+8
| | | | | | | | | | | | 'n' is used in other commands to define the key index. We should be consistent with that. 'C' option is used by patch(1) to perform dryrun so lets use that. Reviewed by: allanjude Differential Revision: https://reviews.freebsd.org/D15308 Notes: svn path=/head/; revision=333438
* Introduce dry run option for attaching the device.Mariusz Zaborski2018-04-102-3/+7
| | | | | | | | | | | This will allow us to verify if passphrase and key is valid without decrypting whole device. Reviewed by: cem@, allanjude@ Differential Revision: https://reviews.freebsd.org/D15000 Notes: svn path=/head/; revision=332361
* Clarify and clean up some language, and add an explicit example.Warren Block2018-03-021-11/+15
| | | | | | | | Sponsored by: iXsystems Differential Revision: https://reviews.freebsd.org/D12336 Notes: svn path=/head/; revision=330291
* Add GUID and alias for Apple APFS partitionConrad Meyer2018-02-111-1/+3
| | | | | | | | PR: 225813 Submitted by: James Wright <james.wright AT jigsawdezign.com> Notes: svn path=/head/; revision=329119
* geom: don't write stack garbage in disk labelsAlan Somers2018-02-049-0/+16
| | | | | | | | | | | | | | | | | | | | | | Most consumers of g_metadata_store were passing in partially unallocated memory, resulting in stack garbage being written to disk labels. Fix them by zeroing the memory first. gvirstor repeated the same mistake, but in the kernel. Also, glabel's label contained a fixed-size string that wasn't initialized to zero. PR: 222077 Reported by: Maxim Khitrov <max@mxcrypt.com> Reviewed by: cem MFC after: 3 weeks X-MFC-With: 323314 X-MFC-With: 323338 Differential Revision: https://reviews.freebsd.org/D14164 Notes: svn path=/head/; revision=328849
* gnop(8): add the ability to set a nop provider's physical pathAlan Somers2018-01-182-2/+7
| | | | | | | | | | While I'm here, expand the existing tests a bit. MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D13579 Notes: svn path=/head/; revision=328108
* Document gmirror sysctls.Mark Johnston2017-11-301-6/+42
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=326410
* various: general adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-2722-0/+44
| | | | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. No functional change intended. Notes: svn path=/head/; revision=326276
* DIRDEPS_BUILD: Update dependencies.Bryan Drewery2017-10-3117-17/+0
| | | | | | | Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=325188
* Fix alignment of 'last' in autofill.Marcel Moolenaar2017-10-061-1/+1
| | | | | | | | | | | | | | 'last' is the sector number of the last usable sector. Sector numbers start with 0. As such, 'last' is always 1 less than the count of sectors and aligning 'last' down as-is means that the number of free sectors is pessimized by 'alignment - 1' if the number of usable sectors was already a multiple of the alignment. Consequently, gpart(8) failed to create a partition when the alignment and size were such that it would extend to the end of the disk. Notes: svn path=/head/; revision=324369
* Provide an articulate example of how to properly delete partitions andAlexey Dokuchaev2017-09-191-1/+24
| | | | | | | | | | | | | | | | partitioning scheme. Users often get confused and frustrated when trying to delete partition table and getting ``Device busy'' error because they forgot (or did not ever know that they have) to delete all its partitions first, and while the manual page mentions this briefly, it does not stress it out enough. Approved by: ae, manpages (bjk) PR (as inspiration): 196102 Differential Revision: https://reviews.freebsd.org/D12336 Notes: svn path=/head/; revision=323764
* Fix language used in the r322923.Mariusz Zaborski2017-09-171-7/+12
| | | | | | | | | Pointed out by: wblock@ MFC after: 1 week X-MFC-with: r322923 Notes: svn path=/head/; revision=323671
* geom_virstor: Remove wholly unnecessary g_metadata_store copyConrad Meyer2017-09-081-57/+1
| | | | | | | | | Just code cleanup. No functional change. Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=323315
* Audit userspace geom code for leaking memory to diskConrad Meyer2017-09-082-0/+2
| | | | | | | | | | | | | | | | | | Any geom class using g_metadata_store, as well as geom_virstor which duplicated g_metadata_store internally, would dump sectorsize - mdsize bytes of userspace memory following the metadata block stored. This is most or all geom classes (gcache, gconcat, geli, gjournal, glabel, gmirror, gmultipath, graid3, gshsec, gstripe, and geom_virstor). PR: 222077 (comment #3) Reported by: Maxim Khitrov <max AT mxcrypt.com> Reviewed by: des Security: yes Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D12269 Notes: svn path=/head/; revision=323314
* Hide length of geli passphrase during boot.Mariusz Zaborski2017-08-262-12/+58
| | | | | | | | | | | | | Introduce additional flag to the geli which allows to restore previous behavior. Reviewed by: AllanJude@, cem@ (previous version) MFC: 1 month Relnotes: yes Differential Revision: https://reviews.freebsd.org/D11751 Notes: svn path=/head/; revision=322923
* Fix withered handling of r280687, broken by r286719.Alexander Motin2017-04-271-2/+15
| | | | | | | MFC after: 1 week. Notes: svn path=/head/; revision=317515
* Always allow setting number of iterations for the first time.Alexander Motin2017-04-211-1/+3
| | | | | | | | | | | | | | | Before this change it was impossible to set number of PKCS#5v2 iterations, required to set passphrase, if it has two keys and never had any passphrase. Due to present metadata format limitations there are still cases when number of iterations can not be changed, but now it works in cases when it can. PR: 218512 MFC after: 2 weeks Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D10338 Notes: svn path=/head/; revision=317246
* Fix memory leak in "gpart bootcode"Alan Somers2017-04-051-2/+3
| | | | | | | | | | | | Also, annotate that gpart_issue never returns Reported by: Coverity CID: 1007105 MFC after: 3 weeks Sponsored by: Spectra Logic Corp Notes: svn path=/head/; revision=316535
* Fix clearing geom metadata if DIOCGSECTORSIZE failsAlan Somers2017-04-051-3/+2
| | | | | | | | | | | | | An unhandled error case would result in passing SIZE_MAX to malloc. While I'm here, remove an unnecessary NULL check before free Reported by: Coverity CID: 1017793 MFC after: 3 weeks Sponsored by: Spectra Logic Corp Notes: svn path=/head/; revision=316530