(usb) Disk not seen by installation script

General support questions
Post Reply
michael600
Posts: 8
Joined: 2017/10/08 03:09:45

(usb) Disk not seen by installation script

Post by michael600 » 2017/10/11 06:49:35

Hi
Am trying to install a centos 7 based distro using a single USB device, but the anaconda installer stalls given the message:
Disk "" given in clearpart command does not exist
Prior to the clearpart command, the script does not seem to like a removable disc install, viz text in bold (sorry, BOLD does not seem to work within CODE):

Code: Select all

%pre --log /root/diskpart.log --interpreter /bin/bash
set -x -v
exec 1>/tmp/ks-pre.log 2>&1

# Function for joining arrays together
function join { local IFS="$1"; shift; echo "$*"; }

# Function to get explicit by-id of device
function getid {
	# Make sure we change ! to / for /dev/cciss/c0d0 etc.
	DEV=$(echo $1 | sed 's^!^/^')
	DEVID=$(/usr/sbin/udevadm info --query=property --name=/dev/$DEV | grep DEVLINKS= | cut -d= -f2 | cut -d\  -f1)
	# If we didn't get a device id, then just return the path. This can happen
	# with virtual devices.
	if [ ! "$DEVID" ]; then
		echo $DEV
	else
		echo $DEVID
	fi
}

# [b]Is this machine booted in EFI mode? Assume no.
UEFI=false[/b]

[[ -e /sys/firmware/efi ]] && UEFI=true

COUNT=0

# Get a list of our disks on this machine
lsblk -bdrno KNAME,TYPE,SIZE,RM,HCTL > /tmp/lsblk.out

# Loop throught them
while read DEV TYPE SIZE RM HCTL; do
    # If it's not a disk, ignore
    if [[ $TYPE != "disk" ]]; then
        continue;
    fi

    # If it's a ram disk, ignore
    if [[ $DEV == zram* ]]; then
	continue;
    fi

   [b] # Automatically ignore any removable devices[/B]
    #
    # TODO: This may need more work.  (Check for 8gb or less?)
    #
[b]    if [[ $RM == 1 ]]; then
      continue;
     fi[/B]

    COUNT=$(( $COUNT + 1 ))
    DEVICE[${COUNT}]=$(getid $DEV)
    STDDEVICE[${COUNT}]=$DEV
    SIZE[${COUNT}]="$SIZE"
    TYPE[${COUNT}]="$TYPE"

    # Make sure there's not any biosraid cruft on the device, which causes anaconda to crash
    dd if=/dev/zero of=$DEV bs=512 seek=$(( $(blockdev --getsz /dev/$DEV) - 1024 )) count=1024
done < /tmp/lsblk.out

echo "creating partitioning config"
VALIDDRIVES=$(join , ${DEVICE[*]})


# Are we not doing LVM?
if [[ "$(grep nolvm /proc/cmdline)" ]]; then
	# Nuke the disk's current partition information
	D=/dev/${STDDEVICE[1]}
	dd if=/dev/zero of=$D bs=1M count=1
	parted -s $D mklabel msdos
	# Create root, swap, and make it active.
	if [[ "$(grep tiny-10g /proc/cmdline)" ]]; then
		parted -a optimal -s $D mkpart primary ext3 0% 9G
		parted -a optimal -s $D mkpart primary linux-swap 9G 10G
	else
		parted -a optimal -s $D mkpart primary ext3 0% 95%
		parted -a optimal -s $D mkpart primary linux-swap 95% 100%
	fi
	parted -s $D set 1 boot on
	partprobe $D

cat << EOF > /tmp/partitioning
zerombr
bootloader --boot-drive=${DEVICE[1]} --driveorder=$(join , ${STDDEVICE[*]}) --append="net.ifnames=0 biosdevname=0"
part / --label=root --fstype ext3 --onpart=${D}1
part swap --onpart=${D}2
EOF

	exit
fi

# Otherwize
cat << EOF > /tmp/partitioning
zerombr
clearpart --initlabel --all --drives=${VALIDDRIVES}
bootloader --boot-drive=${DEVICE[1]} --driveorder=$(join , ${STDDEVICE[*]}) --append="net.ifnames=0 biosdevname=0"
reqpart

EOF

# Are we skipping HDD configuration?
if [[ "$(grep skip-hdd-setup /proc/cmdline)" ]]; then
	exit
fi
Tried removing the line:
if [[ $RM == 1 ]]
but that did not help

Anyone can help?

Also does following coding allow for a solitary USB to be partitioned during the install to preserve the installation files? Here:

Code: Select all

# Do we have a single device? 
if [[ $COUNT == 1 ]]; then
    echo "part /boot --label=bootvol --fstype ext4 --size=2000"  >> /tmp/partitioning
    echo "part pv.20 --label=rootvg --grow --size=4000"  >> /tmp/partitioning
elif [[ $COUNT == 2 ]]; 
Thanks
Michael600

Post Reply