This discussion is archived
13 Replies Latest reply: Jan 24, 2013 9:16 AM by Dude! RSS

PXE Kickstart with auto partitioning free space

Mahmoud_Rabie Journeyer
Currently Being Moderated
Dear Experts,

I am installing linux using PXE+Kickstart+DHCP+TFTP on multiple PCs on my linux lab.

Everything is OK. However I need to configure kickstart to do the following:
1) Given: All PCs have windows and have unpartitioned space (free space) which I dedicated for linux (to be installed by PXE).
Required: How to configure kickstart to automatically partition free space

2) I want kickstart to be configured to make the windows is the default boot in the grub menu.

Best Regards
Mahmoud
  • 1. Re: PXE Kickstart with auto partitioning free space
    Dude! Guru
    Currently Being Moderated
    You can use the "--grow" argument with the part command to tell the partition or logical volume to grow to fill available space (if any), or up to the maximum size "--maxsize" setting.

    To make your Windows system the default boot option, check the bootloader options, such as driveorder and location.

    You can find information about Kickstart options and examples in the standard installation guide for your version of Oracle Linux installed. https://linux.oracle.com/documentation/
  • 2. Re: PXE Kickstart with auto partitioning free space
    Mahmoud_Rabie Journeyer
    Currently Being Moderated
    Dear Dude,
    You can use the "*--grow*" argument with the part command to tell the partition or logical volume to grow to fill available space (if any), or up to the maximum size "--maxsize" setting.
    If I need to partition the free space to be like this
    - 1 /boot partition (200 MB) (ext4)
    - SWAP partition of size (2 GB)
    - / partition fill the maximum allowable space
    Is the following code enough?
    # Partition clearing information
    clearpart --none  
    # Disk partitioning information
    part /boot --fstype="ext4" --size=200
    part swap --fstype="swap" --size=2000
    part / --fstype="ext4" --grow --size=1
    To make your Windows system the default boot option, check the bootloader options, such as --driveorder* and --location.*
    I don't know how to use this option to make partition of  windows as the default boot partition of all LAB's PCs
    My GRUB menu is as follows
    default=0
    timeout=5
    splashimage=(hd0,5)/grub/splash.xpm.gz
    hiddenmenu
    title Windows
         rootnoverify (hd0,0)
         chainloader +1
    title Oracle Linux Server (2.6.39-300.17.3.el6uek.i686)
         root (hd0,5)
         kernel /vmlinuz-2.6.39-300.17.3.el6uek.i686 ro root=UUID=36569233-60ba-42be-abd4-13c3a262a1bd rd_NO_LUKS rd_NO_LVM LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16   KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet
         initrd /initramfs-2.6.39-300.17.3.el6uek.i686.img
    Best Regards
    Mahmoud
  • 3. Re: PXE Kickstart with auto partitioning free space
    Dude! Guru
    Currently Being Moderated
    I would rather increase the boot partition to 500, which is default. 2 GB of swap sounds too small. Are these single processor machines? How much is your RAM? Perhaps use the --recommended argument for the swap partition.

    Regarding the boot loader. What exactly are doing. Are you upgrading the system or performing a new installation? To preserver other boot loaders, available when you upgrade, you can use: bootloader --upgrade.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
  • 4. Re: PXE Kickstart with auto partitioning free space
    Mahmoud_Rabie Journeyer
    Currently Being Moderated
    I would rather increase the boot partition to 500, which is default. 2 GB of swap sounds too small. Are these single processor machines? How much is your RAM? Perhaps use the --recommended argument for the swap partition.
    So the code will be like this. It this right?
    # Partition clearing information
    clearpart --none  
    # Disk partitioning information
    part /boot --fstype="ext4" --size=200
    part swap --fstype="swap" --recommended
    part / --fstype="ext4" --grow --size=1
    Regarding the boot loader. What exactly are doing. Are you upgrading the system or performing a new installation? To preserver other boot loaders, available when you upgrade, you can use: bootloader --upgrade.
    All PC's of lab should have windows for other courses. All PCs have unpartitioned space which I will assign for Linux
    What will be the code make the windows as default boot system?
  • 5. Re: PXE Kickstart with auto partitioning free space
    Dude! Guru
    Currently Being Moderated
    I would have to look into the documentation to help you further. Perhaps it will be your best option to do a normal installation according to your needs on one of the computers. The installer will automatically generate a kick-start configuration file named anaconda-ks.cfg in the root directory. You can most likely use the file to start with and modify it if necessary.
  • 6. Re: PXE Kickstart with auto partitioning free space
    Mahmoud_Rabie Journeyer
    Currently Being Moderated
    Before applying the following automatic partitioning configuration (everything was OK: the booting from LAN then installation)
    # Partition clearing information
    clearpart --none  
    # Disk partitioning information
    part /boot --fstype="ext4" --size=200
    part swap --fstype="swap" --recommended
    part / --fstype="ext4" --grow --size=1
    Now,after updating ks with above code, when I boot one of lab's PCs from LAN, it gives me:
    anaconda 13.21.176 exception report
    Traceback (most recent call first):
       File "/usr/lib/python2.6/site-packages/urlgrabber/grabber.py", line 1097, in _retrieve
          self.fo.write(buf)
    IOError: [Errno 28] No space left on device
    What is the probelm?
  • 7. Re: PXE Kickstart with auto partitioning free space
    Dude! Guru
    Currently Being Moderated
    It probably means that it could not apply your partitioning scheme. You are asking to provide critical information about how to partition your systems and preserve Windows, but provide only vague information about your existing installation. I'm afraid that's not how it works. I still think your best option was to perform a manual install and then analyze anaconda-ks.cfg to find out what you need to do. It should give you a reliable answer you are looking for in less than 30 min.
  • 8. Re: PXE Kickstart with auto partitioning free space
    Mahmoud_Rabie Journeyer
    Currently Being Moderated
    Dear Dude,

    After removing recommended, it works
    # Partition clearing information
    clearpart --none  
    # Disk partitioning information
    part /boot --fstype="ext4" --size=500
    part swap --fstype="swap" --size=4000
    part / --fstype="ext4" --grow --size=1
    In the lab, RAM of any PC is 1GB. I think swap must be more than double of RAM. Am I right?
    I still think your best option was to perform a manual install and then analyze anaconda-ks.cfg to find out what you need to do. It should give you a reliable answer you are looking for in less than 30 min.
    I worked by your advice and installed OEL 6.3 manually on a PC of the lab.The generated code is:
    # System bootloader configuration
    bootloader --location=mbr --driveorder=sde --append="crashkernel=auto rhgb quiet" 
    As I know, changing the default boot during manual installation, changes the */boot/grub/menu.lst.*
    The above ks code is not indicating that windows is the default boot. Am I wrong?

    Best Regards
    Mahmoud
  • 9. Re: PXE Kickstart with auto partitioning free space
    Dude! Guru
    Currently Being Moderated
    There is no must about swap. Swap is no substitute for RAM and the requirement depends on usage. 1 GB of RAM sounds inadequate by most standards today. Your RAM and swap might be sufficient, but it cannot be said based on the current information. Typical rules of thumb like making swap 2 to 3 times the size of RAM depend on your total amount of RAM installed. If remember correctly, once you have more than 8 GB of RAM, you may consider to make swap equal RAM. But then again, it depends.

    Based on your input it seems you have Grub (stage1) installed into the MBR, which is sector 0 that the BIOS scans at system startup. Grub is configured through the file */boot/grub/grub.conf*. The chainloader command in grub.conf indicates a redirection to a Windows boot loader on the first partition of whatever is your current startup device (hd0,0).

    The anaconda installer constructs grub.conf. You should see what it does during the OS install by pressing CTRL-ALT-F5. You can add a postinstall section to your kickstart script and build your own grub.conf file.

    Perhaps the following could work for you:

    <pre>
    %post
    grubconf=/boot/grub/grub.conf
    rootdev=/dev/sde2 # your root device
    uuid=`tune2fs -l $rootdev | grep UUID | awk '{print $NF}'`
    cat > $grubconf <<EOF
    default=0
    timeout=5
    splashimage=(hd0,5)/grub/splash.xpm.gz
    hiddenmenu
    title Windows
    rootnoverify (hd0,0)
    chainloader +1
    title Oracle Linux Server (2.6.39-300.17.3.el6uek.i686)
    root (hd0,5)
    kernel /vmlinuz-2.6.39-300.17.3.el6uek.i686 ro \
    root=$uuid rd_NO_LUKS rd_NO_LVM LANG=en_US.UTF-8 \
    rd_NO_MD SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=us \
    rd_NO_DM rhgb quiet
    initrd /initramfs-2.6.39-300.17.3.el6uek.i686.img
    EOF
    </pre>
  • 10. Re: PXE Kickstart with auto partitioning free space
    Mahmoud_Rabie Journeyer
    Currently Being Moderated
    Dear Dude,

    I have added your code
    %post
    grubconf=/boot/grub/grub.conf
    rootdev=/dev/sde2 # your root device
    uuid=`tune2fs -l $rootdev | grep UUID | awk '{print $NF}'`
    cat > $grubconf <<EOF
    default=0
    timeout=5
    splashimage=(hd0,5)/grub/splash.xpm.gz
    hiddenmenu
    title Windows
           rootnoverify (hd0,0)
           chainloader +1
    title Oracle Linux Server (2.6.39-300.17.3.el6uek.i686)
           root (hd0,5)
           kernel /vmlinuz-2.6.39-300.17.3.el6uek.i686 ro \
    root=$uuid rd_NO_LUKS rd_NO_LVM LANG=en_US.UTF-8 \
    rd_NO_MD SYSFONT=latarcyrheb-sun16   KEYBOARDTYPE=pc KEYTABLE=us \
    rd_NO_DM rhgb quiet
           initrd /initramfs-2.6.39-300.17.3.el6uek.i686.img
    EOF
    before the end of ks file

    It makes windows as default boot but when I select linux it gives me
    Error 17: Cannot mount selected partition
    Press any key to continue ...
    What is the problem?

    Regards
    Mahmoud
  • 11. Re: PXE Kickstart with auto partitioning free space
    Dude! Guru
    Currently Being Moderated
    Where exactly does the problem occur?
    Does it actually load the Linux kernel?
    Is /dev/sde2 your root partition?
    What is your partition layout?

    And last not least, where is /boot located on disk? To boot Linux, or any other system kernel for that matter, the kernel needs to be within the first 1024 cylinders addressable by the BIOS, which could be within the first 8 GB of the hard drive, depending on the age of your system. http://www.tldp.org/HOWTO/Large-Disk-HOWTO-4.html
  • 12. Re: PXE Kickstart with auto partitioning free space
    Mahmoud_Rabie Journeyer
    Currently Being Moderated
    Dear Dude

    Thanks again for your kind support
    Where exactly does the problem occur?
    In the remote PC of the lab
    Does it actually load the Linux kernel?
    No. Just after selecting Linux from grub menu.
    Is /dev/sde2 your root partition?
    What is your partition layout?
    I don't understand you.
    How to get it before installing linux?
    Partition layout is specified in the ks file!
    And last not least, where is /boot located on disk? To boot Linux, or any other system kernel for that matter, the kernel needs to be within the first 1024 cylinders addressable by the BIOS, which could be within the first 8 GB of the hard drive, depending on the age of your system. http://www.tldp.org/HOWTO/Large-Disk-HOWTO-4.html
    How to employ this to solve or avoid the problem?

    Best Regards
    Mahmoud
  • 13. Re: PXE Kickstart with auto partitioning free space
    Dude! Guru
    Currently Being Moderated
    In the remote PC of the lab
    Can you be more specific? Do you have the GPS coordinates? ;-) But seriously, I certainly did not mean the physical location of your computer. The question was where in the boot process the problem occurs.
    Partition layout is specified in the ks file!
    All that I can see from your ks file is that you are are using the 5th partition of your startup device as /boot, from where it should load the Linux kernel. Your boot loader configuration shows your startup device is /dev/sde which corresponds the 5 drive in the system. Is that a USB drive, or do you have 5 hard drives installed in the system? You need to determine where the Linux system and Windows partition resides and adjust the grub installation menu accordingly. There is no way for me here to guess your configuration or what you installed.
    How to employ this to solve or avoid the problem?
    You may need to completely re-adjust your partition layout and move the Linux and Windows boot partitions to the start of the hard drive, e.g. /dev/sda1 and /dev/sda2, or use a different hard drive to install Linux if you cannot adjust your windows partitions.

    Anyway, if you cannot share information about your system, sorry, I'm afraid I cannot spoon feed you the solution. What you are trying to accomplish requires specific technical background. Perhaps you might consider asking someone else to give you a hand.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points