diff options
author | marcel <marcel@FreeBSD.org> | 2004-11-13 05:44:02 +0000 |
---|---|---|
committer | marcel <marcel@FreeBSD.org> | 2004-11-13 05:44:02 +0000 |
commit | 044a6050c4e974edc09bb29f7d0387b8ec67d3e1 (patch) | |
tree | 506069708b46b0f35a7b3d3313415fe047697d45 /sbin/gpt | |
parent | 571405ddd692d7a10ed1b454ad3905dec737db60 (diff) | |
download | FreeBSD-src-044a6050c4e974edc09bb29f7d0387b8ec67d3e1.zip FreeBSD-src-044a6050c4e974edc09bb29f7d0387b8ec67d3e1.tar.gz |
Add an -f option (for force) to the migrate command. Normally an MBR
with unknown partitions is not migrated. By specifying the -f option
migration will happen and unknown partitions will be lost.
Diffstat (limited to 'sbin/gpt')
-rw-r--r-- | sbin/gpt/gpt.8 | 10 | ||||
-rw-r--r-- | sbin/gpt/migrate.c | 16 |
2 files changed, 21 insertions, 5 deletions
diff --git a/sbin/gpt/gpt.8 b/sbin/gpt/gpt.8 index 8909812..57c93c4 100644 --- a/sbin/gpt/gpt.8 +++ b/sbin/gpt/gpt.8 @@ -180,6 +180,7 @@ to destroy the table in a way that it can be recovered. .It Xo .Nm .Ic migrate +.Op Fl f .Op Fl s .Ar device ... .Xc @@ -187,6 +188,15 @@ The .Ic migrate command allows the user to migrate an MBR-based disk partitioning into a GPT-based partitioning. +By default the MBR is not migrated when it contains partitions of an unknown +type. +This can be overridden with the +.Fl f +option. +Specifying the +.Fl f +option will cause unknown partitions to be ignored and any data in it +to be lost. .Pp The .Fl s diff --git a/sbin/gpt/migrate.c b/sbin/gpt/migrate.c index d0f1485..eb89941 100644 --- a/sbin/gpt/migrate.c +++ b/sbin/gpt/migrate.c @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #define LABELSECTOR 1 #endif +static int force; static int slice; static void @@ -58,7 +59,7 @@ usage_migrate(void) { fprintf(stderr, - "usage: %s [-s] device\n", getprogname()); + "usage: %s [-fs] device\n", getprogname()); exit(1); } @@ -271,9 +272,11 @@ migrate(int fd) break; } default: - warnx("%s: error: unknown partition type (%d)", - device_name, mbr->mbr_part[i].part_typ); - return; + if (!force) { + warnx("%s: error: unknown partition type (%d)", + device_name, mbr->mbr_part[i].part_typ); + return; + } } } ent = tbl->map_data; @@ -329,8 +332,11 @@ cmd_migrate(int argc, char *argv[]) int ch, fd; /* Get the migrate options */ - while ((ch = getopt(argc, argv, "s")) != -1) { + while ((ch = getopt(argc, argv, "fs")) != -1) { switch(ch) { + case 'f': + force = 1; + break; case 's': slice = 1; break; |