1 Reply Latest reply on Oct 16, 2012 1:44 PM by houkouonchi

    Anyway to force MSDOS partition layout

    houkouonchi Newbie

      When creating an appliance as CentOS the partition table/layout is MSDOS/MBR. When I make a fedora appliances it uses GPT/GUID. Unfortunately I have some things that don't have compatability with GPT/GUID for doing partition resizing/expanding. I was wondering if there was a way to force MBR/MSDOS instead of GPT/GUID in the appliances file?

       

      I tried searching but didn't find my answer.

        • 1. Re: Anyway to force MSDOS partition layout
          houkouonchi Newbie

          I was able to force msdos by modifying:

           

          /usr/lib/python/2.7/site-packages/appcreate/appliance.py.

           

          I changed:

           

              # TODO: this most probably needs to be changed because we're not
              # resolving packages from package groups
              if 'grub2' in packages:
                  self.grub = 'grub2'
                  partition_layout = 'gpt'
              elif 'grub' in packages:
                  self.grub = 'grub'

           

          to:

           

              # TODO: this most probably needs to be changed because we're not
              # resolving packages from package groups
              if 'grub2' in packages:
                  self.grub = 'grub2'
                  partition_layout = 'msdos'
              elif 'grub' in packages:
                  self.grub = 'grub'

           

          I then ran into a problem of grub2 not wanting to install:

           

          D, [2012-10-15T21:56:33.169421 #22952] DEBUG -- : Installing grub2 to /dev/loop2

          D, [2012-10-15T21:56:34.190044 #22952] DEBUG -- : /usr/sbin/grub2-bios-setup: warning: your embedding area is unusually small.  core.img won't fit in it..

          D, [2012-10-15T21:56:34.198679 #22952] DEBUG -- : /usr/sbin/grub2-bios-setup: warning: Embedding is not possible.  GRUB can only be installed in this setup by using blocklists.  However, blocklists are UNRELIABLE and their use is discouraged..

          D, [2012-10-15T21:56:34.199067 #22952] DEBUG -- : /usr/sbin/grub2-bios-setup: error: will not proceed with blocklists.

          D, [2012-10-15T21:56:34.223045 #22952] DEBUG -- : Unable to create appliance : Unable to install grub2 bootloader

          D, [2012-10-15T21:56:34.261776 #22952] DEBUG -- : Unmounting directory /appliances/build/appliances/x86_64/fedora/17/fedora17-cloudinit/1.0/fedora-plugin/tmp/imgcreate-xW0tTf/install_root/

           

          I tried to force grub 1.x as I know it would not have a problem with little space between the partitions but I was able to edit

           

          /usr/lib/python2.7/site-packages/appcreate/partitionedfs.py

           

          and changed the partition offset to allow for more room from:

           

          class PartitionedMount(Mount):

              def __init__(self, disks, mountdir, partition_layout):

                  Mount.__init__(self, mountdir)

                  self.disks = {}

                  for name in disks.keys():

                      self.disks[name] = { 'disk': disks[name],  # Disk object

                                           'mapped': False, # True if kpartx mapping exists

                                           'numpart': 0, # Number of allocate partitions

                                           'partitions': [], # indexes to self.partitions

                                           'extended': 0, # Size of extended partition

                                           'offset': 0 } # Offset of next partition

           

          to:

           

          class PartitionedMount(Mount):

              def __init__(self, disks, mountdir, partition_layout):

                  Mount.__init__(self, mountdir)

                  self.disks = {}

                  for name in disks.keys():

                      self.disks[name] = { 'disk': disks[name],  # Disk object

                                           'mapped': False, # True if kpartx mapping exists

                                           'numpart': 0, # Number of allocate partitions

                                           'partitions': [], # indexes to self.partitions

                                           'extended': 0, # Size of extended partition

                                           'offset': 2 } # Offset of next partition