list-harddrives macro

Greg Chavez greg.chavez at gmail.com
Fri Jul 8 21:52:37 UTC 2011


[Edited some misstatements with regard to the RAID and which volume
groups get assigned]

With great success, I've used variations on the partition_select
snippet to create some very intelligent partitioning for different
profiles.  However, I occasionally come across a scenario whereby my
Dell servers end up with the partitions reversed. For example, most of
our PERC RAID cards are setup like this:

Virtual Disk #0: 2 73G drives, RAID 1 (OS disk)
Virtual Disk #1: 6 300G drives, RAID 5 (data disk)

Generally, VD-0 gets read by anaconda as sda, and VD-1 as sdb.  And in
fact, even on the messed up servers this works:

Disk /dev/sda: 72.7 GB, 72746008576 bytes
Disk /dev/sdb: 1497.2 GB, 1497198755840 bytes

But somehow, despite this snippet code (my simplest scenario):

=============================
set \$(list-harddrives)
let numd=\$#/2
d1=\$1
d2=\$3

cat << EOF > /tmp/partinfo
part /boot --fstype ext3 --size 200 --ondisk=\$d1 --asprimary
part swap --recommended --ondisk=\$d1 --asprimary
part pv.root --size=1024 --grow --ondisk=\$d1
part pv.srv --size=1024 --grow --ondisk=\$d2
volgroup vg00 pv.root
volgroup vg01 pv.srv
logvol / --fstype ext3 --size=1024 --vgname=vg00 --name=root --grow
logvol /srv --fstype ext3 --size=1024 --vgname=vg01 --name=srv --grow
EOF
=============================

The pv.root gets assigned to volume group vg01, and pv.srv gets assigned
to volume group 00, the opposite of what I want, and I get this:

[root at io-kvm-16 ~]# pvs
 PV         VG   Fmt  Attr PSize  PFree
 /dev/sda2  vg01 lvm2 a-   67.53g    0
 /dev/sdb2  vg00 lvm2 a-    1.34t    0

AND

[root at io-kvm-16 ~]# df -h / /srv
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg00-root
                     1.4T  1.8G  1.3T   1% /
/dev/mapper/vg01-srv   67G  180M   63G   1% /srv

Argh!  My suspicion is that the list-harddrives macros is spitting out
the devices names in reverse, such that $d1 gets sdb and $d2 gets sda.

Does anybody know where the list-harddrives macro comes from?  Is it
an anaconda thing?  How does it work?  I realize that this is not
really a Cobbler issue, but maybe some of you who use this snippet
know more about my situation in general and this macro in particular?
Any help you guys can give me would be much appreciated, even if it's
just pointing me to another mailing list.

--
--Greg Chavez
--


More information about the cobbler mailing list