Re: Setting physical extent size for LVM in ks.cfg

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Once upon a time, Martinez, Carlos R <Carlos.R.Martinez@xxxxxxxxxx> said:
> I also seen some other posts about this problem and it looks like an
> anaconda limitation with LVM.  Looks like someone has been able to configure
> this size in the %pre section?  I've tried several things with no success.

anaconda _almost_ has all the necessary code for setting the physical
extent size.  The code is there and the setting is passed around,
however the value is hard coded to 4096 and can't be set from the ks.cfg
file.

Here's my %pre hack for adding stripe options to lvcreate by bind
mounting a script over the executable:

########################################################################
cp /usr/sbin/lvcreate /tmp/lvcreate.bin
cat > /tmp/lvcreate <<EOF
#!/bin/sh
exec /tmp/lvcreate.bin -i 2 -I 512 \$@
EOF
chmod +x /tmp/lvcreate
mount /tmp/lvcreate /usr/sbin/lvcreate -o bind
########################################################################

Now, you'd need to wrap vgcreate instead of lvcreate, and since anaconda
already passes the "-s" option, you'll need to have a script that checks
the options and changes the "-s" option to your desired setting.
Something like (untested!):

########################################################################
cp /usr/sbin/vgcreate /tmp/vgcreate.bin
cat > /tmp/vgcreate <<EOF
#!/bin/sh
pvsize=16M
opts=""
got_s=0
for opt in \$@; do
	if [ \$got_s = 1 ]; then
		opt=\$pvsize
		got_s=2
	fi
	case \$opt in
	    -s*)
		if [ \$opt = -s ]; then
			got_s=1
		else
			opt=-s\$pvsize
			got_s=2
		fi
		;;
	esac
	opts="\$opts \$opt"
done
if [ \$got_s = 0 ]; then
	opts="-s \$pvsize \$opts"
fi
exec /tmp/vgcreate.bin \$opts
EOF
chmod +x /tmp/vgcreate
mount /tmp/vgcreate /usr/sbin/vgcreate -o bind
########################################################################

This should handle any case of "-s4096", "-s 4096", or no -s option at
all.  Put that whole chunk in your ks.cfg and just change the
"pvsize=16M" line to your desired size.

Let me know if it works! :-)
-- 
Chris Adams <cmadams@xxxxxxxxxx>
Systems and Network Administrator - HiWAAY Internet Services
I don't speak for anybody but myself - that's enough trouble.




[Index of Archives]     [Red Hat General]     [CentOS Users]     [Fedora Users]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux