Re: RHEL5 kickstart overwrites USB

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



	What I use is:

#Obtain first drive from system and number of them
set $(list-harddrives)
let numd=$#/2 # Number of drives
d1=$1 # Device for first drive
S1=$2 # Size of first drive (and so on $3,$4, etc)

	So you can process them after that

	Regards
	Pablo


On Thu, 11 Oct 2007, Jason Edgecombe wrote:

> Hi There,
>
> I use the following snippet in my kickstart files:
> ======
> %include /tmp/part-include
>
> %pre
> #----- partitioning logic below--------------
> # pick the first drive that is not removable and is over MINSIZE
> DIR="/sys/block"
>
> # minimum size of hard drive needed specified in GIGABYTES
> MINSIZE=23
>
>
> ROOTDRIVE=""
>
> # /sys/block/*/size is in 512 byte chunks
>
> for DEV in sda sdb hda hdb; do
>   if [ -d $DIR/$DEV ]; then
>     REMOVABLE=`cat $DIR/$DEV/removable`
>     if (( $REMOVABLE == 0 )); then
>       echo $DEV
>       SIZE=`cat $DIR/$DEV/size`
>       GB=$(($SIZE/2**21))
>       if [ $GB -gt $MINSIZE ]; then
>         echo "$(($SIZE/2**21))"
>         if [ -z $ROOTDRIVE ]; then
>           ROOTDRIVE=$DEV
>         fi
>       fi
>     fi
>   fi
> done
>
> echo "ROOTDRIVE=$ROOTDRIVE"
>
> cat << EOF >> /tmp/part-include
> bootloader --location=mbr --driveorder=$ROOTDRIVE
> clearpart --all --drives=$ROOTDRIVE --initlabel
> part /boot --fstype ext3 --size=300 --asprimary --ondisk=$ROOTDRIVE
> part /tmp --fstype ext3 --size=5000 --ondisk=$ROOTDRIVE
> part swap --size=2000 --asprimary --ondisk=$ROOTDRIVE
> part /usr/vice/cache --fstype ext3 --size=1500 --ondisk=$ROOTDRIVE
> part /home --fstype ext3 --size=100 --grow --ondisk=$ROOTDRIVE
> part / --fstype ext3 --size=20000 --grow --maxsize=30000 --asprimary
> --ondisk=$ROOTDRIVE
> EOF
>
> ========
> The script in %pre avoids removable drives such as USB.
>
> I hope that helps.
>
> Jason
>
> Hajducko, Steven wrote:
> >
> > Hi,
> >
> > So we're running into a strange issue where a kickstart from a
> > USB/CDROM combo on an HP DL385 G5 system is actually installing and
> > reformatting the USB stick.
> >
> > We place the kickstart file on the USB drive, drop in a RHEL5 DVD and
> > run:
> >
> > linux ks=hd:sda1:/hostname.cfg
> >
> > The installation goes fine and our packages are installed, but upon
> > reboot and examining the USB stick, it has been reformatted to ext3 FS
> > and contains :
> >
> > stha3155@ghost:/media/usb$ ls
> > config-2.6.18-8.el5  grub  initrd-2.6.18-8.el5.img  lost+found
> > symvers-2.6.18-8.el5.gz  System.map-2.6.18-8.el5  vmlinuz-2.6.18-8.el5
> >
> > Upon reboot of the system, it crashes with a bunch of OPCODE errors.
> >
> > The relevant part of our kickstart looks like this ( we don't do
> > anything tricky in our packages or post install, just touch a few
> > config files.. )
> >
> > install
> > cdrom
> > lang en_US
> > langsupport --default=en_US en_US
> > keyboard us
> > skipx
> > text
> > ignoredisk --drives=sda1,sdb1,sdc1
> > network --device eth0 --bootproto static --ip 192.168.27.17 --netmask
> > 255.255.255.0 --hostname hostname.domain.com
> > network --device eth1 --onboot no
> > rootpw --iscrypted #####
> > firewall --disabled
> > authconfig --enableshadow --enablemd5
> > timezone America/Los_Angeles
> > selinux --disabled
> > zerombr yes
> > bootloader --location=mbr --append="rhgb quiet"
> > reboot
> > clearpart --all
> > part /boot --fstype ext3 --size=128 --asprimary
> > part swap --size=6912 --asprimary
> > part pv.01 --size=100 --grow
> > volgroup rootvg pv.01
> > logvol / --fstype ext3 --vgname=rootvg --size=512 --name=rootlv
> > logvol /tmp --fstype ext3 --vgname=rootvg --size=1024 --name=tmplv
> > logvol /var --fstype ext3 --vgname=rootvg --size=1024 --name=varlv
> > logvol /opt --fstype ext3 --vgname=rootvg --size=2048 --name=optlv
> > logvol /home --fstype ext3 --vgname=rootvg --size=2048 --name=homelv
> > logvol /usr --fstype ext3 --vgname=rootvg --size=2048 --name=usrlv
> > logvol /usr/local --fstype ext3 --vgname=rootvg --size=2048
> > --name=locallv
> >
> > %packages
> >
> > Tried putting the 'ignoredisk' option in order to ignore the sda1 disk
> > that the USB shows up as, but no luck.  As a side note, the disks on
> > the HP show up as /dev/cciss/c0d0.
> >
> > Any input would be appreciated.
> >
> > Thanks.
> >
> > --
> > sh
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > Kickstart-list mailing list
> > Kickstart-list@xxxxxxxxxx
> > https://www.redhat.com/mailman/listinfo/kickstart-list
>
> _______________________________________________
> Kickstart-list mailing list
> Kickstart-list@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/kickstart-list
>

_______________________________________________
Kickstart-list mailing list
Kickstart-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/kickstart-list

[Index of Archives]     [Red Hat General]     [CentOS Users]     [Fedora Users]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux