Up to [cvs.NetBSD.org] / src / sbin / gpt
Request diff between arbitrary revisions
Keyword substitution: kv
Default branch: MAIN
When generating timestamp based GUIDs for reproducable builds - increment timestamp by 100ns for each partition. - use the standard time-based UUID format (type 1) and don't pretend it's a random number (type 4). - make the -T option actually work for the uuid command. Random GUIDs: start size index contents 34 1000 1 GPT part - d93ba067-a788-4ce0-99b8-0ead51f00215 1034 2000 2 GPT part - bebba77a-7fdc-4ca0-a1bf-7450aa871d41 d93ba067-a788-4ce0-99b8-0ead51f00215: Version 4 Random Variant 2 RFC 4122 Data D9 3B A0 67 A7 88 4C E0 99 B8 0E AD 51 F0 02 15 bebba77a-7fdc-4ca0-a1bf-7450aa871d41: Version 4 Random Variant 2 RFC 4122 Data BE BB A7 7A 7F DC 4C A0 A1 BF 74 50 AA 87 1D 41 Timestamp based GUIDs: start size index contents 34 1000 1 GPT part - 0a524600-8eba-11ef-8000-000000000000 1034 2000 2 GPT part - 0a524601-8eba-11ef-8000-000000000000 0a524600-8eba-11ef-8000-000000000000: Version 1 Time and MAC based Variant 2 RFC 4122 Node 00:00:00:00:00:00 Clock 0 Time 2024-10-20T08:05:16.000000.0Z 0a524601-8eba-11ef-8000-000000000000: Version 1 Time and MAC based Variant 2 RFC 4122 Node 00:00:00:00:00:00 Clock 0 Time 2024-10-20T08:05:16.000000.1Z Node (host MAC address) and clock (sequence number incremented whenever the time went backwards) are left undefined (all zero) for our purpose.
Add -U option to specify new UUID Add OpenBSD from Anon Ymous
gpt(8): Make gpt type array and enum match again. Add cross-referencing comment to reduce the probability of these getting out of sync again. Should fix a slew of failing tests since kre's recent change to add windows-recovery to the array but not to the enum: sbin/gpt/t_gpt:create_2part sbin/gpt/t_gpt:migrate_disklabel sbin/gpt/t_gpt:recover_backup sbin/gpt/t_gpt:recover_primary sbin/gpt/t_gpt:remove_2part sbin/gpt/t_gpt:resize_2part sbin/gpt/t_gpt:restore_2part Fail: stdout does not match golden output --- /usr/tests/sbin/gpt/gpt.2part.show.normal 2023-09-26 15:48:30.000000000 +0000 +++ /tmp/check.sc6ylB/stdout 2023-09-26 23:30:42.388157924 +0000 @@ -3,6 +3,6 @@ 1 1 Pri GPT header 2 32 Pri GPT table 34 1024 1 GPT part - EFI System - 1058 9150 2 GPT part - NetBSD FFSv1/FFSv2 + 1058 9150 2 GPT part - NetBSD Cryptographic Disk 10208 32 Sec GPT table 10240 1 Sec GPT header https://releng.netbsd.org/b5reports/i386/commits-2023.09.html#build-2023.09.26.15.47.11
Recognise Windows Recovery partitions.
Mostly merge changes from HEAD upto 20200411
Merge changes from current as of 20200406
Now that we use the same UUID for ZFS as FreeBSD, drop the FreeBSD marker from the description.
adjust gpt_uuid_generate() to accept gpt==NULL
Sync with HEAD
Sync with HEAD, resolve a few conflicts
Add a query function (for external code) to enumerate the know guids. Add recently added VMware GUIDs to the internal enum type. Fix some short names (bogus + duplicate).
Sync with HEAD, resolve a couple of conflicts
add support to detect the 3 vmware GPT partition types: - VMKcore (dump partition) - VMFS - VMware reserved this enables vmkcore partitions for netbsd swap or dump, as well as naming all of them.
Catch up to current for the following, requested by sborrill in ticket #1629: sbin/gpt/gpt_private.h up to 1.2 sbin/gpt/header.c up to 1.9 sbin/gpt/main.c up to 1.11 sbin/gpt/drvctl.c delete sbin/gpt/Makefile up to 1.18 sbin/gpt/add.c up to 1.44 sbin/gpt/backup.c up to 1.18 sbin/gpt/biosboot.c up to 1.30 sbin/gpt/create.c up to 1.23 sbin/gpt/destroy.c up to 1.10 sbin/gpt/gpt.8 up to 1.63 sbin/gpt/gpt.c up to 1.75 sbin/gpt/gpt.h up to 1.38 sbin/gpt/gpt_uuid.c up to 1.15 sbin/gpt/gpt_uuid.h up to 1.7 sbin/gpt/label.c up to 1.29 sbin/gpt/map.c up to 1.14 sbin/gpt/map.h up to 1.6 sbin/gpt/migrate.c up to 1.33 sbin/gpt/recover.c up to 1.18 sbin/gpt/remove.c up to 1.22 sbin/gpt/resize.c up to 1.23 sbin/gpt/resizedisk.c up to 1.17 sbin/gpt/restore.c up to 1.18 sbin/gpt/set.c up to 1.14 sbin/gpt/show.c up to 1.41 sbin/gpt/type.c up to 1.15 sbin/gpt/unset.c up to 1.14 Many changes including: - Significant refactoring - PR/51230: Add the ability to set the active flag in the PMBR - Let individual commands decide if ioctl(DIOCMWEDGES) should be done - Add a "header" subcommand that displays information about the size of the disk along with information from the GPT header if it exists - Add listing commands for type, set and unset - Add help and formatting for set and unset - Change show to print all the attribute info in one line. - Improve documentation, including booting and exit status - Check device parameter to avoid segfaults
Sync with HEAD
Sync with HEAD
allow 0 timestamp
Add -T timestamp for reproducible builds.
Add listing commands for type, set and unset. Add help and formatting for set and unset. Change show to print all the attribute info in one line.
WARNS=6
merge command line parsers and check all memory allocations.
Pull up following revision(s) (requested by jnemeth in ticket #774): sbin/gpt/Makefile: revisions 1.9-1.13 sbin/gpt/add.c: revisions 1.25-1.27 sbin/gpt/backup.c: revisions 1.2-1.8 sbin/gpt/biosboot.c: revisions 1.8-1.14 sbin/gpt/create.c: revisions 1.8-1.12 sbin/gpt/destroy.c: revisions 1.5-1.6 sbin/gpt/drvctl.c: revision 1.1 sbin/gpt/gpt.8: revisions 1.29-1.36 sbin/gpt/gpt.c: revisions 1.29-1.40 sbin/gpt/gpt.h: revisions 1.12-1.18 sbin/gpt/gpt_uuid.c: revisions 1.1-1.10 sbin/gpt/gpt_uuid.h: revisions 1.1-1.3 sbin/gpt/label.c: revisions 1.15-1.18 sbin/gpt/map.c: revision 1.7 sbin/gpt/migrate.c: revisions 1.15-1.21 sbin/gpt/recover.c: revision 1.5 sbin/gpt/remove.c: revisions 1.13-1.16 sbin/gpt/resize.c: revisions 1.9-1.11 sbin/gpt/resizedisk.c: revisions 1.1-1.6 sbin/gpt/restore.c: revisions 1.2-1.7 sbin/gpt/set.c: revisions 1.3-1.5 sbin/gpt/show.c: revision 1.16-1.21 sbin/gpt/type.c: revisions 1.1-1.6 sbin/gpt/unset.c: revisions 1.3-1.5 - record the sector size of the disk - correct confusion with end_cylinder and end_sector in MBRs -- - dump all partitions, not just ones that are in use - while here, squash a memory leak It shouldn't be necessary to backup unused partitions, however the partition GUID is created at the time the GPT is created and is never changed. It shouldn't matter if the GUID of an unused partition changes, but there may be some special case where it does. Since it isn't a big deal to record the unused partitions, might as well do it. -- Initial cut of gpt restore. This functions correctly in testing, but isn't all that pretty. It has minimal error testing and may leak memory. It also only works with empty disks. If passed "-F" flag, it will blank the disk for you. -- document the new restore subcommand -- - make gpt_gpt() available for use directly by subcommands - create new resizedisk disk subcommand for relocating backup GPT -- Fix compile error observed on i386. Use PRIu64. -- no C99isms in tool code -- - handle a GPT that isn't an exact multiple of a sector - adjust PMBR size, in case new disk is a different size - don't leak as much memory - clean up error handling somewhat -- PR/44218 - David Young -- add "type" subcommand to change a partition type -- PR/47990 - Dr. Wolfgang Stukenbrock -- add "-L <label>" as selector option -- minor toolification: need libprop... -- more toolification -- more toolification changes -- remove compat defines. -- Add internal uuid support, since the linux+macos versions of the library are different than than *bsd ones, and others might not have it at all. -- Check size of correct buffer. Note, just being pedantic as the buffer being checked is the same size as the one that should have been checked. -- correctly show partition type in the new world order -- actually return the uuid when parsing one that is in numeric format -- using random values for hdr->hdr_guid does not work very well -- oops, forgot to update end of data area -- It's HAVE_NBTOOL_CONFIG_H, not HAVE_NBTOOLS_CONFIG_H -- Fix tools build on !NetBSD. -- include <sys/endian.h> for both the non-tools build, and the tools build on a host where the file exists. Fixes a build problem on FreeBSD, reported by Herbert J. Skuhra, where tools/compat's configure detected that be32dec() and friends were available in the host's <sys/endian.h>, so tools/compat did not provide its own versions. -- "0" is not guaranteed to be unique -- provide a copy of the kernel uuid generator (with portable API calls) for tools. -- Allow specifying sector and media size on the command line. -- Remove trailing whitespace. -- Make gpt(8) generate v4 (random) uuids. Don't needlessly leak your date/time and MAC address when you edit the disk. Read from /dev/urandom rather than calling arc4random or anything, since this is a tool. (Cygwin seems to have /dev/urandom, but yell if this breaks the build on your exotic platform because it lacks /dev/urandom.) ok apb -- Paranoia: choke noisily on EOF from /dev/urandom. -- Report the argument instead of (null) when opendisk fails. -- handle constness -- handle constness better -- Add some more common partition types. -- Bump date for previous. -- Fix handling of -t option for the type command. Match any type, when no option is given, just like for the label command. -- Factor out the getdisksize() drvctl method, and provide an alternative that directly uses the disk ioctl's instead of relying on the drvctl device driver which is currently not mandatory.
file gpt_uuid.c was added on branch netbsd-7 on 2015-06-02 19:49:38 +0000
Add some more common partition types.
Paranoia: choke noisily on EOF from /dev/urandom.
Make gpt(8) generate v4 (random) uuids. Don't needlessly leak your date/time and MAC address when you edit the disk. Read from /dev/urandom rather than calling arc4random or anything, since this is a tool. (Cygwin seems to have /dev/urandom, but yell if this breaks the build on your exotic platform because it lacks /dev/urandom.) ok apb
provide a copy of the kernel uuid generator (with portable API calls) for tools.
"0" is not guaranteed to be unique
include <sys/endian.h> for both the non-tools build, and the tools build on a host where the file exists. Fixes a build problem on FreeBSD, reported by Herbert J. Skuhra, where tools/compat's configure detected that be32dec() and friends were available in the host's <sys/endian.h>, so tools/compat did not provide its own versions.
It's HAVE_NBTOOL_CONFIG_H, not HAVE_NBTOOLS_CONFIG_H
actually return the uuid when parsing one that is in numeric format
correctly show partition type in the new world order
Add internal uuid support, since the linux+macos versions of the library are different than than *bsd ones, and others might not have it at all.