Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 25 May 2002 17:23:29 -0700 (PDT)
From:      Marcel Moolenaar <marcel@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 11887 for review
Message-ID:  <200205260023.g4Q0NTp92073@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://people.freebsd.org/~peter/p4db/chv.cgi?CH=11887

Change 11887 by marcel@marcel_vaio on 2002/05/25 17:23:06

	Rough sketch for a GPT tool. The comments in gpt.c should give an
	indication of where I'm heading. Currently, the only thing the
	tool does is migrate MBR based FreeBSD slices into GPT based slices.
	The operation is non-destructive at the moment, meaning that the
	MBR is not replaced by a protected MBR. Technically speaking this
	yields an invalid result, but I like to be able to use my disk
	for a while and EFI doesn't complain (not yet at least :-)
	
	Yes, the GPT partition is seen and accepted by EFI, as the following
	sequence of actions will demonstrate:
	
	The first time this tool is run, it migrates a pure MBR medium into
	one that is GPT based (only FreeBSD slice):
	
	\begin{verbatim}
	itanium% sudo ./gpt -v da0
	gpt: /dev/da0: mediasize=9186603008; sectorsize=512; blocks=17942584
	gpt: /dev/da0: found MBR at sector 0
	        Before image:
	MBR             start=0, blocks=1
	  (unused)      start=1, blocks=62
	MBR part        start=63, blocks=208782
	MBR part        start=208845, blocks=17719695
	  (unused)      start=17928540, blocks=14044
	
	        After image:
	MBR             start=0, blocks=1
	GPT header      start=1, blocks=1
	GPT table       start=2, blocks=16
	  (unused)      start=18, blocks=45
	MBR part        start=63, blocks=208782
	MBR part        start=208845, blocks=17719695
	  (unused)      start=17928540, blocks=14027
	Backup table    start=17942567, blocks=16
	Backup header   start=17942583, blocks=1
	\end{verbatim}
	
	Running the gpt tool a second time shows that the second partition
	(the FreeBSD slice) exists in the GPT:
	
	\begin{verbatim}
	itanium% sudo ./gpt -v da0
	gpt: /dev/da0: mediasize=9186603008; sectorsize=512; blocks=17942584
	gpt: /dev/da0: found MBR at sector 0
	gpt: /dev/da0: found GPT at sector 1
	gpt: warning: part(208845,17719695) mirrored
	gpt: /dev/da0: found GPT at sector 17942583
	        Before image:
	MBR             start=0, blocks=1
	GPT header      start=1, blocks=1
	GPT table       start=2, blocks=16
	  (unused)      start=18, blocks=45
	MBR part        start=63, blocks=208782
	GPT part        start=208845, blocks=17719695
	  (unused)      start=17928540, blocks=14027
	Backup table    start=17942567, blocks=16
	Backup header   start=17942583, blocks=1
	
	gpt: /dev/da0: error: device already contains a GPT
	\end{verbatim}
	
	After rebooting, EFI shows this:
	
	\begin{verbatim}
	Shell> map
	Device mapping table
	  blk0 : Acpi(PNP0A03,0)/Pci(3|1)/Ata(Primary,Master)
	  blk1 : VenHw(Unknown Device:80)
	  blk2 : VenHw(Unknown Device:80)/HD(Part1,Sig0AF29492-702F-11D6-8117-00D0B7ABFBAB)
	  blk3 : Acpi(PNP0A03,0)/Pci(3|1)/Ata(Primary,Slave)
	Shell> 
	\end{verbatim}
	
	This is the FreeBSD slice...
	
	Exposed bugs: The UUID printed by EFI does not match the UUID
	printed by uuidgen(1). The clock sequence is byte-swapped. Below
	how uuidgen prints the UUID:
	
		0af293d7-702f-11d6-1781-00d0b7abfbab
	
	I expect a bogon in uuidgen...

Affected files ...

... //depot/projects/ia64/sbin/Makefile#11 edit
... //depot/projects/ia64/sbin/gpt/Makefile#1 add
... //depot/projects/ia64/sbin/gpt/gpt.c#1 add
... //depot/projects/ia64/sbin/gpt/gpt.h#1 add
... //depot/projects/ia64/sbin/gpt/map.c#1 add
... //depot/projects/ia64/sbin/gpt/map.h#1 add
... //depot/projects/ia64/sbin/gpt/mkdisk.sh#1 add

Differences ...

==== //depot/projects/ia64/sbin/Makefile#11 (text+ko) ====

@@ -100,6 +100,7 @@
 
 .if ${MACHINE_ARCH} == "ia64"
 SUBDIR+=fdisk \
+	gpt \
 	mca
 .endif
 

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe p4-projects" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200205260023.g4Q0NTp92073>