1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-14 10:09:48 +00:00

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.
This commit is contained in:
Marcel Moolenaar 2004-11-13 05:44:02 +00:00
parent 597c201050
commit 9e57e1869c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=137642
2 changed files with 21 additions and 5 deletions

View File

@ -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

View File

@ -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;