Why PvCreate failed at Fedora install (kickstart)

asked 2019-03-06 01:52:52 -0500

updated 2019-03-06 04:02:54 -0500

hhlp gravatar image

[ kickstart Pre] # Pre Section %pre #!/bin/bash DIR="/sys/block"

#check install USB drive
USB_drive=" "
if [ -e /dev/disk/by-label/SecuiOS-4-x86_64 ]; then
    USB_drive="$( readlink /dev/disk/by-label/SecuiOS-4-x86_64 | cut -d '/' -f 3 | cut -c 1-3 )"
fi

#scan first Drive (SSD or HDD)
DRIVE1=""
for DEV in sda sdb sdc sdd hda hdb; do 
    if [ -d $DIR/$DEV ]; then
        if [[ "$DEV" != "$USB_drive" ]]; then
            echo "[ HAM ] clear $DEV" > /tmp/clear_result
            wipefs --all --force /dev/$DEV >> /tmp/clear_result
            fdisk -l /dev/$DEV >> /tmp/clear_result
            DRIVE1=$DEV
            break
        fi
    fi
done
#scan sencond HDD drive
for DEV in sda sdb sdc sdd hda hdb; do 
    if [ -d $DIR/$DEV ]; then
        if [[ "$DEV" != "$USB_drive" ]] && [[ "$DEV" != "$DRIVE1" ]]; then
            echo "[ HAM ] clear $DEV" >> /tmp/clear_result
            wipefs --all --force /dev/$DEV >> /tmp/clear_result
            fdisk -l /dev/$DEV >> /tmp/clear_result
            DRIVE2=$DEV
            break
        fi
    fi
done
#scan third HDD drive
for DEV in sda sdb sdc sdd hda hdb; do 
    if [ -d $DIR/$DEV ]; then
        if [[ "$DEV" != "$USB_drive" ]] && [[ "$DEV" != "$DRIVE1" ]] && [[ "$DEV" != "$DRIVE2" ]]; then
            echo "[ HAM ] clear $DEV" >> /tmp/clear_result
            wipefs --all --force /dev/$DEV >> /tmp/clear_result
            fdisk -l /dev/$DEV >> /tmp/clear_result
            DRIVE3=$DEV
            break
        fi
    fi
done

if [[ ! -z $DRIVE2 ]]; then
    CLEAR_DISK="$DRIVE1,$DRIVE2"
else
    CLEAR_DISK=$DRIVE1
    DRIVE2=$DRIVE1
fi

#First Storage : OS, Second Storage : LOG
#sda: m.2 512GB, md126(RAID): 2TB (sdb: SSD 2TB, sdc: SSD 2TB)
if [[ ! -z $DRIVE3 ]]; then
    CLEAR_DISK="$DRIVE1,$DRIVE2,$DRIVE3"
fi

echo "clearpart --all --initlabel --drives=$CLEAR_DISK" > /tmp/partition
echo "zerombr" >> /tmp/partition
DISKSIZE=`parted -sm /dev/$DRIVE1 unit GB print | grep -e "$DRIVE1" | cut -d: -f2 | sed -e 's/GB$//'`
if [ -e /sys/firmware/efi -o $DISKSIZE -gt 2100 ]; then
    # bios boot partition necessary
    echo "part biosboot --fstype=biosboot --size=1 --ondisk=$DRIVE1" >> /tmp/partition
fi

#echo "part /boot --fstype=ext4 --ondisk=$DRIVE1 --size=500" >> /tmp/partition
if [[ ! -z $DRIVE3 ]]; then
    echo "part pv.01 --fstype=lvmpv --ondisk=$DRIVE1 --size=4096 --grow" >> /tmp/partition

    echo "part raid.01 --fstype=mdmember --ondisk=$DRIVE2 --size=4096 --grow" >> /tmp/partition
    echo "part raid.02 --fstype=mdmember --ondisk=$DRIVE3 --size=4096 --grow" >> /tmp/partition

    echo "raid pv.02 --fstype=lvmpv --device=md126 --level=RAID1 raid.01 raid.02" >> /tmp/partition
else
    if [[ "$DRIVE1" != "$DRIVE2" ]]; then
        echo "part pv.01 --fstype=lvmpv --ondisk=$DRIVE1 --size=4096 --grow" >> /tmp/partition
        echo "part pv.02 --fstype=lvmpv --ondisk=$DRIVE2 --size=4096 --grow" >> /tmp/partition
    else
        echo "part pv.01 --fstype=lvmpv --ondisk=$DRIVE1 --size=65536" >> /tmp/partition
        echo "part pv.02 --fstype=lvmpv --ondisk=$DRIVE1 --size=1024 --grow" >> /tmp/partition
    fi
fi

echo "volgroup VG_SYS pv.01" >> /tmp/partition
echo "volgroup VG_LOG pv.02" >> /tmp/partition

echo "logvol / --vgname=VG_SYS --fstype=xfs --percent=50 --name=LV_ROOT" >> /tmp/partition
echo "logvol /secui/tmp --vgname=VG_SYS --fstype=xfs --percent=20 --name=LV_TMP" >> /tmp/partition
echo "logvol /secui/log --vgname=VG_LOG --fstype=ext4 --size=10240 --name=LV_LOG_1" >> /tmp/partition

BOOT_DRIVE=$DRIVE1 ...
(more)
edit retag flag offensive close merge delete

Comments

Please include more context. Are you developing the Fedora installation scripts? What kind of machine is this? How many and what kinds of mass storage is installed? Do you know about udev but can't figure out what kernel device name to trigger on? What is in the log files (dmesg, etc.)?

wallyk gravatar imagewallyk ( 2019-03-06 09:05:47 -0500 )edit