diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2011-10-21 16:02:34 +0100 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2011-10-21 16:02:34 +0100 |
commit | 0c06d740b77fb9225a0e2bd13dc88b0b88ee87cb (patch) | |
tree | b48ffd8c2843b9208808bfe424d86181aa8d46a4 /tools | |
parent | 527079aa0db9b608ee4c25e7b3eccc4058685608 (diff) | |
download | libguestfs-0c06d740b77fb9225a0e2bd13dc88b0b88ee87cb.tar.gz libguestfs-0c06d740b77fb9225a0e2bd13dc88b0b88ee87cb.tar.xz libguestfs-0c06d740b77fb9225a0e2bd13dc88b0b88ee87cb.zip |
virt-make-fs: Set MBR partition type byte correctly (RHBZ#746295).
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/virt-make-fs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tools/virt-make-fs b/tools/virt-make-fs index 1a19b983..28b4abad 100755 --- a/tools/virt-make-fs +++ b/tools/virt-make-fs @@ -423,6 +423,22 @@ eval { $partition = "mbr" if $partition eq ""; $g->part_disk ($dev, $partition); $dev = "/dev/sda1"; + + # Set the partition type byte if it's MBR and the filesystem + # type is one that we know about. + my $mbr_id; + if ($partition eq "mbr") { + if ($type =~ /^v?fat$/) { + $mbr_id = 0xb; + } elsif ($type eq "ntfs") { + $mbr_id = 0x7; + } elsif ($type =~ /^ext\d$/) { + $mbr_id = 0x83; + } elsif ($type eq "minix") { + $mbr_id = 0x81; + } + } + $g->part_set_mbr_id ("/dev/sda", 1, $mbr_id) if defined $mbr_id; } print STDERR "creating $type filesystem on $dev ...\n" if $debug; |