X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=tools%2Fvirt-make-fs;h=28b4abad621c1c7d447d9e9ff35c3619600e5855;hb=c214cdc54e955ff1a01c00b99b0d6bd20e8b6bcd;hp=1a19b98335e0c570b0a3458af4a1107e9be05961;hpb=c49fc3831d12788c27b90d12f06a1cd69a88e3be;p=libguestfs.git diff --git a/tools/virt-make-fs b/tools/virt-make-fs index 1a19b98..28b4aba 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;