Commit 4f05e3e0 authored by Guillaume Delacour's avatar Guillaume Delacour

Imported Upstream version 1.0.0

parent 72e81a3f
CC=/usr/bin/x86_64-w64-mingw32-gcc
CXX=/usr/bin/x86_64-w64-mingw32-g++
STRIP=/usr/bin/x86_64-w64-mingw32-strip
CFLAGS=-O2 -Wall -static -static-libgcc -static-libstdc++ -D_FILE_OFFSET_BITS=64 -g
CXXFLAGS=-O2 -Wall -static -static-libgcc -static-libstdc++ -D_FILE_OFFSET_BITS=64 -g
#CXXFLAGS=-O2 -Wall -D_FILE_OFFSET_BITS=64 -I /usr/local/include -I/opt/local/include -g
LIB_NAMES=guid gptpart bsd parttypes attributes crc32 mbrpart basicmbr mbr gpt support diskio diskio-windows
MBR_LIBS=support diskio diskio-windows basicmbr mbrpart
LIB_SRCS=$(NAMES:=.cc)
LIB_OBJS=$(LIB_NAMES:=.o)
MBR_LIB_OBJS=$(MBR_LIBS:=.o)
LIB_HEADERS=$(LIB_NAMES:=.h)
DEPEND= makedepend $(CFLAGS)
all: gdisk fixparts
gdisk: $(LIB_OBJS) gdisk.o gpttext.o
$(CXX) $(CXXFLAGS) $(LIB_OBJS) gdisk.o gpttext.o -lrpcrt4 -static-libgcc -o gdisk64.exe
sgdisk: $(LIB_OBJS) sgdisk.o
$(CXX) $(CXXFLAGS) $(LIB_OBJS) sgdisk.o -lpopt -static-libgcc -o sgdisk64.exe
fixparts: $(MBR_LIB_OBJS) fixparts.o
$(CXX) $(CXXFLAGS) $(MBR_LIB_OBJS) fixparts.o $(LDFLAGS) -static-libgcc -o fixparts64.exe
lint: #no pre-reqs
lint $(SRCS)
clean: #no pre-reqs
rm -f core *.o *~ gdisk64.exe sgdisk64.exe
strip: #no pre-reqs
$(STRIP) gdisk64.exe fixparts64.exe
# what are the source dependencies
depend: $(SRCS)
$(DEPEND) $(SRCS)
$(OBJS):
# DO NOT DELETE
1.0.0 (3/16/2015):
------------------
- I'm now building a binary package of gdisk_x64.efi, using the UEFI GPT
fdisk package.
- Added partition type for OpenBSD data
(824CC7A0-36A8-11E3-890A-952519AD3F61/0xa601). Also mapped 0xa600 to the
FreeBSD disklabel type code (516E7CB4-6ECF-11D6-8FF8-00022D09712B). I'm
not sure that's 100% correct, but since I can't find references to an
OpenBSD disklabel GPT type code, it seems the best choice at the moment.
- Added partition type for Windows Storage Spaces
(E75CAF8F-F680-4CEE-AFA3-B001E56EFC2D/0x4202)
- Added -O/--print-mbr option to sgdisk, enabling easier display of MBR
data structures without invoking gdisk.
- Updated warning message: "EBR describes a logical partition" now reads
"EBR points to an EBR," which is more technically correct.
- Altered warning displayed when run from Windows on non-GPT disk, because
Windows on UEFI-based systems is becoming more common.
- Fixed spurious "1" return value in gdisk.
- Small code changes to support compilation as EFI application with the
UEFI GPT fdisk library
(http://sourceforge.net/projects/uefigptfdisk/?source=directory)
- Added new partition type codes for Ceph
(https://github.com/ceph/ceph/blob/9bcc42a3e6b08521694b5c0228b2c6ed7b3d312e/src/ceph-disk#L76-L81):
4FBD7E29-9D25-41B8-AFD0-062C0CEFF05D/0xf800 (Ceph OSD),
4FBD7E29-9D25-41B8-AFD0-5EC00CEFF05D/0xf801 (Ceph dm-crypt OSD),
45B0969E-9B03-4F30-B4C6-B4B80CEFF106/0xf802 (Ceph journal),
45B0969E-9B03-4F30-B4C6-5EC00CEFF106/0xf803 (Ceph dm-crypt journal),
89C57F98-2FE5-4DC0-89C1-F3AD0CEFF2BE/0xf804 (Ceph disk in creation), and
89C57F98-2FE5-4DC0-89C1-5EC00CEFF2BE/0xf805 (Ceph dm-crypt disk in
creation)
- Added new partition type codes from
http://www.freedesktop.org/wiki/Specifications/DiscoverablePartitionsSpec/:
44479540-F297-41B2-9AF7-D131D5F0458A/0x8303 (Linux / on x86),
4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709/0x8304 (Linux / on x86-64),
B921B045-1DF0-41C3-AF44-4C6F280D3FAE/0x8305 (Linux / on 64-bit ARM),
3B8F8425-20E0-4F3B-907F-1A25A76F98E8/0x8306 (Linux /srv).
0.8.10 (3/2/2014):
------------------
......
......@@ -296,7 +296,7 @@ int BasicMBRData::ReadLogicalParts(uint64_t extendedStart, int partNum) {
// the logical partition when this is the case....
ebrType = ebr.partitions[0].partitionType;
if ((ebrType == 0x05) || (ebrType == 0x0f) || (ebrType == 0x85)) {
cout << "EBR describes a logical partition!\n";
cout << "EBR points to an EBR!\n";
offset = extendedStart + ebr.partitions[0].firstLBA;
} else {
// Copy over the basic data....
......
.\" Copyright 2011-2013 Roderick W. Smith (rodsmith@rodsbooks.com)
.\" May be distributed under the GNU General Public License
.TH "CGDISK" "8" "0.8.10" "Roderick W. Smith" "GPT fdisk Manual"
.TH "CGDISK" "8" "1.0.0" "Roderick W. Smith" "GPT fdisk Manual"
.SH "NAME"
cgdisk \- Curses-based GUID partition table (GPT) manipulator
.SH "SYNOPSIS"
......@@ -276,10 +276,7 @@ Write data. Use this command to save your changes.
.SH "BUGS"
As of March 2014 (version 0.8.10), \fBcgdisk\fR should be considered
beta software. Although the underlying partition manipulation code is much
older, the \fBcgdisk\fR ncurses user interface is brand new with GPT fdisk
version 0.8.0. Known bugs and limitations include:
Known bugs and limitations include:
.TP
.B *
......@@ -367,7 +364,7 @@ Contributors:
* Justin Maggard (justin.maggard@netgear.com)
* Dwight Schauer (dschauer@ti.com)
* Dwight Schauer (dschauer@gmail.com)
* Florian Zumbiehl (florz@florz.de)
......
Content-type: text/html
Content-type: text/html; charset=UTF-8
<HTML><HEAD><TITLE>Manpage of CGDISK</TITLE>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of CGDISK</TITLE>
</HEAD><BODY>
<H1>CGDISK</H1>
Section: GPT fdisk Manual (8)<BR>Updated: 0.8.10<BR><A HREF="#index">Index</A>
<A HREF="http://localhost/cgi-bin/man/man2html">Return to Main Contents</A><HR>
Section: GPT fdisk Manual (8)<BR>Updated: 1.0.0<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
......@@ -330,10 +331,7 @@ Write data. Use this command to save your changes.
<H2>BUGS</H2>
<P>
As of March 2014 (version 0.8.10), <B>cgdisk</B> should be considered
beta software. Although the underlying partition manipulation code is much
older, the <B>cgdisk</B> ncurses user interface is brand new with GPT fdisk
version 0.8.0. Known bugs and limitations include:
Known bugs and limitations include:
<P>
<DL COMPACT>
<DT><B>*</B>
......@@ -434,7 +432,7 @@ Contributors:
<P>
* Justin Maggard (<A HREF="mailto:justin.maggard@netgear.com">justin.maggard@netgear.com</A>)
<P>
* Dwight Schauer (<A HREF="mailto:dschauer@ti.com">dschauer@ti.com</A>)
* Dwight Schauer (<A HREF="mailto:dschauer@gmail.com">dschauer@gmail.com</A>)
<P>
* Florian Zumbiehl (<A HREF="mailto:florz@florz.de">florz@florz.de</A>)
<P>
......@@ -478,8 +476,8 @@ available from Rod Smith.
</DL>
<HR>
This document was created by
<A HREF="http://localhost/cgi-bin/man/man2html">man2html</A>,
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 17:57:37 GMT, March 02, 2014
Time: 22:50:38 GMT, March 17, 2015
</BODY>
</HTML>
Summary: GPT partitioning and MBR repair software
Name: gptfdisk
Version: 0.8.10
Version: 1.0.0
Release: 1%{?dist}
License: GPLv2
URL: http://www.rodsbooks.com/gdisk
Group: Applications/System
Source: http://www.rodsbooks.com/gdisk/gptfdisk-0.8.10.tar.gz
Source: http://www.rodsbooks.com/gdisk/gptfdisk-1.0.0.tar.gz
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
%description
......@@ -81,5 +81,5 @@ provides a few additional partition manipulation features.
%changelog
* Sun Mar 2 2014 R Smith <rodsmith@rodsbooks.com> - 0.8.10
- Created spec file for 0.8.10 release
* Sun Mar 2 2014 R Smith <rodsmith@rodsbooks.com> - 1.0.0
- Created spec file for 1.0.0 release
......@@ -253,7 +253,8 @@ int DiskIO::DiskSync(void) {
i = ioctl(fd, BLKRRPART);
if (i) {
cout << "Warning: The kernel is still using the old partition table.\n"
<< "The new table will be used at the next reboot.\n";
<< "The new table will be used at the next reboot or after you\n"
<< "run partprobe(8) or kpartx(8)\n";
} else {
retval = 1;
} // if/else
......
.\" Copyright 2011-2013 Roderick W. Smith (rodsmith@rodsbooks.com)
.\" May be distributed under the GNU General Public License
.TH "FIXPARTS" "8" "0.8.10" "Roderick W. Smith" "FixParts Manual"
.TH "FIXPARTS" "8" "1.0.0" "Roderick W. Smith" "FixParts Manual"
.SH "NAME"
fixparts \- MBR partition table repair utility
.SH "SYNOPSIS"
......@@ -202,8 +202,7 @@ see a summary of available options.
.PP
.SH "BUGS"
As of March 2014 (version 0.8.10), \fBfixparts\fR
should be considered beta software. Known bugs and limitations include:
Known bugs and limitations include:
.TP
.B *
......@@ -259,7 +258,7 @@ Contributors:
* Justin Maggard (justin.maggard@netgear.com)
* Dwight Schauer (dschauer@ti.com)
* Dwight Schauer (dschauer@gmail.com)
* Florian Zumbiehl (florz@florz.de)
......
Content-type: text/html
Content-type: text/html; charset=UTF-8
<HTML><HEAD><TITLE>Manpage of FIXPARTS</TITLE>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of FIXPARTS</TITLE>
</HEAD><BODY>
<H1>FIXPARTS</H1>
Section: FixParts Manual (8)<BR>Updated: 0.8.10<BR><A HREF="#index">Index</A>
<A HREF="http://localhost/cgi-bin/man/man2html">Return to Main Contents</A><HR>
Section: FixParts Manual (8)<BR>Updated: 1.0.0<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
......@@ -245,8 +246,7 @@ see a summary of available options.
<A NAME="lbAF">&nbsp;</A>
<H2>BUGS</H2>
As of March 2014 (version 0.8.10), <B>fixparts</B>
should be considered beta software. Known bugs and limitations include:
Known bugs and limitations include:
<P>
<DL COMPACT>
<DT><B>*</B>
......@@ -313,7 +313,7 @@ Contributors:
<P>
* Justin Maggard (<A HREF="mailto:justin.maggard@netgear.com">justin.maggard@netgear.com</A>)
<P>
* Dwight Schauer (<A HREF="mailto:dschauer@ti.com">dschauer@ti.com</A>)
* Dwight Schauer (<A HREF="mailto:dschauer@gmail.com">dschauer@gmail.com</A>)
<P>
* Florian Zumbiehl (<A HREF="mailto:florz@florz.de">florz@florz.de</A>)
<P>
......@@ -355,8 +355,8 @@ available from Rod Smith.
</DL>
<HR>
This document was created by
<A HREF="http://localhost/cgi-bin/man/man2html">man2html</A>,
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 17:57:37 GMT, March 02, 2014
Time: 22:50:38 GMT, March 17, 2015
</BODY>
</HTML>
.\" Copyright 2011-2013 Roderick W. Smith (rodsmith@rodsbooks.com)
.\" May be distributed under the GNU General Public License
.TH "GDISK" "8" "0.8.10" "Roderick W. Smith" "GPT fdisk Manual"
.TH "GDISK" "8" "1.0.0" "Roderick W. Smith" "GPT fdisk Manual"
.SH "NAME"
gdisk \- Interactive GUID partition table (GPT) manipulator
.SH "SYNOPSIS"
......@@ -561,8 +561,7 @@ entering data. When only one option is possible, \fBgdisk\fR
usually bypasses the prompt entirely.
.SH "BUGS"
As of March 2014 (version 0.8.10), \fBgdisk\fR
should be considered beta software. Known bugs and limitations include:
Known bugs and limitations include:
.TP
.B *
......@@ -660,7 +659,7 @@ Contributors:
* Justin Maggard (justin.maggard@netgear.com)
* Dwight Schauer (dschauer@ti.com)
* Dwight Schauer (dschauer@gmail.com)
* Florian Zumbiehl (florz@florz.de)
......
......@@ -15,8 +15,11 @@ int main(int argc, char* argv[]) {
GPTDataTextUI theGPT;
string device = "";
UnicodeString uString;
int isError = 0;
#ifndef EFI
cout << "GPT fdisk (gdisk) version " << GPTFDISK_VERSION << "\n\n";
#endif /*EFI*/
if (!SizesOK())
exit(1);
......@@ -47,16 +50,20 @@ int main(int argc, char* argv[]) {
device = (string) argv[1];
} else { // 3 arguments, but none is "-l"
cerr << "Usage: " << argv[0] << " [-l] device_file\n";
isError = 1;
} // if/elseif/else
if (device != "") {
theGPT.JustLooking();
if (theGPT.LoadPartitions(device))
theGPT.DisplayGPTData();
else
isError = 1;
} // if
break;
default:
cerr << "Usage: " << argv[0] << " [-l] device_file\n";
isError = 1;
break;
} // switch
return 1 ;
return (isError);
} // main
Content-type: text/html
Content-type: text/html; charset=UTF-8
<HTML><HEAD><TITLE>Manpage of GDISK</TITLE>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of GDISK</TITLE>
</HEAD><BODY>
<H1>GDISK</H1>
Section: GPT fdisk Manual (8)<BR>Updated: 0.8.10<BR><A HREF="#index">Index</A>
<A HREF="http://localhost/cgi-bin/man/man2html">Return to Main Contents</A><HR>
Section: GPT fdisk Manual (8)<BR>Updated: 1.0.0<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
......@@ -656,8 +657,7 @@ usually bypasses the prompt entirely.
<A NAME="lbAF">&nbsp;</A>
<H2>BUGS</H2>
As of March 2014 (version 0.8.10), <B>gdisk</B>
should be considered beta software. Known bugs and limitations include:
Known bugs and limitations include:
<P>
<DL COMPACT>
<DT><B>*</B>
......@@ -770,7 +770,7 @@ Contributors:
<P>
* Justin Maggard (<A HREF="mailto:justin.maggard@netgear.com">justin.maggard@netgear.com</A>)
<P>
* Dwight Schauer (<A HREF="mailto:dschauer@ti.com">dschauer@ti.com</A>)
* Dwight Schauer (<A HREF="mailto:dschauer@gmail.com">dschauer@gmail.com</A>)
<P>
* Florian Zumbiehl (<A HREF="mailto:florz@florz.de">florz@florz.de</A>)
<P>
......@@ -814,8 +814,8 @@ available from Rod Smith.
</DL>
<HR>
This document was created by
<A HREF="http://localhost/cgi-bin/man/man2html">man2html</A>,
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 17:57:37 GMT, March 02, 2014
Time: 22:50:38 GMT, March 17, 2015
</BODY>
</HTML>
......@@ -38,6 +38,23 @@ using namespace std;
#define log2(x) (log((double) x) / log(2.0))
#endif // Microsoft Visual C++
#ifdef EFI
// in UEFI mode MMX registers are not yet available so using the
// x86_64 ABI to move "double" values around is not an option.
#ifdef log2
#undef log2
#endif
#define log2(x) log2_32( x )
static inline uint32_t log2_32(uint32_t v) {
int r = -1;
while (v >= 1) {
r++;
v >>= 1;
}
return r;
}
#endif
/****************************************
* *
* GPTData class and related structures *
......
......@@ -93,6 +93,7 @@ int GPTDataCL::DoOptions(int argc, char* argv[]) {
{"new", 'n', POPT_ARG_STRING, &newPartInfo, 'n', "create new partition", "partnum:start:end"},
{"largest-new", 'N', POPT_ARG_INT, &largestPartNum, 'N', "create largest possible new partition", "partnum"},
{"clear", 'o', POPT_ARG_NONE, NULL, 'o', "clear partition table", ""},
{"print-mbr", 'O', POPT_ARG_NONE, NULL, 'O', "print MBR partition table", ""},
{"print", 'p', POPT_ARG_NONE, NULL, 'p', "print partition table", ""},
{"pretend", 'P', POPT_ARG_NONE, NULL, 'P', "make changes in memory, but don't write them", ""},
{"transpose", 'r', POPT_ARG_STRING, &twoParts, 'r', "transpose two partitions", "partnum:partnum"},
......@@ -320,6 +321,9 @@ int GPTDataCL::DoOptions(int argc, char* argv[]) {
ClearGPTData();
saveData = 1;
break;
case 'O':
DisplayMBRData();
break;
case 'p':
DisplayGPTData();
break;
......
......@@ -302,7 +302,7 @@ void GPTPart::ShowSummary(int partNum, uint32_t blockSize) {
cout << firstLBA << " ";
cout.width(14);
cout << lastLBA << " ";
cout << BytesToIeee(lastLBA - firstLBA + 1, blockSize) << " ";
cout << sizeInIeee << " ";
if (sizeInIeee.length() < 10)
for (i = 0; i < 10 - sizeInIeee.length(); i++)
cout << " ";
......
......@@ -198,9 +198,9 @@ void GPTDataTextUI::CreatePartition(void) {
Align(&firstInLargest);
// Get partition number....
prompt1 << "Partition number (" << firstFreePart + 1 << "-" << numParts
<< ", default " << firstFreePart + 1 << "): ";
do {
prompt1 << "Partition number (" << firstFreePart + 1 << "-" << numParts
<< ", default " << firstFreePart + 1 << "): ";
partNum = GetNumber(firstFreePart + 1, numParts,
firstFreePart + 1, prompt1.str()) - 1;
if (partitions[partNum].GetFirstLBA() != 0)
......
......@@ -28,6 +28,9 @@ using namespace std;
* *
****************************************/
MBRData::~MBRData(void) {
} // MBRData destructor
/* // Assignment operator -- copy entire set of MBR data.
MBRData & MBRData::operator=(const MBRData & orig) {
BasicMBRData::operator=(orig);
......
......@@ -28,6 +28,7 @@ public:
MBRData(void) {}
MBRData(string deviceFilename) : BasicMBRData(deviceFilename) {}
MBRData & operator=(const BasicMBRData & orig);
~MBRData(void);
// Functions to create, delete, or change partitions
// Pass EmptyMBR 1 to clear the boot loader code, 0 to leave it intact
......
......@@ -103,6 +103,7 @@ void PartType::AddAllTypes(void) {
// Windows LDM ("dynamic disk") types
AddType(0x4200, "AF9B60A0-1431-4F62-BC68-3311714A69AD", "Windows LDM data"); // Logical disk manager
AddType(0x4201, "5808C8AA-7E8F-42E0-85D2-E1E90434CFB3", "Windows LDM metadata"); // Logical disk manager
AddType(0x4202, "E75CAF8F-F680-4CEE-AFA3-B001E56EFC2D", "Windows Storage Spaces"); // A newer LDM-type setup
// An oddball IBM filesystem....
AddType(0x7501, "37AFFC90-EF7D-4E96-91C3-2D7AE055B174", "IBM GPFS"); // General Parallel File System (GPFS)
......@@ -122,7 +123,12 @@ void PartType::AddAllTypes(void) {
AddType(0x8300, "0FC63DAF-8483-4772-8E79-3D69D8477DE4", "Linux filesystem"); // Linux native
AddType(0x8301, "8DA63339-0007-60C0-C436-083AC8230908", "Linux reserved");
// See http://www.freedesktop.org/software/systemd/man/systemd-gpt-auto-generator.html
// and http://www.freedesktop.org/wiki/Specifications/DiscoverablePartitionsSpec/
AddType(0x8302, "933AC7E1-2EB4-4F13-B844-0E14E2AEF915", "Linux /home"); // Linux /home (auto-mounted by systemd)
AddType(0x8303, "44479540-F297-41B2-9AF7-D131D5F0458A", "Linux x86 root (/)"); // Linux / on x86 (auto-mounted by systemd)
AddType(0x8304, "4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709", "Linux x86-64 root (/)"); // Linux / on x86-64 (auto-mounted by systemd)
AddType(0x8305, "B921B045-1DF0-41C3-AF44-4C6F280D3FAE", "Linux ARM64 root (/)"); // Linux / on 64-bit ARM (auto-mounted by systemd)
AddType(0x8306, "3B8F8425-20E0-4F3B-907F-1A25A76F98E8", "Linux /srv"); // Linux /srv (auto-mounted by systemd)
// Used by Intel Rapid Start technology
AddType(0x8400, "D3BFE2DE-3DAF-11DF-BA40-E3A556D89593", "Intel Rapid Start");
......@@ -148,6 +154,13 @@ void PartType::AddAllTypes(void) {
AddType(0xa584, "85D5E45D-237C-11E1-B4B3-E89A8F7FC3A7", "Midnight BSD ZFS");
AddType(0xa585, "85D5E45C-237C-11E1-B4B3-E89A8F7FC3A7", "Midnight BSD Vinum");
// OpenBSD partition type....
// Note: MBR type 0xa6 is normally subdivided with a BSD disklabel. It's unclear
// if that has a GPT equivalent, so I've mapped it to the same GUID as the
// FreeBSD diskalbel.
AddType(0xa600, "516E7CB4-6ECF-11D6-8FF8-00022D09712B", "OpenBSD disklabel", 0);
AddType(0xa601, "824CC7A0-36A8-11E3-890A-952519AD3F61", "OpenBSD data");
// A MacOS partition type, separated from others by NetBSD partition types...
AddType(0xa800, "55465300-0000-11AA-AA11-00306543ECAC", "Apple UFS"); // Mac OS X
......@@ -205,6 +218,14 @@ void PartType::AddAllTypes(void) {
AddType(0xef01, "024DEE41-33E7-11D3-9D69-0008C781F39F", "MBR partition scheme"); // Used to nest MBR in GPT
AddType(0xef02, "21686148-6449-6E6F-744E-656564454649", "BIOS boot partition"); // Used by GRUB
// Ceph type codes; see https://github.com/ceph/ceph/blob/9bcc42a3e6b08521694b5c0228b2c6ed7b3d312e/src/ceph-disk#L76-L81
AddType(0xf800, "4FBD7E29-9D25-41B8-AFD0-062C0CEFF05D", "Ceph OSD"); // Ceph Object Storage Daemon
AddType(0xf801, "4FBD7E29-9D25-41B8-AFD0-5EC00CEFF05D", "Ceph dm-crypt OSD"); // Ceph Object Storage Daemon (encrypted)
AddType(0xf802, "45B0969E-9B03-4F30-B4C6-B4B80CEFF106", "Ceph journal");
AddType(0xf803, "45B0969E-9B03-4F30-B4C6-5EC00CEFF106", "Ceph dm-crypt journal");
AddType(0xf804, "89C57F98-2FE5-4DC0-89C1-F3AD0CEFF2BE", "Ceph disk in creation");
AddType(0xf805, "89C57F98-2FE5-4DC0-89C1-5EC00CEFF2BE", "Ceph dm-crypt disk in creation");
// VMWare ESX partition types codes
AddType(0xfb00, "AA31E02A-400F-11DB-9590-000C2911D1B8", "VMWare VMFS");
AddType(0xfb01, "9198EFFC-31C0-11DB-8F78-000C2911D1B8", "VMWare reserved");
......
.\" Copyright 2011-2013 Roderick W. Smith (rodsmith@rodsbooks.com)
.\" May be distributed under the GNU General Public License
.TH "SGDISK" "8" "0.8.10" "Roderick W. Smith" "GPT fdisk Manual"
.TH "SGDISK" "8" "1.0.0" "Roderick W. Smith" "GPT fdisk Manual"
.SH "NAME"
sgdisk \- Command\-line GUID partition table (GPT) manipulator for Linux and Unix
.SH "SYNOPSIS"
......@@ -352,12 +352,20 @@ and then partition it normally. This option will work even if the
disk's original partition table is bad; however, most other options on the
same command line will be ignored.
.TP
.B \-O, \-\-print\-mbr
Display basic \fIMBR\fR partition summary data. This includes partition
numbers, starting and ending sector numbers, partition sizes, MBR partition
types codes, and partition names. This option is useful mainly for
diagnosing partition table problems, particularly on disks with hybrid
MBRs.
.TP
.B \-p, \-\-print
Display basic partition summary data. This includes partition
numbers, starting and ending sector numbers, partition sizes,
\fBsgdisk\fR's partition types codes, and partition names. For
additional information, use the \fI\-i\fR (\fI\-\-info\fR) option.
Display basic GPT partition summary data. This includes partition numbers,
starting and ending sector numbers, partition sizes, \fBsgdisk\fR's
partition types codes, and partition names. For additional information, use
the \fI\-i\fR (\fI\-\-info\fR) option.
.TP
.B \-P, \-\-pretend
......@@ -491,8 +499,7 @@ sgdisk, but may with gdisk)
Disk replication operation (-R) failed
.SH "BUGS"
As of March 2014 (version 0.8.10), \fBsgdisk\fR
should be considered beta software. Known bugs and limitations include:
Known bugs and limitations include:
.TP
.B *
......@@ -578,7 +585,7 @@ Contributors:
* Justin Maggard (justin.maggard@netgear.com)
* Dwight Schauer (dschauer@ti.com)
* Dwight Schauer (dschauer@gmail.com)
* Florian Zumbiehl (florz@florz.de)
......
Content-type: text/html
Content-type: text/html; charset=UTF-8
<HTML><HEAD><TITLE>Manpage of SGDISK</TITLE>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of SGDISK</TITLE>
</HEAD><BODY>
<H1>SGDISK</H1>
Section: GPT fdisk Manual (8)<BR>Updated: 0.8.10<BR><A HREF="#index">Index</A>
<A HREF="http://localhost/cgi-bin/man/man2html">Return to Main Contents</A><HR>
Section: GPT fdisk Manual (8)<BR>Updated: 1.0.0<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
......@@ -396,13 +397,22 @@ and then partition it normally. This option will work even if the
disk's original partition table is bad; however, most other options on the
same command line will be ignored.
<P>
<DT><B>-O, --print-mbr</B>
<DD>
Display basic <I>MBR</I> partition summary data. This includes partition
numbers, starting and ending sector numbers, partition sizes, MBR partition
types codes, and partition names. This option is useful mainly for
diagnosing partition table problems, particularly on disks with hybrid
MBRs.
<P>
<DT><B>-p, --print</B>
<DD>
Display basic partition summary data. This includes partition
numbers, starting and ending sector numbers, partition sizes,
<B>sgdisk</B>'s partition types codes, and partition names. For
additional information, use the <I>-i</I> (<I>--info</I>) option.
Display basic GPT partition summary data. This includes partition numbers,
starting and ending sector numbers, partition sizes, <B>sgdisk</B>'s
partition types codes, and partition names. For additional information, use
the <I>-i</I> (<I>--info</I>) option.
<P>
<DT><B>-P, --pretend</B>
......@@ -564,8 +574,7 @@ Disk replication operation (-R) failed
<A NAME="lbAG">&nbsp;</A>
<H2>BUGS</H2>
As of March 2014 (version 0.8.10), <B>sgdisk</B>
should be considered beta software. Known bugs and limitations include:
Known bugs and limitations include:
<P>
<DL COMPACT>
<DT><B>*</B>
......@@ -665,7 +674,7 @@ Contributors:
<P>
* Justin Maggard (<A HREF="mailto:justin.maggard@netgear.com">justin.maggard@netgear.com</A>)
<P>
* Dwight Schauer (<A HREF="mailto:dschauer@ti.com">dschauer@ti.com</A>)
* Dwight Schauer (<A HREF="mailto:dschauer@gmail.com">dschauer@gmail.com</A>)
<P>
* Florian Zumbiehl (<A HREF="mailto:florz@florz.de">florz@florz.de</A>)
<P>
......@@ -710,8 +719,8 @@ available from Rod Smith.
</DL>
<HR>
This document was created by
<A HREF="http://localhost/cgi-bin/man/man2html">man2html</A>,
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 17:57:37 GMT, March 02, 2014
Time: 22:50:38 GMT, March 17, 2015
</BODY>
</HTML>
......@@ -34,6 +34,17 @@ using namespace std;
// Reads a string from stdin, returning it as a C++-style string.
// Note that the returned string will NOT include the carriage return
// entered by the user.
#ifdef EFI
extern int __sscanf( const char * str , const char * format , ... ) ;
string ReadString(void) {
string inString;
char efiString[256];
fgets(efiString, 255, stdin);
inString = efiString;
return inString;
} // ReadString()
#else
string ReadString(void) {
string inString;
......@@ -42,6 +53,7 @@ string ReadString(void) {
exit(5);
return inString;
} // ReadString()
#endif
// Get a numeric value from the user, between low and high (inclusive).
// Keeps looping until the user enters a value within that range.
......@@ -138,7 +150,7 @@ uint64_t IeeeToInt(string inValue, uint64_t sSize, uint64_t low, uint64_t high,
if (sSize == 0) {
sSize = SECTOR_SIZE;
cerr << "Bug: Sector size invalid in SIToInt()!\n";
cerr << "Bug: Sector size invalid in IeeeToInt()!\n";
} // if
// Remove leading spaces, if present
......@@ -217,30 +229,39 @@ uint64_t IeeeToInt(string inValue, uint64_t sSize, uint64_t low, uint64_t high,
// Takes a size and converts this to a size in IEEE-1541-2002 units (KiB, MiB,
// GiB, TiB, PiB, or EiB), returned in C++ string form. The size is either in
// units of the sector size or, if that parameter is omitted, in bytes.
// (sectorSize defaults to 1).
// (sectorSize defaults to 1). Note that this function uses peculiar
// manual computation of decimal value rather than simply setting
// theValue.precision() because this isn't possible using the available
// EFI library.
string BytesToIeee(uint64_t size, uint32_t sectorSize) {
float sizeInIeee;
unsigned int index = 0;
uint64_t sizeInIeee;
uint64_t previousIeee;
float decimalIeee;
uint64_t index = 0;
string units, prefixes = " KMGTPEZ";
ostringstream theValue;
sizeInIeee = size * (float) sectorSize;
while ((sizeInIeee > 1024.0) && (index < (prefixes.length() - 1))) {
sizeInIeee = previousIeee = size * (uint64_t) sectorSize;
while ((sizeInIeee > 1024) && (index < (prefixes.length() - 1))) {
index++;
sizeInIeee /= 1024.0;
previousIeee = sizeInIeee;
sizeInIeee /= 1024;
} // while
theValue.setf(ios::fixed);
if (prefixes[index] == ' ') {
units = " bytes";
theValue.precision(0);
theValue << sizeInIeee << " bytes";
} else {
units = " iB";
units[1] = prefixes[index];
theValue.precision(1);
decimalIeee = ((float) previousIeee -
((float) sizeInIeee * 1024.0) + 51.2) / 102.4;
if (decimalIeee >= 10.0) {
decimalIeee = 0.0;
sizeInIeee++;
}
theValue << sizeInIeee << "." << (uint32_t) decimalIeee << units;
} // if/else
theValue << sizeInIeee << units;
return theValue.str();
} // BlocksToIeee()
} // BytesToIeee()
// Converts two consecutive characters in the input string into a
// number, interpreting the string as a hexadecimal number, starting
......@@ -319,11 +340,11 @@ void ReverseBytes(void* theValue, int numBytes) {
void WinWarning(void) {
#ifdef _WIN32
cout << "\a************************************************************************\n"
<< "Most versions of Windows cannot boot from a GPT disk, and most varieties\n"
<< "prior to Vista cannot read GPT disks. Therefore, you should exit now\n"
<< "unless you understand the implications of converting MBR to GPT or creating\n"
<< "a new GPT disk layout!\n"
<< "************************************************************************\n\n";
<< "Most versions of Windows cannot boot from a GPT disk except on a UEFI-based\n"
<< "computer, and most varieties prior to Vista cannot read GPT disks. Therefore,\n"
<< "you should exit now unless you understand the implications of converting MBR\n"
<< "to GPT or creating a new GPT disk layout!\n"
<< "************************************************************************\n\n";
cout << "Are you SURE you want to continue? ";
if (GetYN() != 'Y')
exit(0);
......
......@@ -8,7 +8,7 @@
#ifndef __GPTSUPPORT
#define __GPTSUPPORT
#define GPTFDISK_VERSION "0.8.10"
#define GPTFDISK_VERSION "1.0.0"
#if defined (__FreeBSD__) || defined (__FreeBSD_kernel__) || defined (__APPLE__)
// Darwin (Mac OS) & FreeBSD: disk IOCTLs are different, and there is no lseek64
......