How to keep a pre-install script partition scheme?
Hi, Our requirement for partitioning is not covered by autoyast (IMHO) so I've had to use a pre-install script that uses sfdisk to create what we want - create / as a primary partition, an extended partition with swap and the rest of the disk as another partition (later to be mounted as /scratch for obvious reasons), but not all of the HDDs we have can take a / partition of 10GB so sometimes we need not to create a 3rd partition and to reduce the size of /. I've added the script that does this to end of this email. Unfortunately this does not work. I am assuming I have messed up my partition XML - can you help? I am now going to try using the "Auto-detection of partitions to be kept" method while I wait for a reply. partitions before install (using exec /bin/bash -x so that I get an interactive prompt to be able to check that the pre-install script has worked): Disk /dev/hda: 9729 cylinders, 255 heads, 63 sectors/track Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0 Device Boot Start End #cyls #blocks Id System /dev/hda1 0+ 1305 1306- 10490413+ 83 Linux /dev/hda2 1306 9728 8423 67657747+ 5 Extended /dev/hda3 0 - 0 0 0 Empty /dev/hda4 0 - 0 0 0 Empty /dev/hda5 1306+ 1434 129- 1036161 82 Linux swap /dev/hda6 1435+ 9728 8294- 66621523+ 83 Linux partitions after install: Disk /dev/hda: 9729 cylinders, 255 heads, 63 sectors/track Warning: extended partition does not start at a cylinder boundary. DOS and Linux will interpret the contents differently. Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0 Device Boot Start End #cyls #blocks Id System /dev/hda1 0+ 1305 1306- 10490413+ 5 Extended /dev/hda2 1306 9728 8423 67657747+ 5 Extended /dev/hda3 0 - 0 0 0 Empty /dev/hda4 0 - 0 0 0 Empty /dev/hda5 1306+ 1434 129- 1036161 82 Linux swap /dev/hda6 1435+ 9728 8294- 66621523+ 83 Linux which is a bit of a mess so no wonder the installatin cannot succeed.
From reading: http://www.suse.de/~nashif/autoinstall/9.1/html/CreateProfile.Partitioning.h... I thought I had understood the XML I needed to use to be:
<partitioning config:type="list"> <drive> <device>/dev/hda</device> <partitions config:type="list"> <partition> <create config:type="boolean">false</create> <filesystem config:type="symbol">ext3</filesystem> <format config:type="boolean">true</format> <mount>/</mount> <partition_nr config:type="integer">1</partition_nr> </partition> <partition> <create config:type="boolean">false</create> <filesystem config:type="symbol">swap</filesystem> <format config:type="boolean">true</format> <mount>swap</mount> <partition_nr config:type="integer">5</partition_nr> </partition> </partitions> </drive> </partitioning> The XML pre_install script: <source><![CDATA[ #!/bin/sh wget http://XXXX/~install/suse9.1/pre_install_suse91.sh wget http://XXXX/~install/suse9.1/sfdisk chmod +x sfdisk chmod +x pre_install_suse91.sh ./pre_install_suse91.sh # exec /bin/bash -x ]]></source> pre_install_suse91.sh: #!/bin/sh -x # setup detault route to install server route add -net XXXXX netmask 255.255.255.0 dev eth0 # Now partition the disk SFDISK=./sfdisk mknod /tmp/hda b 3 0 CREATETEMP=false $SFDISK --no-reread -V /tmp/hda if $SFDISK --no-reread -V -q /tmp/hda; then DOPARTITION=false else DOPARTITION=true DISKSIZE=$((`$SFDISK --no-reread -s /tmp/hda` / 1024 )) # assume 1k blocks echo $DISKSIZE MEMSIZE=`cat /proc/meminfo | grep "MemTotal:" | cut -d":" -f2 | cut -d"k" -f1` echo $MEMSIZE if [ $(($MEMSIZE / 1024 )) -gt 128 ]; then SWAPSIZE=$(($MEMSIZE / 1024)) else SWAPSIZE=128 fi ROOTSIZE=$(($DISKSIZE - $SWAPSIZE)) # disk - swap if [ $ROOTSIZE -gt 10240 ]; then # 10GB in MB CREATETEMP=true ROOTSIZE=10240 TEMPSIZE=$(($DISKSIZE - $ROOTSIZE)) fi # if we always put swap in an extended partition, we can # guarantee: # # / is /dev/hda1 # swap is /dev/hda5 # /scratch is /dev/hda6 # and all is well and happy throughout the land ... echo $ROOTSIZE $SWAPSIZE $CREATETEMP fi if $DOPARTITION; then echo "past DOPARTITION" if $CREATETEMP; then # we're lurching into a different partitioning echo "createtemp" $SFDISK --no-reread -D -uM /tmp/hda <<EOF ,$ROOTSIZE ,,E , , ,$SWAPSIZE,S ,,L EOF else # we must have no /temp. echo "notemp" $SFDISK --no-reread -D -uM /tmp/hda <<EOF ,$ROOTSIZE ,,E , , ,,S EOF fi fi cheers, Mike Rose
Hi, You cant combine sfdisk with autoyast partitioning or at least it is very difficultand to accomplish what you want. If you are using a recent release, you can use rules to detect the type of the harddisk you are using and have different partitioning schemes for the various disks depending on the size of the disks. Anas Mike Rose wrote:
Hi,
Our requirement for partitioning is not covered by autoyast (IMHO) so I've had to use a pre-install script that uses sfdisk to create what we want - create / as a primary partition, an extended partition with swap and the rest of the disk as another partition (later to be mounted as /scratch for obvious reasons), but not all of the HDDs we have can take a / partition of 10GB so sometimes we need not to create a 3rd partition and to reduce the size of /. I've added the script that does this to end of this email.
Unfortunately this does not work. I am assuming I have messed up my partition XML - can you help?
I am now going to try using the "Auto-detection of partitions to be kept" method while I wait for a reply.
partitions before install (using exec /bin/bash -x so that I get an interactive prompt to be able to check that the pre-install script has worked):
Disk /dev/hda: 9729 cylinders, 255 heads, 63 sectors/track Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0
Device Boot Start End #cyls #blocks Id System /dev/hda1 0+ 1305 1306- 10490413+ 83 Linux /dev/hda2 1306 9728 8423 67657747+ 5 Extended /dev/hda3 0 - 0 0 0 Empty /dev/hda4 0 - 0 0 0 Empty /dev/hda5 1306+ 1434 129- 1036161 82 Linux swap /dev/hda6 1435+ 9728 8294- 66621523+ 83 Linux
partitions after install:
Disk /dev/hda: 9729 cylinders, 255 heads, 63 sectors/track Warning: extended partition does not start at a cylinder boundary. DOS and Linux will interpret the contents differently. Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0
Device Boot Start End #cyls #blocks Id System /dev/hda1 0+ 1305 1306- 10490413+ 5 Extended /dev/hda2 1306 9728 8423 67657747+ 5 Extended /dev/hda3 0 - 0 0 0 Empty /dev/hda4 0 - 0 0 0 Empty /dev/hda5 1306+ 1434 129- 1036161 82 Linux swap /dev/hda6 1435+ 9728 8294- 66621523+ 83 Linux
which is a bit of a mess so no wonder the installatin cannot succeed.
From reading: http://www.suse.de/~nashif/autoinstall/9.1/html/CreateProfile.Partitioning.h... I thought I had understood the XML I needed to use to be:
<partitioning config:type="list"> <drive> <device>/dev/hda</device> <partitions config:type="list"> <partition> <create config:type="boolean">false</create> <filesystem config:type="symbol">ext3</filesystem> <format config:type="boolean">true</format> <mount>/</mount> <partition_nr config:type="integer">1</partition_nr> </partition> <partition> <create config:type="boolean">false</create> <filesystem config:type="symbol">swap</filesystem> <format config:type="boolean">true</format> <mount>swap</mount> <partition_nr config:type="integer">5</partition_nr> </partition> </partitions> </drive> </partitioning>
The XML pre_install script: <source><![CDATA[ #!/bin/sh wget http://XXXX/~install/suse9.1/pre_install_suse91.sh wget http://XXXX/~install/suse9.1/sfdisk chmod +x sfdisk chmod +x pre_install_suse91.sh ./pre_install_suse91.sh # exec /bin/bash -x ]]></source>
pre_install_suse91.sh:
#!/bin/sh -x # setup detault route to install server route add -net XXXXX netmask 255.255.255.0 dev eth0
# Now partition the disk SFDISK=./sfdisk mknod /tmp/hda b 3 0 CREATETEMP=false
$SFDISK --no-reread -V /tmp/hda if $SFDISK --no-reread -V -q /tmp/hda; then DOPARTITION=false else DOPARTITION=true DISKSIZE=$((`$SFDISK --no-reread -s /tmp/hda` / 1024 )) # assume 1k blocks echo $DISKSIZE MEMSIZE=`cat /proc/meminfo | grep "MemTotal:" | cut -d":" -f2 | cut -d"k" -f1` echo $MEMSIZE if [ $(($MEMSIZE / 1024 )) -gt 128 ]; then SWAPSIZE=$(($MEMSIZE / 1024)) else SWAPSIZE=128 fi ROOTSIZE=$(($DISKSIZE - $SWAPSIZE)) # disk - swap if [ $ROOTSIZE -gt 10240 ]; then # 10GB in MB CREATETEMP=true ROOTSIZE=10240 TEMPSIZE=$(($DISKSIZE - $ROOTSIZE)) fi # if we always put swap in an extended partition, we can # guarantee: # # / is /dev/hda1 # swap is /dev/hda5 # /scratch is /dev/hda6 # and all is well and happy throughout the land ... echo $ROOTSIZE $SWAPSIZE $CREATETEMP fi if $DOPARTITION; then echo "past DOPARTITION" if $CREATETEMP; then # we're lurching into a different partitioning echo "createtemp" $SFDISK --no-reread -D -uM /tmp/hda <<EOF ,$ROOTSIZE ,,E , , ,$SWAPSIZE,S ,,L EOF else # we must have no /temp. echo "notemp" $SFDISK --no-reread -D -uM /tmp/hda <<EOF ,$ROOTSIZE ,,E , , ,,S EOF fi fi
cheers,
Mike Rose
Hi Anas, Thank you for replying so quickly. Unfortunately I was expecting your answer. my most recent attempt was to force a reboot of the computer (system call) when my script partitions the disk so that (I hoped) the computer would then net boot a second time, a valid partition table would exist and things would be OK. Unfortunately that does not work as a valid partition table (without a bootable flag) is still viewed as bootable by the PC - darn. I will now try the rules based install - thanks for the suggestion. I hope you will document that the pre-install script is not a true pre-install script as insatllation decisions have already been made by autoyast about the installation it will perform before the pre-install script has beene executed. Interestingly Redhat kickstart does allow one to mess around with the partition table in a pre-install script. OK, I've now tried the rules based install and I cannot get it to work: The control file: default linux label linux kernel linux append load_ramdisk=1 initrd=initrd autoyast=nfs://172.24.25.29/install/suse9.1/autoyast/ install=nfs://1 72.24.25.29/install/suse9.1/Suse/ textmode=1 The rules directory as specified by http://www.suse.de/~nashif/autoinstall/9.1/html/rulesandclass.html : -bash-2.05b# pwd /install/suse9.1/autoyast/rules -bash-2.05b# ls -l total 24 -rw-r--r-- 1 root root 6605 Jun 17 15:48 ay_create_partitions.xml -rw-r--r-- 1 root root 1690 Jun 17 15:32 ay_make_part -rw-r--r-- 1 root root 5801 Jun 17 15:29 ay_partitioned.xml -rw-r--r-- 1 root root 776 Jun 17 15:42 rules.xml The rules file is being read by something (ls -lu tells me) when the install is attempted, but I am told that no valid control file is found. Maybe my rules.xml is at fault: <?xml version="1.0"?> <!DOCTYPE autoinstall SYSTEM "/usr/share/autoinstall/dtd/rules.dtd"> <autoinstall xmlns="http://www.suse.com/1.0/yast2ns" xmlns:config="http://www.suse.com/1.0/configns"> <rules config:type="list"> <rule> <linux> <match>0</match> <match_type>greater</match_type> </linux> <result> <profile>ay_partitioned.xml</profile> <continue config:type="boolean">false</continue> </result> <linux> <match>0</match> <match_type>exact</match_type> </linux> <result> <profile>ay_create_partitions.xml</profile> <continue config:type="boolean">false</continue> </result> </rule> </rules> </autoinstall> The HDD on the destination computer does have a valid partition table so the first rule should be picked up whereby there are more than 0 linux partitions, I think. I've taken a guess at the match type for the other situation where no partitions are defined "exact" although I cannot see a complete list of defined match types in the documentation (unfortunately), but this should not matter as I want it to pick up the other one anyway. cheers, Mike Rose On Wed, 16 Jun 2004, Anas Nashif wrote:
Hi, You cant combine sfdisk with autoyast partitioning or at least it is very difficultand to accomplish what you want. If you are using a recent release, you can use rules to detect the type of the harddisk you are using and have different partitioning schemes for the various disks depending on the size of the disks.
participants (2)
-
Anas Nashif
-
Mike Rose