On 12/16/14 07:13, Michael wrote:
Hi,

I faced the same exact trouble some months ago with new Linux Workstations.
I did not had the choice : _MUST_ install via a gpt part.

This is what I put in my Kickstart to fix the issue and deploy the Worstations
(CentOS 6.5):

/# partition Disk Section
clearpart --all --initlabel
part /boot --fstype=ext4 --size=500 --asprimary
part /boot/efi --fstype=efi --grow --maxsize=200 --size=50 --asprimary
part / --fstype=ext4 --size=38000 --asprimary
#part swap --size=2048
part swap --hibernation
part /Lwork --fstype=ext4 --size=1 --grow
%packages --ignoremissing
.
.
.
efibootmgr.x86_64
.
.
.
%post --log=/root/ks-post.log
.
.
.
# Enable our EFI entry in the stupid EFI Bios provider !
/usr/sbin/efibootmgr
/usr/sbin/efibootmgr -b 0000 -B
/usr/sbin/efibootmgr -c -w -L 'CentOS' -l \\EFI\\redhat\\grub.efi
/usr/sbin/efibootmgr -v
.
.
./

I guess this looks like an ugly hack... But I was able to automate installation,

since I did not find any informations at the time to deploy the WS.

See the man page of efibootmgr to understand what it does to your system.

Be very careful with options/-b 0000/  and/-B/  since it delete the first boot 
entry !

Look at the//boot partitions to be complete./

Hope it will help you. Let us know. :-)


Regards,

/Michael PATRIS
/
Thales Alenia Space Belgium


2014-12-15 23:33 GMT+01:00 Albino A. Aveleda <[email protected]
<mailto:[email protected]>>:

    Dear all,

    I have to use the GPT partition because my disk array is bigger than 2TB.
    I am using CentOS 6.5 and cobbler 2.6.3.
    I added the pre section in my kickstart to create a partiotion with parted
    command, but it didn't work. I looked for on Internet but I can't find the
    error.
    Part of my kickstart is below. What do I do wrong?

    ...
    # Disk
    clearpart --none
    part /boot --fstype="ext4" --onpart=sda1
    part swap --onpart=sda2
    part / --fstype="ext4" --onpart=sda3

    %packages
    ...
    %end

    %pre
    parted -s /dev/sda mklabel gpt
    parted -s /dev/sda unit MB mkpart primary 1 300
    parted -s /dev/sda unit MB mkpart primary 300 1024
    parted -s /dev/sda unit MB mkpart primary 1024 -1
    parted -s /dev/sda set 1 boot on
    parted -s /dev/sda set 2 swap on
    %end

    Best regards,
    Bino

    _______________________________________________
    cobbler mailing list
    [email protected] <mailto:[email protected]>
    https://lists.fedorahosted.org/mailman/listinfo/cobbler



_______________________________________________
cobbler mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/cobbler


Now that I am at work using a _real_ email client instead of my idevice...

The solution I used was to place the following near the top of my ks file:
%include /tmp/partinfo

Then I put the following early in the %pre section:
$SNIPPET('partitioning')

This snippet contains (hopefully no lines will fold):
------------------------------------------------------------------------
# Start of snippets/partitioning

# ######################################################################
# This tries to handle the partioning automatically.  There are some OS
# requirements (1-7) and there are some constraints we impose (8-10):
# 1.  If the disk is over 2T, it can't use an MSDOS partition table.
#     It must use a GPT partition table.
# 2.  If the system is UEFI, it won't have a BIOS.  All disks must be
#     partitioned with a GPT partition table.
# 3.  Many UEFI systems can be downgraded to "Legacy BIOS" mode, in which
#     case it won't appear to be UEFI.
# 4.  All UEFI systems need a special EFI partition (minimum 50M) on the
#     boot disk.
# 5.  All BIOS systems with GPT disks must have a BIOSBOOT partition
#     (minimum 1M) on the boot disk.
# 6.  We don't want to use autopart because we want to control the
#     partitioning (see below). Older OSes will create the BIOSBOOT and
#     EFI partitions automatically even when using explicit partitioning.
#     The newer OSes will not.
# 7.  The older OSes will use an unpartioned disk (if GPT is not needed),
#     the new OSes need all used disks to have a valid partition before the
#     install.
# 8.  We don't want our system to be spread over multiple disks.  We will
#     use the first disk available larger than a minimum (unless a list is
#     passed in).
# 9.  We want our partitioning to use one large / partition, no /usr etc.
# 10. We want an ext4 file system type on older systems, XFS on newer
#     systems.
# ######################################################################

