When you have specified the variable partitionfile
that points to a script, then the script does not work well if it has variables; i.e. the script below will not work. The whole point of doing this is so that the partitions are in order. If you include the partitions and lat anaconda build the partitions, then the partion numbers will not be identical in the raid
# cat /proc/mdstat Personalities : [raid6] [raid5] [raid4] [raid1] md0 : active raid1 sdd2[3](S) sdh2[7](S) sdb2[1] sdg2[6](S) sde2[4](S) sdf2[5](S) sda3[0] sdc2[2](S) 524224 blocks super 1.0 [2/2] [UU] md1 : active raid5 sda2[0] sdd1[3] sdb1[1] sde1[4] sdg1[8] sdc1[2] sdf1[5] sdh1[7](S) 314373120 blocks super 1.1 level 5, 512k chunk, algorithm 2 [7/6] [UUUUUU_] [=======>.............] recovery = 38.7% (20320760/52395520) finish=11.0min speed=48478K/sec bitmap: 0/1 pages [0KB], 65536KB chunk unused devices: <none> </none>
This is a bug, and problem with anaconda, and a pre script is required in order to get the ordering right. in the above example for /dev/md0
I have once disk in the 3rd partition, and the rest are partition 2. In /dev/md1
, I have 1 in partition 2
#!/bin/bash partfile=/tmp/partitionfile disks="sda sdb sdc sdd sde sdf sdg sdh" i=0 rm -rf ${partfile} touch ${partfile} for disk in `echo ${disks}` do efipart=${i} [[ ${i} -eq 0 ]] && efipart="" parted -s /dev/${disk} mkpart primary vfat 0 102 parted -s /dev/${disk} mkpart primary vfat 102 614 parted -s /dev/${disk} set 2 raid on parted -s /dev/${disk} mkpart primary vfat 614 51814 parted -s /dev/${disk} set 3 raid on cat >> ${partfile} << EOF part /boot/efi${efipart} --size=1 --grow --fstype=vfat --ondisk=${disk}1 part raid.0${i} --size=1 --grow --ondisk=${disk}2 part raid.1${i} --size=1 --grow --ondisk=${disk}3 EOF (( i++ )) done cat >> ${partfile} << EOF raid /boot --fstype=ext4 --device=md0 --level=1 --spares=6 raid.00 raid.01 raid.02 raid.03 raid.04 raid.05 raid.06 raid.07 raid pv.1 --fstype=ext4 --device=md1 --level=5 --spares=1 raid.10 raid.11 raid.12 raid.13 raid.14 raid.15 raid.16 raid.17 volgroup system --pesize=4096 pv.1 logvol / --name=root --vgname=system --size=20480 --fstype=ext4 logvol swap --name=swap --vgname=system --size=8192 logvol /var --name=var --vgname=system --size=40960 --fstype=ext4 EOF
Maybe worth trying wget of the script instead of concatenating the script. I am going to try a few things in the next few days to see how best to resolve the problem
The following commit for me resolves the problem, but this may cause other unexpected issues for someone else
https://gitlab.arif-ali.co.uk/arif/xcat-core/commit/2209e419cf9732308e97d6d10b320d491ee1ea0a
Also
was also required
If we keep the code as is, then we need a lot escape characters to escape the $ in variables, and that is not good way to expect people to write scripts
Guang Cheng could you review the problem and assign. Thanks
Yang Song, could you work on this bug? thanks.
any update in this one please?
thanks
hi Arif,
Sorry for late response.
I think 1 more "wget" might increase the complexity of the installation process and the network load of the MN.
"echo 'single quoted script string' > script file" will prevent the escape character problem.
I have checked the code into 2.8.4 and 2.9:
commit a8c10fa1990f2c7316d11cb00caf34649b51e3ea
Author: immarvin yangsbj@cn.ibm.com
Date: Wed Apr 30 07:21:58 2014 -0700
diff --git a/xCAT-server/lib/perl/xCAT/Template.pm b/xCAT-server/lib/perl/xCAT/Template.pm
index 6ba3aea..82dc54c 100644
--- a/xCAT-server/lib/perl/xCAT/Template.pm
+++ b/xCAT-server/lib/perl/xCAT/Template.pm
@@ -280,7 +280,9 @@ sub subvars {
my $tempstr = "%include /tmp/partitionfile\n";
$inc =~ s/#XCAT_PARTITION_START#[\s\S]#XCAT_PARTITION_END#/$tempstr/;
#modify the content in the file, and write into %pre part
- $partcontent = "cat > /tmp/partscript << EOFEOF\n" . $partcontent . "\nEOFEOF\n";
+ #$partcontent = "cat > /tmp/partscript << EOFEOF\n" . $partcontent . "\nEOFEOF\n";
+ $partcontent = "echo " . "'". $partcontent . "'" . ">/tmp/partscript\n";
+
$partcontent .= "chmod 755 /tmp/partscript\n";
$partcontent .= "/tmp/partscript\n";
#replace the #XCA_PARTITION_SCRIPT#
@@ -290,7 +292,8 @@ sub subvars {
elsif ($inc =~ //){
my $tempstr = "<drive><device>XCATPARTITIONTEMP</device></drive>";
$inc =~ s/[\s\S]/$tempstr/;
- $partcontent = "cat > /tmp/partscript << EOFEOF\n" . $partcontent . "\nEOFEOF\n";
+ #$partcontent = "cat > /tmp/partscript << EOFEOF\n" . $partcontent . "\nEOFEOF\n";
+ $partcontent = "echo " . "'". $partcontent . "'" . ">/tmp/partscript\n";
$partcontent .= "chmod 755 /tmp/partscript\n";
$partcontent .= "/tmp/partscript\n";
$inc =~ s/#XCA_PARTITION_SCRIPT#/$partcontent/;
commit e0d5594d67ddfa084a48a9a9433ed42bc5fd1df5
Author: immarvin yangsbj@cn.ibm.com
Date: Wed Apr 30 07:21:58 2014 -0700
diff --git a/xCAT-server/lib/perl/xCAT/Template.pm b/xCAT-server/lib/perl/xCAT/Template.pm
index 5929418..7e03dff 100644
--- a/xCAT-server/lib/perl/xCAT/Template.pm
+++ b/xCAT-server/lib/perl/xCAT/Template.pm
@@ -281,7 +281,9 @@ sub subvars {
my $tempstr = "%include /tmp/partitionfile\n";
$inc =~ s/#XCAT_PARTITION_START#[\s\S]#XCAT_PARTITION_END#/$tempstr/;
#modify the content in the file, and write into %pre part
- $partcontent = "cat > /tmp/partscript << EOFEOF\n" . $partcontent . "\nEOFEOF\n";
+ #$partcontent = "cat > /tmp/partscript << EOFEOF\n" . $partcontent . "\nEOFEOF\n";
+ $partcontent = "echo " . "'". $partcontent . "'" . ">/tmp/partscript\n";
+
$partcontent .= "chmod 755 /tmp/partscript\n";
$partcontent .= "/tmp/partscript\n";
#replace the #XCA_PARTITION_SCRIPT#
@@ -291,7 +293,8 @@ sub subvars {
elsif ($inc =~ //){
my $tempstr = "<drive><device>XCATPARTITIONTEMP</device></drive>";
$inc =~ s/[\s\S]/$tempstr/;
- $partcontent = "cat > /tmp/partscript << EOFEOF\n" . $partcontent . "\nEOFEOF\n";
+ #$partcontent = "cat > /tmp/partscript << EOFEOF\n" . $partcontent . "\nEOFEOF\n";
+ $partcontent = "echo " . "'". $partcontent . "'" . ">/tmp/partscript\n";
$partcontent .= "chmod 755 /tmp/partscript\n";
$partcontent .= "/tmp/partscript\n";
$inc =~ s/#XCA_PARTITION_SCRIPT#/$partcontent/;