summaryrefslogtreecommitdiffstats
path: root/tools/lvresize.c
Commit message (Collapse)AuthorAgeFilesLines
* cleanup: Use segtype->ops->name() instead of segtype->name where applicableJonathan Brassow2012-09-051-1/+1
| | | | | | | | When printing a message for the user and the lv_segment pointer is available, use segtype->ops->name() instead of segtype->name. This gives a better user-readable name for the segment. This is especially true for the 'striped' segment type, which prints "linear" if there is an area_count of one.
* config: add silent modeAlasdair G Kergon2012-08-251-20/+20
| | | | | | | | | | | | | | | | Accept -q as the short form of --quiet. Suppress non-essential standard output if -q is given twice. Treat log/silent in lvm.conf as equivalent to -qq. Review all log_print messages and change some to log_print_unless_silent. When silent, the following commands still produce output: dumpconfig, lvdisplay, lvmdiskscan, lvs, pvck, pvdisplay, pvs, version, vgcfgrestore -l, vgdisplay, vgs. [Needs checking.] Non-essential messages are shifted from log level 4 to log level 5 for syslog and lvm2_log_fn purposes.
* RAID: Add support for RAID10Jonathan Brassow2012-08-241-2/+11
| | | | | | This patch adds support for RAID10. It is not the default at this stage. The user needs to specify '--type raid10' if they would like RAID10 instead of stacked mirror over stripe.
* RAID: Fix extending size of RAID 4/5/6 logical volumes.Jonathan Brassow2012-06-261-2/+8
| | | | | | Reducing a RAID 4/5/6 LV or extending it with a different number of stripes is still not implemented. This patch covers the "simple" case where the LV is extended with the same number of stripes as the orginal.
* cleanup: use struct initializers instead of memsetZdenek Kabelac2012-06-201-8/+2
| | | | No need to call memset if we the language can do that.
* Remove 'up' from rounding message that sometimes rounds down.Alasdair Kergon2012-04-121-1/+16
| | | | Detect reduction of 0 after rounding for stripes and avoid warning of potential data loss.
* Fix lvresize for thin poolZdenek Kabelac2012-04-111-8/+4
| | | | | | | When resizing thin pool - we need to use strip info from _tdata volume. In future more generic solution will be necessary once we start to support lvconvert (resize of stacked devices and stay properly aligned). For now we just allow striped or linear LV so this code will work.
* Lvresize rounds upwardZdenek Kabelac2012-04-111-2/+5
| | | | | | | When given lvresize new size - round upward for stripes - unless we use % and we are at the border of free extents. This patch is not a complete fix and few more cases will need special care.
* Move check for min strip sizeZdenek Kabelac2012-04-111-9/+10
| | | | and remove few asigns that are not needed.
* Some more missing supposedly 64bit operations.Zdenek Kabelac2012-03-051-2/+2
| | | | Avoid use 32bit math for extent_size.
* Using enum types for enumsZdenek Kabelac2012-02-281-3/+3
| | | | alloc_policy_t, dm_string_mangling_t, percent_range_t, sign_t
* Set status for error pathZdenek Kabelac2012-02-081-0/+3
| | | | | Do not leave status unitialized, since in some cases, it's tested, when the function returns error.
* Thin updated support for thin pool percentZdenek Kabelac2012-01-191-2/+11
| | | | | Support to check also for metadata percent (By checking whether seg pointer is set)
* Check for error code in _adjust_policy_paramsZdenek Kabelac2012-01-091-1/+2
| | | | If error is detected in _adjust_policy_params, break further command processing.
* Support rounding of percentage upwardZdenek Kabelac2012-01-051-6/+12
| | | | | | | | | | | | | | | We want to keep this logic - when LV is extend - extend the LV by at least given amount, when LV is reduced - reduce the LV by at most given amount. So for this the rounding needs to be used. Current logic which seems to satisfy give rule is to round up all extent values for LV resize upward except for values with '-' sign that are round downward. This patch also fixes the problem when lvextend --use-polices tried to extend LV the by i.e. 20% - but the resulting 20% were smaller the extent size thus before this patch no extension happened.
* Thin automatic policy based extensionZdenek Kabelac2011-12-211-13/+31
|
* Don't allow size change of RAID LV that is tracking changes for a split imageJonathan Earl Brassow2011-12-011-0/+13
| | | | Don't allow size change of RAID sub-LVs independently
* Thin ensure pool table is update after resizeZdenek Kabelac2011-11-081-0/+14
| | | | | | | Always make sure table gets reloaded. For now activate and deactivate pool volume if it's not active. FIXME: we could do this only if we are sure some thin volume is alive.
* Thin revert code for exclusive pool activationZdenek Kabelac2011-11-071-4/+0
| | | | | There are no limits on thin-pool activation now. Revert code that is no longer needed.
* Avoid lvextend to overflowZdenek Kabelac2011-11-041-1/+7
| | | | | Add extra check to extent_count overflow. Use internal define MAX_EXTENT_COUNT instead UINT32_MAX.
* Thin pool resize support for data LVZdenek Kabelac2011-10-281-1/+24
| | | | | | Support for extension of pool data LV. TODO: figure out thin volume for suspend/resume in cluster.
* Allow 'nosync' extension of mirrors.Jonathan Earl Brassow2011-10-061-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch allows a mirror to be extended without an initial resync of the extended portion. It compliments the existing '--nosync' option to lvcreate. This action can be done implicitly if the mirror was created with the '--nosync' option, or explicitly if the '--nosync' option is used when extending the device. Here are the operational criteria: 1) A mirror created with '--nosync' should extend with 'nosync' implicitly [EXAMPLE]# lvs vg; lvextend -L +5G vg/lv ; lvs vg LV VG Attr LSize Pool Origin Snap% Move Log Copy% Convert lv vg Mwi-a-m- 5.00g lv_mlog 100.00 Extending 2 mirror images. Extending logical volume lv to 10.00 GiB Logical volume lv successfully resized LV VG Attr LSize Pool Origin Snap% Move Log Copy% Convert lv vg Mwi-a-m- 10.00g lv_mlog 100.00 2) The 'M' attribute ('M' signifies a mirror created with '--nosync', while 'm' signifies a mirror created w/o '--nosync') must be preserved when extending a mirror created with '--nosync'. See #1 for example of 'M' attribute. 3) A mirror created without '--nosync' should extend with 'nosync' only when '--nosync' is explicitly used when extending. [EXAMPLE]# lvs vg; lvextend -L +5G vg/lv; lvs vg LV VG Attr LSize Pool Origin Snap% Move Log Copy% Convert lv vg mwi-a-m- 20.00m lv_mlog 100.00 Extending 2 mirror images. Extending logical volume lv to 5.02 GiB Logical volume lv successfully resized LV VG Attr LSize Pool Origin Snap% Move Log Copy% Convert lv vg mwi-a-m- 5.02g lv_mlog 0.39 vs. [EXAMPLE]# lvs vg; lvextend -L +5G vg/lv --nosync; lvs vg LV VG Attr LSize Pool Origin Snap% Move Log Copy% Convert lv vg mwi-a-m- 20.00m lv_mlog 100.00 Extending 2 mirror images. Extending logical volume lv to 5.02 GiB Logical volume lv successfully resized LV VG Attr LSize Pool Origin Snap% Move Log Copy% Convert lv vg Mwi-a-m- 5.02g lv_mlog 100.00 4) The 'm' attribute must change to 'M' when extending a mirror created without '--nosync' is extended with the '--nosync' option. (See #3 examples above.) 5) An inactive mirror's sync percent cannot be determined definitively, so it must not be allowed to skip resync. Instead, the extend should ask the user if they want to extend while performing a resync. [EXAMPLE]# lvchange -an vg/lv [EXAMPLE]# lvextend -L +5G vg/lv Extending 2 mirror images. Extending logical volume lv to 10.00 GiB vg/lv is not active. Unable to get sync percent. Do full resync of extended portion of vg/lv? [y/n]: y Logical volume lv successfully resized 6) A mirror that is performing recovery (as opposed to an initial sync) - like after a failure - is not allowed to extend with either an implicit or explicit nosync option. [You can simulate this with a 'corelog' mirror because when it is reactivated, it must be recovered every time.] [EXAMPLE]# lvcreate -m1 -L 5G -n lv vg --nosync --corelog WARNING: New mirror won't be synchronised. Don't read what you didn't write! Logical volume "lv" created [EXAMPLE]# lvs vg LV VG Attr LSize Pool Origin Snap% Move Log Copy% Convert lv vg Mwi-a-m- 5.00g 100.00 [EXAMPLE]# lvchange -an vg/lv; lvchange -ay vg/lv; lvs vg LV VG Attr LSize Pool Origin Snap% Move Log Copy% Convert lv vg Mwi-a-m- 5.00g 0.08 [EXAMPLE]# lvextend -L +5G vg/lv Extending 2 mirror images. Extending logical volume lv to 10.00 GiB vg/lv cannot be extended while it is recovering. 7) If 'no' is selected in #5 or if the condition in #6 is hit, it should not result in the mirror being resized or the 'm/M' attribute being changed. NOTE: A mirror created with '--nosync' behaves differently than one created without it when performing an extension. The former cannot be extended when the mirror is recovering (unless in-active), while the latter can. This is a reasonable thing to do since recovery of a mirror doesn't take long (at least in the case of an on-disk log) and it would cause far more time in degraded mode if the extension w/o '--nosync' was allowed. It might be reasonable to add the ability to force the operation in the future. This should /not/ force a nosync extension, but rather force a sync'ed extension. IOW, the user would be saying, "Yes, yes... I know recovery won't take long and that I'll be adding significantly to the time spent in degraded mode, but I need the extra space right now!".
* Add missing log_error() to lvresize command when fsadm tool failsZdenek Kabelac2011-09-211-3/+3
| | | | Also add test case
* When resizing LVs, always round in the safe direction, regardless of whether wePetr Rockai2011-09-151-1/+2
| | | | were called as lvresize or lvreduce.
* Fix possible overflow of size if %FREE or %VG is used.Milan Broz2011-09-151-6/+6
| | | | https://bugzilla.redhat.com/show_bug.cgi?id=737087
* lvcreate parsing for thin provisioning.Alasdair Kergon2011-09-061-1/+1
| | | | The rest is incomplete so this isn't usable yet.
* Replace free_vg with release_vgZdenek Kabelac2011-08-101-2/+2
| | | | | | | | Move the free_vg() to vg.c and replace free_vg with release_vg and make the _free_vg internal. Patch is needed for sharing VG in vginfo cache so the release_vg function name is a better fit here.
* Fix lvreduce stripe rounding up from previous commit.Milan Broz2011-06-151-2/+4
|
* Fix mirrored stripe reduction.Milan Broz2011-06-091-4/+30
| | | | | | | | | | | | | | | | | | | | | | Patch adds check for stripe not only in direct LV segment but also in mirror image segment. This prevents bugs like: # lvcreate -i2 -l10 -n lv vg_test # lvconvert -m1 -i1 vg_test/lv # lvreduce -f -l1 vg_test/lv WARNING: Reducing active logical volume to 4.00 MiB THIS MAY DESTROY YOUR DATA (filesystem etc.) Reducing logical volume lv to 4.00 MiB Segment extent reduction 9 not divisible by #stripes 2 Logical volume lv successfully resized # lvremove -f vg_test Segment extent reduction 1 not divisible by #stripes 2 LV segment lv:0-4294967295 is incorrectly listed as being used by LV lv_mimage_0 Internal error: LV segments corrupted in lv_mimage_0.
* Fix extent rounding for striped segments.Milan Broz2011-06-091-2/+8
| | | | | | | | | | | | | | | We should never remove more extents than requested by user, so round up to next stripe boundary during lvreduce. Also this fixes round to zero sized LV bug: # lvcreate -i2 -I 64k -l10 -n lvs vg_test # lvreduce -f -l1 vg_test/lvs Rounding size (1 extents) down to stripe boundary size for segment (0 extents) WARNING: Reducing active logical volume to 0 THIS MAY DESTROY YOUR DATA (filesystem etc.) Reducing logical volume lvs to 0 Failed to suspend lvs
* This patch adds the ability to extend 0 length layered LVs. ThisJonathan Earl Brassow2011-04-061-3/+4
| | | | | | | | allows us to allocate all images of a mirror (or RAID array) at one time during create. The current mirror implementation still requires a separate allocation for the log, however.
* Use 64bit unsigned value for maximum stripe size test.Milan Broz2011-03-021-1/+1
| | | | | | | | While STRIPE_SIZE_LIMIT * 2 is basically UINT_MAX, 32bit integer value can already overflow durin arg size parsing. (This really happens in test where --stripesize 4294967291 is used, in s390x uint overflow and this test is ineffective.)
* Add exec_cmd paramater sync_neededZdenek Kabelac2011-01-131-1/+1
| | | | | | As sync_local_dev_names() cannot be called within activation context, add new parametr which allows to select if the sync call is needed before executing new command.
* Rename vg_release to free_vg.Alasdair Kergon2010-12-081-2/+2
|
* Refactor the percent (mirror sync, snapshot usage) handling code to usePetr Rockai2010-11-301-7/+6
| | | | fixed-point values instead of a combination of a float value and an enum.
* Use new status code from fsadm checkZdenek Kabelac2010-11-011-7/+13
| | | | | | | | | | | Patch updates exec_cmd() and adds 3rd parameter with pointer for status value, so caller might examine returned status code. If the passed pointer is NULL, behavior is unmodified. Patch allows to confinue with lvresize if the failure from fsadm check is caused by mounted filesystem as many of filesystem resize tools do support online filesystem resize. (originally user had to use flag '-n' to bypass this filesystem check)
* Implement automatic snapshot extension with dmeventd, and add two new optionsPetr Rockai2010-10-151-25/+71
| | | | | | | | to lvm.conf in the activation section: 'snapshot_autoextend_threshold' and 'snapshot_autoextend_percent', that define how to handle automatic snapshot extension. The former defines when the snapshot should be extended: when its space usage exceeds this many percent. The latter defines how much extra space should be allocated for the snapshot, in percent of its current size.
* Allow internal suspend and resume of origin without its snapshots.Alasdair Kergon2010-08-171-2/+2
|
* Remove no-longer-used arg_ptr_value.Alasdair Kergon2010-04-291-1/+2
| | | | Fix -M and --type to use strings not pointers that change on config refresh.
* Permit mimage LVs to be striped in lvcreate and lvresize.Alasdair Kergon2010-04-091-28/+25
|
* Don't allow resizing of internal logical volumes.Mike Snitzer2010-03-201-0/+5
| | | | | | | Prevent lvresize from being able to resize internal LVs: mirror legs (*_mimage_*), mirror log (*_mlog), snapshot placeholder LVs (snapshot*) and others. Resizing these would leads to unexpected metadata and sometimes crashes (in case of growing snapshot*).
* Add %ORIGIN support to lv{create,extend,reduce,resize} --extents optionMike Snitzer2010-02-031-0/+7
| | | | | | | | | | | Allow the number of logical extents to be expressed (for a snapshot) as a percentage of the total space in the Origin Logical Volume with the suffix %ORIGIN. Update the relevant man pages accordingly. Eliminate inconsistencies between the man pages and tools/commands.h Signed-off-by: Mike Snitzer <snitzer@redhat.com>
* Add missing 'stack;' for all suspend_lv and resume_lv callers.Mike Snitzer2010-01-051-1/+2
| | | | Signed-off-by: Mike Snitzer <snitzer@redhat.com>
* Fix tools to report error when stopped by user.Milan Broz2009-12-031-1/+1
| | | | (And do not produce internal error message.)
* Fix lvcreate processing of %PVS argument.Milan Broz2009-11-041-2/+5
| | | | | | | | | | | - fix missing unlocking of VG lvcreate -l 100%PVS -n lv1 vg_test Please specify physical volume(s) with %PVS Internal error: Volume Group vg_test was not unlocked - if no PVS specified, use all available Fix segfault if %PVS in lvresize without PVs list.
* Tidy some uses of arg_count and introduce arg_is_set.Alasdair Kergon2009-11-031-2/+2
|
* Fix vg_read() error paths to properly release upon vg_read_error().Dave Wysochanski2009-07-071-0/+1
| | | | | | | | | | | | | | | | | | | | | | | Fix vg_read() error paths to properly release upon vg_read_error(). Note that in the iterator paths (process_each_*()), we release inside the iterator so no individual cleanup is needed. However there are a number of other places we missed the cleanup. Proper cleanup when vg_read_error() is true should be calling vg_release(vg), since there should be no locks held if we get an error (except in certain special cases, which IMO we should work to remove from the code). Unfortunately the testsuite is unable to detect these types of memory leaks. Most of them can be easily seen if you try an operation (e.g. lvcreate) with a volume group that does not exist. Error message looks like this: Volume group "vg2" not found You have a memory leak (not released memory pool): [0x1975eb8] You have a memory leak (not released memory pool): [0x1975eb8] Author: Dave Wysochanski <dwysocha@redhat.com>
* Convert the straight instances of vg_lock_and_read to new vg_read(_for_update).Dave Wysochanski2009-07-011-3/+2
| | | | | | | Sun May 3 11:40:51 CEST 2009 Petr Rockai <me@mornfall.net> * Convert the straight instances of vg_lock_and_read to new vg_read(_for_update). Rebased 6/26/09 by Dave W.
* revert last patch - let's do a release firstAlasdair Kergon2009-06-261-2/+3
|
* Convert the straight instances of vg_lock_and_read to new vg_read(_for_update).Dave Wysochanski2009-06-261-3/+2
| | | | | | | | | Sun May 3 11:40:51 CEST 2009 Petr Rockai <me@mornfall.net> * Convert the straight instances of vg_lock_and_read to new vg_read(_for_update). Author: Petr Rockai <prockai@redhat.com> Committer: Dave Wysochanski <dwysocha@redhat.com>