summaryrefslogtreecommitdiffstats
path: root/sbin/gpt/migrate.c
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2002-12-02 01:42:03 +0000
committermarcel <marcel@FreeBSD.org>2002-12-02 01:42:03 +0000
commit4abeaed33de9450b5e4900151806d6b8329b4958 (patch)
treef64f1e9698713b9f0a3d0bedc5af4f9a905e7278 /sbin/gpt/migrate.c
parentd5387889cf085aef87f5ad40da8b3971385e2a1e (diff)
downloadFreeBSD-src-4abeaed33de9450b5e4900151806d6b8329b4958.zip
FreeBSD-src-4abeaed33de9450b5e4900151806d6b8329b4958.tar.gz
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)
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 eca172d..f0affa9 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;
OpenPOWER on IntegriCloud