aboutsummaryrefslogtreecommitdiff
path: root/sbin/gpt
Commit message (Collapse)AuthorAgeFilesLines
* Remove gpt(8). It's replaced by gpart(8).Marcel Moolenaar2008-06-0915-3544/+0
| | | | Notes: svn path=/head/; revision=179690
* Add 'zfs' as an alias for the FreeBSD ZFS UUID.John Baldwin2008-04-071-0/+7
| | | | | | | | | MFC after: 3 days PR: bin/119976 Submitted by: Cian Hughes Ci of nhugh.es Notes: svn path=/head/; revision=177984
* Bump .Dd for r1.19; use consistent whitespace.Ceri Davies2008-02-051-2/+2
| | | | Notes: svn path=/head/; revision=176011
* Add ZFS support.John Baldwin2008-02-053-1/+11
| | | | | | | | | MFC after: 1 week PR: bin/119976 Submitted by: Simun Mikecin numisemis of yahoo.com Notes: svn path=/head/; revision=176010
* Map 'boot' to GPT_ENT_TYPE_FREEBSD_BOOT when parsuing UUIDs so that thingsJohn Baldwin2008-01-301-0/+7
| | | | | | | | | | like 'gpt add -t boot' work. MFC after: 1 week Submitted by: Niki Denev nike_d of cytexbg.com Notes: svn path=/head/; revision=175822
* Don't look for GPT primary and secondary tables on a disk unless we haveJohn Baldwin2007-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 Notes: svn path=/head/; revision=173265
* Fix 'gpt boot' to work on disk devices and not just plain files. Writes toJohn Baldwin2007-11-011-5/+10
| | | | | | | | | disk devices have to consist of a block of sectors. Thus, when writing gptboot to the boot partition, round the size of the gptboot file up to a sector boundary, pre-zero it, and write out the full buffer to disk. Notes: svn path=/head/; revision=173262
* First cut at support for booting a GPT labeled disk via the BIOS bootstrapJohn Baldwin2007-10-247-36/+361
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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) Notes: svn path=/head/; revision=172940
* Use strtoll(3) instead of strtol(3) for the starting block orMarcel Moolenaar2006-10-043-6/+6
| | | | | | | | | | | | partition size. On 32-bit platforms sizeof(long) < sizeof(off_t) and using strtol(3) would prevent partitions larger than 4G sectors or beyond 4G blocks. PR: bin/103991 MFC after: 3 days Notes: svn path=/head/; revision=163009
* Fix cut-n-paste bug: compare argument s against known aliases,Marcel Moolenaar2006-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. Notes: svn path=/head/; revision=160149
* Improve support for Intel based Macs:Marcel Moolenaar2006-06-223-2/+12
| | | | | | | | o Accept hfs as partition type. o Print Apple HFS partitions using a friendly name. Notes: svn path=/head/; revision=159867
* Move the duplicated logic of parsing partition types into a newMarcel Moolenaar2006-06-225-57/+56
| | | | | | | function called parse_uuid(). Notes: svn path=/head/; revision=159865
* -mdoc sweep.Ruslan Ermilov2005-11-181-2/+4
| | | | Notes: svn path=/head/; revision=152568
* Add support for setting GPT partition labels. The partitions to beMarcel Moolenaar2005-09-015-33/+343
| | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=149688
* Dot the i's: multiple devices can be specified, so the usage shouldMarcel Moolenaar2005-09-013-5/+7
| | | | | | | have ellipsis following the device. Notes: svn path=/head/; revision=149687
* Add a comment before the statement that is responsible for theMarcel Moolenaar2005-09-011-0/+2
| | | | | | | | 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. Notes: svn path=/head/; revision=149684
* Document the -l and -u options of the show command.Marcel Moolenaar2005-08-311-1/+15
| | | | Notes: svn path=/head/; revision=149657
* o Replace unicode16() by utf8_to_utf16().Marcel Moolenaar2005-08-314-19/+139
| | | | | | | | | | | 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. Notes: svn path=/head/; revision=149656
* /* -> /*- for license.Marcel Moolenaar2005-08-3111-11/+11
| | | | Notes: svn path=/head/; revision=149655
* This script was helpful during development, but has no reason toMarcel Moolenaar2005-08-301-11/+0
| | | | | | | be kept alive. Removal is long overdue as it is. Notes: svn path=/head/; revision=149611
* Don't print the total number of partitions removed now that we printMarcel Moolenaar2005-08-301-7/+1
| | | | | | | | | | 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 Notes: svn path=/head/; revision=149610
* Markup fixes.Ruslan Ermilov2005-06-141-28/+5
| | | | | | | Approved by: re (blanket) Notes: svn path=/head/; revision=147369
* - distinguish between the device name (what the user called it on theDag-Erling Smørgrav2005-04-245-17/+45
| | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=145484
* Scheduled mdoc(7) sweep.Ruslan Ermilov2005-01-101-3/+3
| | | | Notes: svn path=/head/; revision=139987
* For create and migrate, remove the `.Op Fl f' introduced in theMarcel Moolenaar2004-11-131-4/+2
| | | | | | | | | | previous two commits and combine them with the existing flags that were already there. Pointed out by: ru@ Notes: svn path=/head/; revision=137643
* Add an -f option (for force) to the migrate command. Normally an MBRMarcel Moolenaar2004-11-132-5/+21
| | | | | | | | with unknown partitions is not migrated. By specifying the -f option migration will happen and unknown partitions will be lost. Notes: svn path=/head/; revision=137642
* Add an -f option (for force) to the create command. The -f optionMarcel Moolenaar2004-11-132-6/+25
| | | | | | | | | | 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. Notes: svn path=/head/; revision=137641
* Fix a braino: the partition size in the PMBR is in sectors, not bytesMarcel Moolenaar2004-11-122-8/+8
| | | | | | | | | | | 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> Notes: svn path=/head/; revision=137603
* Remove the -k option to migrate. The option causes gpt(8) to preserveMarcel Moolenaar2004-10-312-39/+25
| | | | | | | | | | 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. Notes: svn path=/head/; revision=137093
* Remove useless inclusion of <sys/disklabel.h>Marcel Moolenaar2004-10-252-2/+0
| | | | | | | Obtained from: Dan Markarian <markarian at apple dot com> Notes: svn path=/head/; revision=136937
* Declare variables as static, like I intended.Marcel Moolenaar2004-10-254-4/+4
| | | | | | | Obtained from: Dan Markarian <markarian at apple dot com> Notes: svn path=/head/; revision=136936
* Fix bogon. Create the BSD label in the FreeBSD slice.Marcel Moolenaar2004-10-251-1/+1
| | | | Notes: svn path=/head/; revision=136935
* Catch up with the BSD label changes. The partition offsets are relativeMarcel Moolenaar2004-10-251-3/+20
| | | | | | | | to the partition now. While here, make sure we skip unused partition entries. Notes: svn path=/head/; revision=136934
* Add byte swapping and UUID encoding/decoding to allow gpt to be compiledMarcel Moolenaar2004-10-259-140/+192
| | | | | | | | | on big-endian machines. Obtained from: Dan Markarian <markarian at apple dot com> Notes: svn path=/head/; revision=136932
* Document the remove command.Marcel Moolenaar2004-08-071-1/+37
| | | | Notes: svn path=/head/; revision=133260
* Implement a remove command. The remove command iterates the GPTMarcel Moolenaar2004-08-075-3/+217
| | | | | | | | | | | | 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. Notes: svn path=/head/; revision=133259
* Use __FBSDID.Marcel Moolenaar2004-08-077-14/+21
| | | | Notes: svn path=/head/; revision=133256
* o Save the partition number (=index) in the internal map. The indexMarcel Moolenaar2004-08-076-34/+75
| | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=133254
* Add Linux swap partition and MS reserved partition descriptions.Marcel Moolenaar2004-08-021-19/+27
| | | | | | | | | | | | | | | | 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 > Notes: svn path=/head/; revision=133031
* What's in a name: s/disklabel/bsdlabel/Marcel Moolenaar2004-08-021-1/+1
| | | | Notes: svn path=/head/; revision=133030
* Bump up the date and add spaces around commas. Thanks to ru@ for noticing.Arun Sharma2004-07-021-2/+2
| | | | Notes: svn path=/head/; revision=131471
* Added the ability to create and display Linux/Windows GPT partitions to gpt(8).Arun Sharma2004-07-013-3/+10
| | | | Notes: svn path=/head/; revision=131425
* style.Makefile(5):Johan Karlsson2004-02-231-1/+1
| | | | | | | Use WARNS?= instead of WARNS=. Notes: svn path=/head/; revision=126178
* - Add GPT header/table recovery commandKen Smith2003-11-162-4/+92
| | | | | | | | | - Minor related cleanup in add command Approved by: marcel Notes: svn path=/head/; revision=122782
* - Provide default values for LABELOFFSET and LABELSECTOR soKen Smith2003-11-161-0/+11
| | | | | | | | | it compiles on all architectures. Approved by: marcel Notes: svn path=/head/; revision=122781
* Assorted mdoc(7) fixes.Ruslan Ermilov2003-06-021-37/+42
| | | | Notes: svn path=/head/; revision=115694
* Show the paritition types that we recognize in human readable format. eg:Peter Wemm2003-02-131-4/+28
| | | | | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=110777
* o Newer EFI implementations require that a GPT is preceeded byMarcel Moolenaar2002-12-025-55/+153
| | | | | | | | | | | | | | | | | | | | | 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) Notes: svn path=/head/; revision=107482
* Add a manpage. Nobody expects the spanish inquisition, but theMarcel Moolenaar2002-12-012-1/+233
| | | | | | | | | mdoc(7) police... It's all yours ru :-) Approved by: re (blanket) Notes: svn path=/head/; revision=107435
* Allow aliases to be used when specifying partition types. The use ofMarcel Moolenaar2002-11-301-5/+14
| | | | | | | | | | | | | | 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) Notes: svn path=/head/; revision=107427