master - lvconvert: single step cachevol creation and attachment
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=21b37964eb88d404998e37acae5530ec102a2116 Commit: 21b37964eb88d404998e37acae5530ec102a2116 Parent: 950d2d59c140c82fea35e56d34c92289562d4d6f Author: David Teigland <[email protected]> AuthorDate: Wed Feb 5 13:42:36 2020 -0600 Committer: David Teigland <[email protected]> CommitterDate: Tue Jun 16 13:46:51 2020 -0500
lvconvert: single step cachevol creation and attachment
To add a cache or writecache to a main LV with a single command:
lvconvert --type cache|writecache --cachedevice /dev/ssd vg/main
A cachevol LV will be allocated from the specified cache device, then attached to the main LV. Include --cachesize to specify the size of cachevol to create, otherwise the entire cachedevice is used. The cachedevice option can be repeated to create a cachevol from multiple devices.
Example
-------
A user has an existing main LV that they want to speed up using a new ssd.
user adds the new ssd to the VG:
$ vgextend vg /dev/ssd
user attaches the new ssd their main LV:
$ lvconvert --type writecache --cachedevice /dev/ssd vg/main
Example
-------
A user has two existing main LVs that they want to speed up with a new ssd.
user adds the new 16G ssd to the VG:
$ vgextend vg /dev/ssd
user attaches some of the new ssd to the first main LV, using half of the space:
$ lvconvert --type writecache --cachedevice /dev/ssd
--cachesize 8G vg/main1user attaches some of the new ssd to the second main LV, using the other half of the space:
$ lvconvert --type writecache --cachedevice /dev/ssd
--cachesize 8G vg/main2Example
-------
A user has an existing main LV that they want to speed up using two new ssds.
user adds the new two ssds the VG:
$ vgextend vg /dev/ssd1 $ vgextend vg /dev/ssd2
user attaches both ssds their main LV:
$ lvconvert --type writecache
--cachedevice /dev/ssd1 --cachedevice /dev/ssd2 vg/main
---
tools/args.h | 6 ++
tools/command-lines.in | 14 +++
tools/lvconvert.c | 250 +++++++++++++++++++++++++++++++++++++------------
tools/lvmcmdline.c | 2 +
4 files changed, 211 insertions(+), 61 deletions(-)tools/args.h +6 -0
@@ -126,6 +126,12 @@ arg(cachepool_ARG, '\0', "cachepool", lv_VAL, 0, 0,arg (cachevol_ARG,'\0' ,"cachevol" , lv_VAL,0 ,0 , "The name of a cache volume.\n") +arg (cachedevice_ARG,'\0' ,"cachedevice" , pv_VAL,0 ,0 , + "The name of a device to use for a cache.\n") + +arg (cachesize_ARG,'\0' ,"cachesize" , sizemb_VAL,0 ,0 , + "The size of cache to use.\n") +arg (commandprofile_ARG,'\0' ,"commandprofile" , string_VAL,0 ,0 ,"The command profile to use for command configuration.\n" "See \\fBlvm.conf\\fP(5) for more information about profiles.\n" )
tools/command-lines.in +14 -0
@@ -497,6 +497,20 @@ FLAGS: SECONDARY_SYNTAX --- +lvconvert --type writecache --cachedevice PV LV +OO: OO_LVCONVERT, --cachesize SizeMB, --cachesettings String +ID: lvconvert_to_writecache_with_device +DESC: Add a writecache to an LV, using a specified cache device. +RULE: all and lv_is_visible + +lvconvert --type cache --cachedevice PV LV +OO: OO_LVCONVERT, --cachesize SizeMB, --cachesettings String +ID: lvconvert_to_cache_with_device +DESC: Add a cache to an LV, using a specified cache device. +RULE: all and lv_is_visible + +--- + lvconvert --type thin-pool LV_linear_striped_raid_cache OO: --stripes_long Number, --stripesize SizeKB, --discards Discards, OO_LVCONVERT_POOL, OO_LVCONVERT
tools/lvconvert.c +189 -61
312 lines not on this page · raw message
tools/lvmcmdline.c +2 -0
@@ -124,8 +124,10 @@ static const struct command_function _command_functions[CMD_COUNT] = { { lvconvert_to_cachepool_CMD, lvconvert_to_pool_cmd }, { lvconvert_to_thin_with_external_CMD, lvconvert_to_thin_with_external_cmd }, { lvconvert_to_cache_with_cachevol_CMD, lvconvert_to_cache_with_cachevol_cmd }, + { lvconvert_to_cache_with_device_CMD, lvconvert_to_cache_with_cachevol_cmd }, { lvconvert_to_cache_with_cachepool_CMD, lvconvert_to_cache_with_cachepool_cmd }, { lvconvert_to_writecache_CMD, lvconvert_to_writecache_cmd }, + { lvconvert_to_writecache_with_device_CMD, lvconvert_to_writecache_cmd }, { lvconvert_swap_pool_metadata_CMD, lvconvert_swap_pool_metadata_cmd }, { lvconvert_to_thinpool_or_swap_metadata_CMD, lvconvert_to_pool_or_swap_metadata_cmd }, { lvconvert_to_cachepool_or_swap_metadata_CMD, lvconvert_to_pool_or_swap_metadata_cmd },