6 Replies Latest reply on Mar 22, 2012 12:00 PM by Bill Robinson

    Provision Linux Server with LVM

    Jonathan Bishop

      We are trying to provision a linux server with an LVM partition. In the Preinstall, we have the following:


      #!/bin/sh
      NEWDISK=/dev/sda
      dd if=/dev/zero of=$NEWDISK bs=512 count=1
      parted -s $NEWDISK mklabel msdos
      parted -s $NEWDISK print

       

      parted -s $NEWDISK unit b mkpart primary 1048576 210763775
      parted -s $NEWDISK toggle 1 boot

       

      parted -s $NEWDISK unit b mkpart primary 210763776 100%
      parted -s $NEWDISK toggle 2 lvm

       

      And in the disk partitions, we have the following:

       

       

       

       

       

       

       

       

       

       

       

       

       

       

      part /boot --fstype ext3 --size=200 --onpart=sda1
      part pv.2 --size=0 --grow --onpart=sda2
      volgroup VolGroup00 --pesize=32768 pv.2
      logvol swap --fstype swap --name=LogVol01 --vgname=VolGroup00 --size=2048
      logvol / --fstype ext3 --name=LogVol00 --vgname=VolGroup00 --size=6144 --grow --maxsize=12288
      logvol /perfmetrics --fstype ext3 --name=perfmetrics --vgname=VolGroup00 --size=1024
      logvol /dsto --fstype ext3 --name=dsto --vgname=VolGroup00 --size=32
      logvol /dsto/sw/global/bladelogic --fstype ext3 --name=bladelogic --vgname=VolGroup00 --size=1024
      logvol /var --fstype ext3 --name=var --vgname=VolGroup00 --size=4096 --grow --maxsize=8192

       

      When we run the provisioning job, the preinstall runs successfully and reboots into the redhat, then the redhat installer fails to find /dev/sda1

      When I switch consoles to get a terminal prompt (before allowing the machine to reboot) I can print the partition tables, and it shows 2 partitions on /dev/sda (as expected)

      Has anybody successfully created LVM partitions during a server provision?

       

        • 1. Provision Linux Server with LVM
          Bill Robinson

          have you tried '--onpart /dev/sda1' ?

           

          does your example above work outside of bladelogic ?

          • 2. Re: Provision Linux Server with LVM
            Jonathan Bishop

            Yes, the partitioning is taken from a kickstart file the SA's currently use. I can't see any logical reason it isn't working in blade.

             

            We did try specifying /dev/sda1 it made no difference. For whatever reason, when using blade to provision, the kickstart isn't seeing the partitions that the preinstall is creating. When RedHat gives the error that it is unable to locate sda1, we can switch to another shell and print the partition table, and it shows two partitions with the 1M offset on /dev/sda.

             

            What we found that does work though is clearing the preinstall script completely and changing from onpart to ondisk, specifying the start and size in the part line, and dropping the below block in the disk partitioning tab:

             

            part /boot --fstype ext3 --size=200 --ondisk=sda --start=2048

            part pv.2 --size=0 --grow --ondisk=sda

            logvol swap --fstype swap --name=LogVol01 --vgname=VolGroup00 --size=2048

            logvol / --fstype ext3 --name=LogVol00 --vgname=VolGroup00 --size=6144 --grow --maxsize=12288

            logvol /perfmetrics --fstype ext3 --name=perfmetrics --vgname=VolGroup00 --size=1024

            logvol /dsto --fstype ext3 --name=dsto --vgname=VolGroup00 --size=32

            logvol /dsto/sw/global/bladelogic --fstype ext3 --name=bladelogic --vgname=VolGroup00 --size=1024

            logvol /var --fstype ext3 --name=var --vgname=VolGroup00 --size=4096 --grow --maxsize=8192

             

             

            • 3. Re: Provision Linux Server with LVM
              Jonathan Bishop

              start=2048 may not be correct - use the starting cylinder you want - I created the partitions with the offset in parted and then printed the partition table with fdisk and that's what it showed me. Milage may vary - when I installed with this option, it started my primary partition 16gb in.

              • 4. Re: Provision Linux Server with LVM
                Bill Robinson

                You are passing the same kernel boot options to blade that you are passing to the rhel boot when you go outside of blade?  and it’s the same version of rhel?

                 

                By the time we are running kickstart, it should be native kickstart.  Can you past in the whole kickstart file that blade generates?  It should be in the system package tabs.  Maybe there’s something funny there.

                • 5. Re: Provision Linux Server with LVM
                  Jonathan Bishop

                  Okay, some more tweaking and this is what we found... when using a blade generated kickstart, blade adds the line "clearpart=all" which doesn't actually seem to delete the partitions (at least not before it fails with the onpart=sda1) but cannot be used with onpart (according to the redhat kickstart options http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/5/html/Installation_Guide/s1-kickstart2-options.html )

                   

                  We changed to using a custom kickstart file, and changed that line to "clearpart=none" and re-added our preinstall block to the kickstart - now it is creating the partitions with a 1M offset and installing to them.

                  • 6. Re: Provision Linux Server with LVM
                    Bill Robinson

                    ah – not great.  same problem w/ the bootloader line.  both of those should be separately configured which is a defect or rfe depending how you look at it.