aboutsummaryrefslogtreecommitdiff
path: root/sbin/gpt/migrate.c
diff options
context:
space:
mode:
authorMarcel Moolenaar <marcel@FreeBSD.org>2002-12-02 01:42:03 +0000
committerMarcel Moolenaar <marcel@FreeBSD.org>2002-12-02 01:42:03 +0000
commit2a944ecdef6ec56a163f59716f63966c97463abf (patch)
treef64f1e9698713b9f0a3d0bedc5af4f9a905e7278 /sbin/gpt/migrate.c
parent8e7ea1fc7dba75810b0d8c8a0fb46e0f9ddf16c3 (diff)
downloadsrc-2a944ecdef6ec56a163f59716f63966c97463abf.tar.gz
src-2a944ecdef6ec56a163f59716f63966c97463abf.zip
o Newer EFI implementations require that a GPT is preceeded by
a PMBR. Make sure the create command creates a PMBR as well (if not already present). o When parsing the MBR, explicitly check for a PMBR and create a PMBR map node if one is found. o When parsing the MBR, recurse to handle extended partitions. This allows us to flatten nested MBRs when migrating to a GPT. o Have the migrate command bail out if it encounters a partition it doesn't know how to migrate. This avoids data loss. o Change the output of the show command so that the UUIDs of the GPT partitions fit on the same line. o Show when partitions are extended partitions and add the PMBR type. Approved by: re (blanket)
Notes
Notes: svn path=/head/; revision=107482
Diffstat (limited to 'sbin/gpt/migrate.c')
-rw-r--r--sbin/gpt/migrate.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/sbin/gpt/migrate.c b/sbin/gpt/migrate.c
index eca172d0f8fd..f0affa90761f 100644
--- a/sbin/gpt/migrate.c
+++ b/sbin/gpt/migrate.c
@@ -92,6 +92,8 @@ migrate_disklabel(int fd, off_t start, struct gpt_ent *ent)
break;
}
default:
+ warnx("%s: warning: unknown FreeBSD partition (%d)",
+ device_name, dl->d_partitions[i].p_fstype);
continue;
}
@@ -120,9 +122,8 @@ migrate(int fd)
last = mediasz / secsz - 1LL;
map = map_find(MAP_TYPE_MBR);
- if (map == NULL || map_find(MAP_TYPE_MBR_PART) == NULL) {
- warnx("%s: error: no partitions to convert",
- device_name);
+ if (map == NULL || map->map_start != 0) {
+ warnx("%s: error: no partitions to convert", device_name);
return;
}
@@ -212,6 +213,8 @@ migrate(int fd)
size = (size << 16) + mbr->mbr_part[i].part_size_lo;
switch (mbr->mbr_part[i].part_typ) {
+ case 0:
+ continue;
case 165: { /* FreeBSD */
if (slice) {
uuid_t freebsd = GPT_ENT_TYPE_FREEBSD;
@@ -235,7 +238,9 @@ migrate(int fd)
break;
}
default:
- continue;
+ warnx("%s: error: unknown partition type (%d)",
+ device_name, mbr->mbr_part[i].part_typ);
+ return;
}
}
ent = tbl->map_data;