Bug 1383817

Summary: --percent option in kickstart does not properly utilize the available free space
Product: Red Hat Enterprise Linux 6 Reporter: jcastran
Component: anacondaAssignee: David Lehman <dlehman>
Status: CLOSED ERRATA QA Contact: Release Test Team <release-test-team-automation>
Severity: high Docs Contact:
Priority: high    
Version: 6.7CC: dlehman, gintaras.satkunas, jcastran, jstodola, mhruscak, pchavan, rvykydal, sbueno
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: anaconda-13.21.256-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-03-21 11:09:39 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description jcastran 2016-10-11 20:50:59 UTC
Description of problem:
Using the "logvol" command in kickstart, with "--grow" and "--percent" does not utilize a large portion of the free space in the volume group.

Example:
logvol /              --fstype ext4 --name rootfs  --vgname=vg_sys --size 250 --grow --percent=20

RHEL 6.6  "vgs"
  vg_sys   1   8   0 wz--n- 31.97g 320.00m

          "lvs"
  rootfs vg_sys -wi-ao----  5.62g                                                    


RHEL 6.7+ "vgs"
  vg_sys   1   8   0 wz--n- 31.97g 9.25g

          "lvs"
  rootfs vg_sys -wi-ao----   4.00g                                                    



Version-Release number of selected component (if applicable):
   RHEL 6.7+

How reproducible:
   Customer experiences this every time

Actual results:
   RHEL 6.7+ leaves 9.25G free on a 31.97G Volume Group

Expected results:
   --percent properly divides the free space in the VG and the VG consumes the free space on the drive

Additional info:
Below is our kickstart partitioning snippet:

part /boot --asprimary --fstype ext4 --label boot --size=500
part pv.01 --size 32768 
volgroup vg_sys --pesize=32768 pv.01
logvol /              --fstype ext4 --name rootfs  --vgname=vg_sys --size 250 --grow --percent=20
logvol /home          --fstype ext4 --name home    --vgname=vg_sys --size 100 --grow --percent=10
logvol /opt           --fstype ext4 --name opt     --vgname=vg_sys --size 1   --grow --percent=10
logvol /tmp           --fstype ext4 --name tmp     --vgname=vg_sys --size 1   --grow --percent=10
logvol /var           --fstype ext4 --name var     --vgname=vg_sys --size 384 --grow --percent=30
logvol /var/log       --fstype ext4 --name log     --vgname=vg_sys --size 1   --grow --percent=10
logvol /var/log/audit --fstype ext4 --name audit   --vgname=vg_sys --size 1   --grow --percent=10
logvol swap           --fstype swap --name swap    --vgname=vg_sys --size 4096

With RHEL 6.6 final partitioning after installation is:

[root@]# vgs
  VG     #PV #LV #SN Attr   VSize  VFree  
  
vg_sys   1   8   0 wz--n- 31.97g 320.00m

[root@]# lvs
  LV     VG     Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
                                                      
  audit  vg_sys -wi-ao----  2.69g                                                    
  home   vg_sys -wi-ao----  2.78g                                                    
  log    vg_sys -wi-ao----  2.69g                                                    
  opt    vg_sys -wi-ao----  2.69g                                                    
  rootfs vg_sys -wi-ao----  5.62g                                                    
  swap   vg_sys -wi-ao----  4.00g                                                    
  tmp    vg_sys -wi-ao----  2.69g                                                    
  var    vg_sys -wi-ao----  8.50g


Starting form RHEL 6.7 (6.8) with the same snippet we get completely different partitioning schema:

[root@]# vgs
  VG     #PV #LV #SN Attr   VSize  VFree

  vg_sys   1   8   0 wz--n- 31.97g 9.25g

[root@]# lvs
  LV     VG     Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
                                                  
  audit  vg_sys -wi-ao---- 992.00m                                                    
  home   vg_sys -wi-ao----   1.59g                                                    
  log    vg_sys -wi-ao----   1.09g                                                    
  opt    vg_sys -wi-ao----   1.34g                                                    
  rootfs vg_sys -wi-ao----   4.00g                                                    
  swap   vg_sys -wi-ao----   4.00g                                                    
  tmp    vg_sys -wi-ao----   1.22g                                                    
  var    vg_sys -wi-ao----   8.50g

Comment 4 David Lehman 2016-10-13 18:35:02 UTC
From the RHEL6 Installation Guide (https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Installation_Guide/s1-kickstart2-options.html):

--percent= — Specify the amount by which to grow the logical volume, as a percentage of the free space in the volume group after any statically-sized logical volumes are taken into account. This option must be used in conjunction with the --size and --grow options for logvol.



The behavior of --percent is different from RHEL7 forward, where it is a mutually-exclusive alternative to --size.

Comment 10 David Lehman 2016-11-03 18:25:44 UTC
My initial assessment was wrong. There is a simple bug in the code.

Comment 11 David Lehman 2016-11-04 18:22:18 UTC
Upstream pull request:

  https://github.com/rhinstaller/anaconda/pull/860

Comment 14 Marek Hruscak 2016-11-30 16:29:00 UTC
Issue is fixed, partitioning using --percent option in ks behave same as before in RHEL-6.6.

Comment 16 errata-xmlrpc 2017-03-21 11:09:39 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2017-0720.html