-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possible off-by-one error in %VG notation in lvmtools #9
Comments
Hi Here is what's going on there - from 'man lvcreate' -lXX%VG specifier is formulated this way: 'the size defines an upper limit for the number of logical extents' Which mean - the size is calculated as 1% and then is rounded-down to nearest extent and gives you 'AT MOST' the specified size - so lvcreate gives you 571 extents. The story however is different with 'lvextend' - where you want to 'extend' LV - so rounding-down could be leading to actually getting 'smaller' sized value - so the rounding here must go UP. Perhaps when adding extra 'complexity' it would be possible to check that lvextend does not reduce the size and it could be seen as 'zero' operation if it's rounding issue - but that would require couple specific math operation for very specific case which by definition of sizes defined with % modifier is very fuzzy on its own as you can get differently rounded result with every invocation of the command actually. Biggest issue would be that lvresize -lXX%VG would behave differently from lvextend -lXX%VG - so IMHO we should preserve current logic - which might look in this particular case somewhat mysterious - but provides more consistent results overall. I'd probably recommend to use exact extent sizes defined instead of relying on %VG - you may get very varying results. Hopefully this explains what's going on there. |
I spotted a curious behavior when using lvcreate/lvextend:
To me it seems that it should be calculated to the same absolute number of extents in both tools
In my limited testing it was always extended by one extent, no matter which size i used
The text was updated successfully, but these errors were encountered: