summaryrefslogtreecommitdiff
path: root/sgdisk.cc
diff options
context:
space:
mode:
authorsrs5694 <srs5694@users.sourceforge.net>2010-07-06 15:39:51 -0400
committersrs5694 <srs5694@users.sourceforge.net>2010-07-06 15:39:51 -0400
commitf9312b0ca9af86f280adad36eb660f6e74720c2c (patch)
tree198a25ab923423496f490565b9c29f4f50c6169d /sgdisk.cc
parent61768bccdec0016d3d9757d08e63f9a1386c8bc4 (diff)
downloadsgdisk-f9312b0ca9af86f280adad36eb660f6e74720c2c.tar.gz
Tentative support for duplicating one disk's partition table on another
disk.
Diffstat (limited to 'sgdisk.cc')
-rw-r--r--sgdisk.cc11
1 files changed, 8 insertions, 3 deletions
diff --git a/sgdisk.cc b/sgdisk.cc
index 2576f42..537639d 100644
--- a/sgdisk.cc
+++ b/sgdisk.cc
@@ -42,7 +42,7 @@ int main(int argc, char *argv[]) {
char *device = NULL;
char *newPartInfo = NULL, *typeCode = NULL, *partName = NULL;
char *backupFile = NULL, *twoParts = NULL, *hybrids = NULL, *mbrParts;
- char *partGUID = NULL, *diskGUID = NULL;
+ char *partGUID = NULL, *diskGUID = NULL, *outDevice = NULL;
PartType typeHelper;
poptContext poptCon;
@@ -70,6 +70,7 @@ int main(int argc, char *argv[]) {
{"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"},
+ {"replicate", 'R', POPT_ARG_STRING, &outDevice, 'R', "replicate partition table", "device_filename"},
{"sort", 's', POPT_ARG_NONE, NULL, 's', "sort partition table entries", ""},
{"resize-table", 'S', POPT_ARG_INT, &tableSize, 'S', "resize partition table", "numparts"},
{"typecode", 't', POPT_ARG_STRING, &typeCode, 't', "change partition type code", "partnum:hexcode"},
@@ -143,6 +144,11 @@ int main(int argc, char *argv[]) {
} // if/else
free(partName);
break;
+ case 'C':
+ theGPT.JustLooking(0);
+ theGPT.RecomputeCHS();
+ saveData = 1;
+ break;
case 'd':
theGPT.JustLooking(0);
if (theGPT.DeletePartition(deletePartNum - 1) == 0) {
@@ -256,8 +262,7 @@ int main(int argc, char *argv[]) {
break;
case 'R':
theGPT.JustLooking(0);
- theGPT.RecomputeCHS();
- saveData = 1;
+ theGPT.SaveGPTData(1, outDevice);
break;
case 's':
theGPT.JustLooking(0);