On Dec 6, 2007, at 3:02 PM, Peter Åstrand wrote:
On Mon, 26 Nov 2007, Peter Åstrand wrote:
...
"Could not allocate requested partitions". If we are using:
zerombr
clearpart --all --initlabel
partition / --fstype ext3 --size=1600 --asprimary
partition swap --recommended
...things works great, but then there's no confirmation.
I've discovered one major problem: When booting from a USB stick with
diskboot.img, a kickstart file like this erases the USB stick! How can
this be prevented? It seems like it's fairly reliable that the first
disk
is normally sda, but if booting from USB stick, sda is the stick. I
guess
we need to use "ignoredisk" on the USB stick or something like that,
but I
cannot find any obvious solution.
If you know it will always be sda, you can do:
ignoredisk --drives=sda
If you don't know for sure that it will always be sda, you can build
an ignoredisk line from %pre. This is the code I use to ignore the
usb stick regardless of where it shows up...
# This part goes in the main body of ks.cfg, I use it for several
# different configuration things built by my %pre scripts
%include /tmp/generated-configuration
%pre
# This %pre just makes sure the file exists, so the include
# never fails
touch /tmp/generated-configuration
%pre --interpreter=python
# This is a generic %pre script that creates a file named
# /tmp/disks with the device name and the size of the disk in MB
# You can use this for all kinds of stuff
import os
import sys
import parted
sys.path.append('/usr/lib/anaconda')
import isys
drives = isys.hardDriveDict().keys()
drives.sort()
f = open( "/tmp/disks", "w" )
for drive in drives:
device = "/tmp/" + drive
if not os.access(device, os.O_RDONLY):
try:
isys.makeDevInode(drive, device)
except:
continue
dev = parted.PedDevice.get(device)
mb = (float(dev.heads * dev.cylinders * dev.sectors) / (1024 *
1024) * dev.sector_size)
dev.close()
f.write( "%s %s\n" % ( drive, mb ) )
%pre
# This one looks for disks smaller than a given size, and if any are
found, ignores them
TINY=`awk 'BEGIN { ORS="," } $2 < 2000 { print $1 }' /tmp/disks | sed
's/,$//'`
if [ -n "$TINY" ]; then
echo "ignoredisk --drives=$TINY" >> /tmp/generated-configuration
fi
--
Jason Kohles, RHCA RHCDS RHCE
email@xxxxxxxxxxxxxxx - http://www.jasonkohles.com/
"A witty saying proves nothing." -- Voltaire
_______________________________________________
Kickstart-list mailing list
Kickstart-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/kickstart-list