# ######################################################################
# There are a few parameters that may be passed in via "Kickstart
# Metadata" (or otherwise):
#
# Parameter     Default         Description
# MINDISK       50              Minimum size disk we will use.
# DISKS         ''              The list of disks to use.
# BIOSORDER     ''              The list of disks in the order as the
#                               BIOS sees it. See the "bootloader"
#                               Anaconda command.
# ######################################################################

# ######################################################################
# A note about disk names:
#       We pass around the names of the devices without /dev/ on the
# front. We prefix the /dev path when passing it to system tools such
# as parted.  Lists of names are passed space separated. We insert commas
# where necessary.  Any Kickstart Metadata containing /dev/ or commas are
# cleaned as necessary.
# ######################################################################

CleanDisks () {
        echo \$(
                for disk in \$(echo "\$@" | sed 's/,/ /g')
                do
                        echo \${disk#/dev/}
                done
        )
}

## Determine what disk(s) we could use:
#set $mindisk=$getVar('MINDISK','50')
#set $disks=$getVar('DISKS','')
#if $disks == ''
# Get the first disk (alphabetically) that is larger than the minimum size:
DISKS=\$(list-harddrives | awk '$2 < $mindisk {next} \$1 ~ /^\/dev\// {print substr(\$1,6) ; next} {print \$1}' | sort | sed -n 1p)
DISKS=\$(CleanDisks \$DISKS)
#else
DISKS=\$(CleanDisks $disks)
#end if

#set $biosorder=$getVar('BIOSORDER','')
#if $biosorder == ''
# We assume this command lists them in BIOS order:
BIOSORDER=\$(CleanDisks \$(list-harddrives | sed -e 's/ .*//'))
#else
BIOSORDER=\$(CleanDisks $biosorder)
#end if

## Set some variables based upon the OS being installed
#set $os=$getVar('os_version','')
#if ($os.find("rhel") >= 0 and int($os[$os.find("rhel")+4:]) >= 7) or ($os.find("fedora") >= 0 and int($os[$os.find("fedora")+6:]) >= 20)
        #set $fstype='xfs'
#else
        #set $fstype='ext4'
#end if

# Determine which disks are too big and which need explicit partitioning:
GPTDISKS=
for disk in \$DISKS
do
        if [ -e /sys/firmware/efi ]
        then
                mustgpt=true
elif echo q | fdisk /dev/\$disk 2>&1 | grep 'DOS partition table format can not be used on drive' >/dev/null
        then
                mustgpt=true
        else
                mustgpt=false
        fi

        if \$mustgpt
        then
                : we must create a label
                parted -a optimal -s /dev/\$disk mklabel gpt
                if [ -z "\$GPTDISKS" ]
                then
                        GPTDISKS="\$disk"
                else
                        GPTDISKS="\$GPTDISKS \$disk"
                fi
        else
if echo q | fdisk /dev/\$disk 2>&1 | grep 'Device does not contain a recognized partition table' >/dev/null
                then
                        parted -a optimal -s /dev/\$disk mklabel msdos
                fi
        fi
done

# Start building the partitioning information:
: > /tmp/partinfo

for disk in \$GPTDISKS
do
        if [ -e /sys/firmware/efi ]
        then
                echo "part efi --size=50 --ondisk=\$disk"
        else
                echo "part biosboot --size=1 --ondisk=\$disk"
        fi
        # because we only would boot from the first one:
        break
done >> /tmp/partinfo

disks=\$(echo \$DISKS | sed 's/ /,/g')
biosorder=\$(echo \$BIOSORDER | sed 's/ /,/g')
cat <<! >> /tmp/partinfo
bootloader --location=mbr --driveorder=\$biosorder --append="crashkernel=auto rhgb quiet"
zerombr
clearpart --drives=\$disks --all
ignoredisk --only-use=\$disks
part /boot --size=512
part swap --recommended
part / --fstype=$fstype --size=8192 --grow
!

# End of snippets/partitioning
------------------------------------------------------------------------

I also added /tmp/partinfo to the files copied in snippet log_ks_pre.

--
Gary Algier, WB2FWZ            [email protected]             +1 856 787 2758
Ulticom Inc., 1020 Briggs Rd, Mt. Laurel, NJ 08054     Fax:+1 856 866 2033
_______________________________________________
cobbler mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/cobbler

Reply via email to