summaryrefslogtreecommitdiffstats
path: root/sbin/gpt/gpt.c
Commit message (Collapse)AuthorAgeFilesLines
* Remove gpt(8). It's replaced by gpart(8).marcel2008-06-091-712/+0
|
* Add 'zfs' as an alias for the FreeBSD ZFS UUID.jhb2008-04-071-0/+7
| | | | | | MFC after: 3 days PR: bin/119976 Submitted by: Cian Hughes Ci of nhugh.es
* Map 'boot' to GPT_ENT_TYPE_FREEBSD_BOOT when parsuing UUIDs so that thingsjhb2008-01-301-0/+7
| | | | | | | like 'gpt add -t boot' work. MFC after: 1 week Submitted by: Niki Denev nike_d of cytexbg.com
* Don't look for GPT primary and secondary tables on a disk unless we havejhb2007-11-011-4/+10
| | | | | | | | | a valid PMBR. Without this fix, if label a disk with a GPT, then relabel it with an MBR the GPT tables are still present. If you then try to create a GPT with 'gpt create', gpt(8) will fail to open the device because the partitions in the stale GPT overlap with the slices in the MBR. MFC after: 1 week
* First cut at support for booting a GPT labeled disk via the BIOS bootstrapjhb2007-10-241-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | on i386 and amd64 machines. The overall process is that /boot/pmbr lives in the PMBR (similar to /boot/mbr for MBR disks) and is responsible for locating and loading /boot/gptboot. /boot/gptboot is similar to /boot/boot except that it groks GPT rather than MBR + bsdlabel. Unlike /boot/boot, /boot/gptboot lives in its own dedicated GPT partition with a new "FreeBSD boot" type. This partition does not have a fixed size in that /boot/pmbr will load the entire partition into the lower 640k. However, it is limited in that it can only be 545k. That's still a lot better than the current 7.5k limit for boot2 on MBR. gptboot mostly acts just like boot2 in that it reads /boot.config and loads up /boot/loader. Some more details: - Include uuid_equal() and uuid_is_nil() in libstand. - Add a new 'boot' command to gpt(8) which makes a GPT disk bootable using /boot/pmbr and /boot/gptboot. Note that the disk must have some free space for the boot partition. - This required exposing the backend of the 'add' function as a gpt_add_part() function to the rest of gpt(8). 'boot' uses this to create a boot partition if needed. - Don't cripple cgbase() in the UFS boot code for /boot/gptboot so that it can handle a filesystem > 1.5 TB. - /boot/gptboot has a simple loader (gptldr) that doesn't do any I/O unlike boot1 since /boot/pmbr loads all of gptboot up front. The C portion of gptboot (gptboot.c) has been repocopied from boot2.c. The primary changes are to parse the GPT to find a root filesystem and to use 64-bit disk addresses. Currently gptboot assumes that the first UFS partition on the disk is the / filesystem, but this algorithm will likely be improved in the future. - Teach the biosdisk driver in /boot/loader to understand GPT tables. GPT partitions are identified as 'disk0pX:' (e.g. disk0p2:) which is similar to the /dev names the kernel uses (e.g. /dev/ad0p2). - Add a new "freebsd-boot" alias to g_part() for the new boot UUID. MFC after: 1 month Discussed with: marcel (some things might still change, but am committing what I have so far)
* Fix cut-n-paste bug: compare argument s against known aliases,marcel2006-07-071-6/+6
| | | | | not the global optarg. This bug goes unnoticed because optarg is so far always the actual argument for the formal argument s.
* Improve support for Intel based Macs:marcel2006-06-221-0/+7
| | | | | o Accept hfs as partition type. o Print Apple HFS partitions using a friendly name.
* Move the duplicated logic of parsing partition types into a newmarcel2006-06-221-0/+49
| | | | function called parse_uuid().
* Add support for setting GPT partition labels. The partitions to bemarcel2005-09-011-1/+2
| | | | | | | | | | | | 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
* o Replace unicode16() by utf8_to_utf16().marcel2005-08-311-5/+104
| | | | | | | | 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.
* /* -> /*- for license.marcel2005-08-311-1/+1
|
* - distinguish between the device name (what the user called it on thedes2005-04-241-11/+15
| | | | | | | | | | | | 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
* Add byte swapping and UUID encoding/decoding to allow gpt to be compiledmarcel2004-10-251-20/+56
| | | | | | on big-endian machines. Obtained from: Dan Markarian <markarian at apple dot com>
* Implement a remove command. The remove command iterates the GPTmarcel2004-08-071-1/+1
| | | | | | | | | 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.
* o Save the partition number (=index) in the internal map. The indexmarcel2004-08-071-0/+2
| | | | | | | | | | 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.
* o Newer EFI implementations require that a GPT is preceeded bymarcel2002-12-021-43/+85
| | | | | | | | | | | | | | | | | | 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)
* Remove inclusion of <sys/uuid.h>. We now include <sys/uuid.h> inmarcel2002-11-101-1/+0
| | | | | | <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 :-)
* o Remove the fallback implementations of uuid_create(),marcel2002-11-021-57/+1
| | | | | uuid_from_string(), uuid_is_nil() and uuid_to_string(). o Include <uuid.h> where appropriate.
* o Add functionality to add a GPT partition,marcel2002-10-271-31/+73
| | | | | | | | | | | | 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).
* Add the functionality to create an (empty) GPT from scratch. Themarcel2002-10-251-1/+1
| | | | | | 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.
* Grab a snapshot of Marcel's gpt tool. This is still a work-in-progresspeter2002-07-201-0/+466
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.
OpenPOWER on IntegriCloud