On 20/02/12 22:59, Lars Ellenberg wrote: >> Or does someone want to implement this together with me? > > I would certainly be here for discussions. > > Though, as you always will be more flexible with scripts than with > pre-implemented fixed algorithms, I probably would first check if I can > solve it with some scripting. > [completely untested, but you get the idea] > > #!/bin/bash > export LANG=C LC_ALL=C > name=$1 vg=$2 size_in_MiB=$3 > PVS=$(vgs --nohead --unit m -o pv_name,pv_free -O -pv_free,pv_name $vg | > awk -v need=$size_in_MiB '{ print $1; sum += $2; > if (sum >= need) exit; }') > lvcreate -n $name -L ${size_in_MiB}m $vg $PVS > > (similar for lvextend) > > Which basically implements this allocation policy: > use the pvs with most free space available, > and no more than necessary. > > If I understand you correctly, that would almost do what you asked for. Yes, this really helps. I've also thought about allocating the LVs directly to distinct PVs. Thanks for the confirmation. > You can get pretty complex in similar scripts, if you really want to... > consider using > pvs -o vg_name,lv_name,pv_name,pvseg_start,pvseg_size,seg_pe_ranges > and explicitly listing not only the PVS, but even the PE ranges to your > lvcreate commands... Thank you very much for your response. Regards, Sebastian _______________________________________________ linux-lvm mailing list linux-lvm@redhat.com https://www.redhat.com/mailman/listinfo/linux-lvm read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/