2001-09-25 16:49:28 +04:00
/*
2007-08-21 23:56:18 +04:00
* Copyright ( C ) 2001 - 2004 Sistina Software , Inc . All rights reserved .
2013-02-05 14:26:27 +04:00
* Copyright ( C ) 2004 - 2013 Red Hat , Inc . All rights reserved .
2001-09-25 16:49:28 +04:00
*
2004-03-30 23:35:44 +04:00
* This file is part of LVM2 .
*
* This copyrighted material is made available to anyone wishing to use ,
* modify , copy , or redistribute it subject to the terms and conditions
2007-08-21 00:55:30 +04:00
* of the GNU Lesser General Public License v .2 .1 .
2004-03-30 23:35:44 +04:00
*
2007-08-21 00:55:30 +04:00
* You should have received a copy of the GNU Lesser General Public License
2004-03-30 23:35:44 +04:00
* along with this program ; if not , write to the Free Software Foundation ,
* Inc . , 59 Temple Place , Suite 330 , Boston , MA 02111 - 1307 USA
2001-12-17 13:08:27 +03:00
*/
/*
2010-04-13 05:54:32 +04:00
* Put all long args that don ' t have a corresponding short option first .
2001-09-25 16:49:28 +04:00
*/
2003-04-02 23:14:43 +04:00
/* *INDENT-OFF* */
2007-08-21 23:46:36 +04:00
arg ( version_ARG , ' \0 ' , " version " , NULL , 0 )
arg ( physicalvolumesize_ARG , ' \0 ' , " setphysicalvolumesize " , size_mb_arg , 0 )
arg ( ignorelockingfailure_ARG , ' \0 ' , " ignorelockingfailure " , NULL , 0 )
arg ( nolocking_ARG , ' \0 ' , " nolocking " , NULL , 0 )
2009-10-06 00:55:56 +04:00
arg ( pvmetadatacopies_ARG , ' \0 ' , " pvmetadatacopies " , int_arg , 0 )
2010-07-01 00:21:03 +04:00
arg ( vgmetadatacopies_ARG , ' \0 ' , " vgmetadatacopies " , metadatacopies_arg , 0 )
arg ( metadatacopies_ARG , ' \0 ' , " metadatacopies " , metadatacopies_arg , 0 )
2007-08-21 23:46:36 +04:00
arg ( metadatasize_ARG , ' \0 ' , " metadatasize " , size_mb_arg , 0 )
2010-06-29 00:33:58 +04:00
arg ( metadataignore_ARG , ' \0 ' , " metadataignore " , yes_no_arg , 0 )
2013-05-28 14:37:22 +04:00
arg ( bootloaderareasize_ARG , ' \0 ' , " bootloaderareasize " , size_mb_arg , 0 )
2010-08-12 08:08:59 +04:00
arg ( norestorefile_ARG , ' \0 ' , " norestorefile " , NULL , 0 )
2007-08-21 23:46:36 +04:00
arg ( restorefile_ARG , ' \0 ' , " restorefile " , string_arg , 0 )
arg ( labelsector_ARG , ' \0 ' , " labelsector " , int_arg , 0 )
arg ( driverloaded_ARG , ' \0 ' , " driverloaded " , yes_no_arg , 0 )
arg ( aligned_ARG , ' \0 ' , " aligned " , NULL , 0 )
arg ( unbuffered_ARG , ' \0 ' , " unbuffered " , NULL , 0 )
arg ( noheadings_ARG , ' \0 ' , " noheadings " , NULL , 0 )
arg ( segments_ARG , ' \0 ' , " segments " , NULL , 0 )
arg ( units_ARG , ' \0 ' , " units " , string_arg , 0 )
arg ( nosuffix_ARG , ' \0 ' , " nosuffix " , NULL , 0 )
arg ( removemissing_ARG , ' \0 ' , " removemissing " , NULL , 0 )
2010-10-13 14:34:31 +04:00
arg ( restoremissing_ARG , ' \0 ' , " restoremissing " , NULL , 0 )
2007-08-21 23:46:36 +04:00
arg ( abort_ARG , ' \0 ' , " abort " , NULL , 0 )
2010-11-11 20:29:05 +03:00
arg ( addtag_ARG , ' \0 ' , " addtag " , tag_arg , ARG_GROUPABLE )
arg ( deltag_ARG , ' \0 ' , " deltag " , tag_arg , ARG_GROUPABLE )
2007-08-21 23:46:36 +04:00
arg ( refresh_ARG , ' \0 ' , " refresh " , NULL , 0 )
arg ( mknodes_ARG , ' \0 ' , " mknodes " , NULL , 0 )
2012-08-06 20:01:01 +04:00
arg ( minor_ARG , ' \0 ' , " minor " , int_arg , ARG_GROUPABLE )
2007-08-21 23:46:36 +04:00
arg ( type_ARG , ' \0 ' , " type " , segtype_arg , 0 )
arg ( alloc_ARG , ' \0 ' , " alloc " , alloc_arg , 0 )
arg ( separator_ARG , ' \0 ' , " separator " , string_arg , 0 )
arg ( mirrorsonly_ARG , ' \0 ' , " mirrorsonly " , NULL , 0 )
arg ( nosync_ARG , ' \0 ' , " nosync " , NULL , 0 )
arg ( resync_ARG , ' \0 ' , " resync " , NULL , 0 )
arg ( corelog_ARG , ' \0 ' , " corelog " , NULL , 0 )
arg ( mirrorlog_ARG , ' \0 ' , " mirrorlog " , string_arg , 0 )
This patch adds the capability to split off a mirror legs.
It is pretty much the same as reducing the number of
mirror legs, but we just don't delete them afterwards.
The following command line interface is enforced:
prompt> lvconvert --splitmirror <n> -n <name> <VG>/<LV>
where 'n' is the number of images to split off, and
where 'name' is the name of the newly split off logical volume.
If more than one leg is split off, a new mirror will be the
result. The newly split off mirror will have a 'core' log.
Example:
[root@bp-01 LVM2]# !lvs
lvs -a -o name,copy_percent,devices
LV Copy% Devices
lv 100.00 lv_mimage_0(0),lv_mimage_1(0),lv_mimage_2(0),lv_mimage_3(0)
[lv_mimage_0] /dev/sdb1(0)
[lv_mimage_1] /dev/sdc1(0)
[lv_mimage_2] /dev/sdd1(0)
[lv_mimage_3] /dev/sde1(0)
[lv_mlog] /dev/sdi1(0)
[root@bp-01 LVM2]# lvconvert --splitmirrors 2 --name split vg/lv /dev/sd[ce]1
Logical volume lv converted.
[root@bp-01 LVM2]# !lvs
lvs -a -o name,copy_percent,devices
LV Copy% Devices
lv 100.00 lv_mimage_0(0),lv_mimage_2(0)
[lv_mimage_0] /dev/sdb1(0)
[lv_mimage_2] /dev/sdd1(0)
[lv_mlog] /dev/sdi1(0)
split 100.00 split_mimage_0(0),split_mimage_1(0)
[split_mimage_0] /dev/sde1(0)
[split_mimage_1] /dev/sdc1(0)
It can be seen that '--splitmirror <n>' is exactly the same
as '--mirrors -<n>' (note the minus sign), except there is the
additional notion to keep the image being detached from the
mirror instead of just throwing it away.
Signed-off-by: Jonathan Brassow <jbrassow@redhat.com>
2010-01-09 01:00:31 +03:00
arg ( splitmirrors_ARG , ' \0 ' , " splitmirrors " , int_arg , 0 )
2011-08-18 23:38:26 +04:00
arg ( trackchanges_ARG , ' \0 ' , " trackchanges " , NULL , 0 )
2011-11-30 06:02:10 +04:00
arg ( replace_ARG , ' \0 ' , " replace " , string_arg , ARG_GROUPABLE )
2009-04-23 20:56:21 +04:00
arg ( repair_ARG , ' \0 ' , " repair " , NULL , 0 )
2009-06-04 16:01:15 +04:00
arg ( use_policies_ARG , ' \0 ' , " use-policies " , NULL , 0 )
2007-08-21 23:46:36 +04:00
arg ( monitor_ARG , ' \0 ' , " monitor " , yes_no_arg , 0 )
arg ( config_ARG , ' \0 ' , " config " , string_arg , 0 )
arg ( trustcache_ARG , ' \0 ' , " trustcache " , NULL , 0 )
2012-03-02 22:09:46 +04:00
arg ( cache_ARG , ' \0 ' , " cache " , NULL , 0 )
2007-08-21 23:46:36 +04:00
arg ( ignoremonitoring_ARG , ' \0 ' , " ignoremonitoring " , NULL , 0 )
2008-06-06 23:28:35 +04:00
arg ( nameprefixes_ARG , ' \0 ' , " nameprefixes " , NULL , 0 )
2008-06-25 01:21:04 +04:00
arg ( unquoted_ARG , ' \0 ' , " unquoted " , NULL , 0 )
2008-06-25 02:48:53 +04:00
arg ( rows_ARG , ' \0 ' , " rows " , NULL , 0 )
2009-02-22 22:00:26 +03:00
arg ( dataalignment_ARG , ' \0 ' , " dataalignment " , size_kb_arg , 0 )
2009-07-30 21:45:28 +04:00
arg ( dataalignmentoffset_ARG , ' \0 ' , " dataalignmentoffset " , size_kb_arg , 0 )
2009-04-25 05:17:59 +04:00
arg ( virtualoriginsize_ARG , ' \0 ' , " virtualoriginsize " , size_mb_arg , 0 )
2009-08-04 19:53:04 +04:00
arg ( noudevsync_ARG , ' \0 ' , " noudevsync " , NULL , 0 )
2013-02-05 14:26:27 +04:00
arg ( originname_ARG , ' \0 ' , " originname " , string_arg , 0 )
2010-01-05 23:56:51 +03:00
arg ( poll_ARG , ' \0 ' , " poll " , yes_no_arg , 0 )
2012-05-14 15:57:30 +04:00
arg ( poolmetadata_ARG , ' \0 ' , " poolmetadata " , string_arg , 0 )
2011-11-05 02:43:10 +04:00
arg ( poolmetadatasize_ARG , ' \0 ' , " poolmetadatasize " , size_mb_arg , 0 )
2012-08-08 00:24:41 +04:00
arg ( discards_ARG , ' \0 ' , " discards " , discards_arg , 0 )
2012-11-27 02:45:35 +04:00
arg ( force_long_ARG , ' \0 ' , " force " , NULL , ARG_COUNTABLE )
2010-04-13 05:54:32 +04:00
arg ( stripes_long_ARG , ' \0 ' , " stripes " , int_arg , 0 )
2010-05-06 15:15:55 +04:00
arg ( sysinit_ARG , ' \0 ' , " sysinit " , NULL , 0 )
2011-09-06 04:26:42 +04:00
arg ( thinpool_ARG , ' \0 ' , " thinpool " , string_arg , 0 )
2013-03-05 20:48:29 +04:00
arg ( configtype_ARG , ' \0 ' , " type " , string_arg , 0 )
2013-03-05 21:21:13 +04:00
arg ( withcomments_ARG , ' \0 ' , " withcomments " , NULL , 0 )
arg ( withversions_ARG , ' \0 ' , " withversions " , NULL , 0 )
2013-03-06 12:35:33 +04:00
arg ( ignoreadvanced_ARG , ' \0 ' , " ignoreadvanced " , NULL , 0 )
arg ( ignoreunsupported_ARG , ' \0 ' , " ignoreunsupported " , NULL , 0 )
2013-03-05 20:48:29 +04:00
arg ( atversion_ARG , ' \0 ' , " atversion " , string_arg , 0 )
arg ( validate_ARG , ' \0 ' , " validate " , NULL , 0 )
2013-04-12 00:33:59 +04:00
arg ( syncaction_ARG , ' \0 ' , " syncaction " , string_arg , 0 )
RAID: Add writemostly/writebehind support for RAID1
'lvchange' is used to alter a RAID 1 logical volume's write-mostly and
write-behind characteristics. The '--writemostly' parameter takes a
PV as an argument with an optional trailing character to specify whether
to set ('y'), unset ('n'), or toggle ('t') the value. If no trailing
character is given, it will set the flag.
Synopsis:
lvchange [--writemostly <PV>:{t|y|n}] [--writebehind <count>] vg/lv
Example:
lvchange --writemostly /dev/sdb1:y --writebehind 512 vg/raid1_lv
The last character in the 'lv_attr' field is used to show whether a device
has the WriteMostly flag set. It is signified with a 'w'. If the device
has failed, the 'p'artial flag has priority.
Example ("nosync" raid1 with mismatch_cnt and writemostly):
[~]# lvs -a --segment vg
LV VG Attr #Str Type SSize
raid1 vg Rwi---r-m 2 raid1 500.00m
[raid1_rimage_0] vg Iwi---r-- 1 linear 500.00m
[raid1_rimage_1] vg Iwi---r-w 1 linear 500.00m
[raid1_rmeta_0] vg ewi---r-- 1 linear 4.00m
[raid1_rmeta_1] vg ewi---r-- 1 linear 4.00m
Example (raid1 with mismatch_cnt, writemostly - but failed drive):
[~]# lvs -a --segment vg
LV VG Attr #Str Type SSize
raid1 vg rwi---r-p 2 raid1 500.00m
[raid1_rimage_0] vg Iwi---r-- 1 linear 500.00m
[raid1_rimage_1] vg Iwi---r-p 1 linear 500.00m
[raid1_rmeta_0] vg ewi---r-- 1 linear 4.00m
[raid1_rmeta_1] vg ewi---r-p 1 linear 4.00m
A new reportable field has been added for writebehind as well. If
write-behind has not been set or the LV is not RAID1, the field will
be blank.
Example (writebehind is set):
[~]# lvs -a -o name,attr,writebehind vg
LV Attr WBehind
lv rwi-a-r-- 512
[lv_rimage_0] iwi-aor-w
[lv_rimage_1] iwi-aor--
[lv_rmeta_0] ewi-aor--
[lv_rmeta_1] ewi-aor--
Example (writebehind is not set):
[~]# lvs -a -o name,attr,writebehind vg
LV Attr WBehind
lv rwi-a-r--
[lv_rimage_0] iwi-aor-w
[lv_rimage_1] iwi-aor--
[lv_rmeta_0] ewi-aor--
[lv_rmeta_1] ewi-aor--
2013-04-15 22:59:46 +04:00
arg ( writemostly_ARG , ' \0 ' , " writemostly " , string_arg , ARG_GROUPABLE )
arg ( writebehind_ARG , ' \0 ' , " writebehind " , int_arg , 0 )
2013-05-31 20:25:52 +04:00
arg ( minrecoveryrate_ARG , ' \0 ' , " minrecoveryrate " , size_kb_arg , 0 )
arg ( maxrecoveryrate_ARG , ' \0 ' , " maxrecoveryrate " , size_kb_arg , 0 )
2001-09-25 16:49:28 +04:00
2002-01-10 18:09:51 +03:00
/* Allow some variations */
2007-08-21 23:46:36 +04:00
arg ( resizable_ARG , ' \0 ' , " resizable " , yes_no_arg , 0 )
arg ( allocation_ARG , ' \0 ' , " allocation " , yes_no_arg , 0 )
2012-06-27 15:48:31 +04:00
arg ( available_ARG , ' \0 ' , " available " , activation_arg , 0 )
2002-01-10 18:09:51 +03:00
2001-12-17 13:08:27 +03:00
/*
* . . . and now the short args .
*/
2012-06-27 15:48:31 +04:00
arg ( activate_ARG , ' a ' , " activate " , activation_arg , 0 )
2007-08-21 23:46:36 +04:00
arg ( all_ARG , ' a ' , " all " , NULL , 0 )
arg ( autobackup_ARG , ' A ' , " autobackup " , yes_no_arg , 0 )
arg ( activevolumegroups_ARG , ' A ' , " activevolumegroups " , NULL , 0 )
arg ( background_ARG , ' b ' , " background " , NULL , 0 )
arg ( blockdevice_ARG , ' b ' , " blockdevice " , NULL , 0 )
arg ( chunksize_ARG , ' c ' , " chunksize " , size_kb_arg , 0 )
arg ( clustered_ARG , ' c ' , " clustered " , yes_no_arg , 0 )
arg ( colon_ARG , ' c ' , " colon " , NULL , 0 )
arg ( columns_ARG , ' C ' , " columns " , NULL , 0 )
arg ( contiguous_ARG , ' C ' , " contiguous " , yes_no_arg , 0 )
2010-11-11 20:29:05 +03:00
arg ( debug_ARG , ' d ' , " debug " , NULL , ARG_COUNTABLE )
2007-08-21 23:46:36 +04:00
arg ( exported_ARG , ' e ' , " exported " , NULL , 0 )
arg ( physicalextent_ARG , ' E ' , " physicalextent " , NULL , 0 )
arg ( file_ARG , ' f ' , " file " , string_arg , 0 )
2010-11-11 20:29:05 +03:00
arg ( force_ARG , ' f ' , " force " , NULL , ARG_COUNTABLE )
2007-08-21 23:46:36 +04:00
arg ( full_ARG , ' f ' , " full " , NULL , 0 )
arg ( help_ARG , ' h ' , " help " , NULL , 0 )
arg ( help2_ARG , ' ? ' , " " , NULL , 0 )
arg ( stripesize_ARG , ' I ' , " stripesize " , size_kb_arg , 0 )
arg ( stripes_ARG , ' i ' , " stripes " , int_arg , 0 )
arg ( interval_ARG , ' i ' , " interval " , int_arg , 0 )
arg ( iop_version_ARG , ' i ' , " iop_version " , NULL , 0 )
arg ( logicalvolume_ARG , ' l ' , " logicalvolume " , int_arg , 0 )
arg ( maxlogicalvolumes_ARG , ' l ' , " maxlogicalvolumes " , int_arg , 0 )
arg ( extents_ARG , ' l ' , " extents " , int_arg_with_sign_and_percent , 0 )
arg ( lvmpartition_ARG , ' l ' , " lvmpartition " , NULL , 0 )
arg ( list_ARG , ' l ' , " list " , NULL , 0 )
arg ( size_ARG , ' L ' , " size " , size_mb_arg , 0 )
arg ( logicalextent_ARG , ' L ' , " logicalextent " , int_arg_with_sign , 0 )
arg ( persistent_ARG , ' M ' , " persistent " , yes_no_arg , 0 )
2010-01-13 04:45:15 +03:00
arg ( merge_ARG , ' \0 ' , " merge " , NULL , 0 )
2012-08-06 20:01:01 +04:00
arg ( major_ARG , ' j ' , " major " , int_arg , ARG_GROUPABLE )
2007-08-21 23:46:36 +04:00
arg ( mirrors_ARG , ' m ' , " mirrors " , int_arg_with_sign , 0 )
arg ( metadatatype_ARG , ' M ' , " metadatatype " , metadatatype_arg , 0 )
arg ( maps_ARG , ' m ' , " maps " , NULL , 0 )
arg ( name_ARG , ' n ' , " name " , string_arg , 0 )
arg ( oldpath_ARG , ' n ' , " oldpath " , NULL , 0 )
arg ( nofsck_ARG , ' n ' , " nofsck " , NULL , 0 )
arg ( novolumegroup_ARG , ' n ' , " novolumegroup " , NULL , 0 )
arg ( options_ARG , ' o ' , " options " , string_arg , 0 )
arg ( sort_ARG , ' O ' , " sort " , string_arg , 0 )
arg ( permission_ARG , ' p ' , " permission " , permission_arg , 0 )
arg ( maxphysicalvolumes_ARG , ' p ' , " maxphysicalvolumes " , int_arg , 0 )
arg ( partial_ARG , ' P ' , " partial " , NULL , 0 )
arg ( physicalvolume_ARG , ' P ' , " physicalvolume " , NULL , 0 )
config: add silent mode
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.
2012-08-25 23:35:48 +04:00
arg ( quiet_ARG , ' q ' , " quiet " , NULL , ARG_COUNTABLE )
2007-11-09 19:51:54 +03:00
arg ( readahead_ARG , ' r ' , " readahead " , readahead_arg , 0 )
2007-08-21 23:46:36 +04:00
arg ( resizefs_ARG , ' r ' , " resizefs " , NULL , 0 )
arg ( reset_ARG , ' R ' , " reset " , NULL , 0 )
arg ( regionsize_ARG , ' R ' , " regionsize " , size_mb_arg , 0 )
arg ( physicalextentsize_ARG , ' s ' , " physicalextentsize " , size_mb_arg , 0 )
arg ( stdin_ARG , ' s ' , " stdin " , NULL , 0 )
arg ( snapshot_ARG , ' s ' , " snapshot " , NULL , 0 )
arg ( short_ARG , ' s ' , " short " , NULL , 0 )
2011-09-06 04:26:42 +04:00
arg ( thin_ARG , ' T ' , " thin " , NULL , 0 )
2007-08-21 23:46:36 +04:00
arg ( test_ARG , ' t ' , " test " , NULL , 0 )
arg ( uuid_ARG , ' u ' , " uuid " , NULL , 0 )
arg ( uuidstr_ARG , ' u ' , " uuid " , string_arg , 0 )
arg ( uuidlist_ARG , ' U ' , " uuidlist " , NULL , 0 )
2010-11-11 20:29:05 +03:00
arg ( verbose_ARG , ' v ' , " verbose " , NULL , ARG_COUNTABLE )
2007-08-21 23:46:36 +04:00
arg ( volumegroup_ARG , ' V ' , " volumegroup " , NULL , 0 )
2011-08-17 19:15:36 +04:00
arg ( virtualsize_ARG , ' V ' , " virtualsize " , size_mb_arg , 0 )
2007-08-21 23:46:36 +04:00
arg ( allocatable_ARG , ' x ' , " allocatable " , yes_no_arg , 0 )
arg ( resizeable_ARG , ' x ' , " resizeable " , yes_no_arg , 0 )
arg ( yes_ARG , ' y ' , " yes " , NULL , 0 )
arg ( zero_ARG , ' Z ' , " zero " , yes_no_arg , 0 )
2001-09-25 16:49:28 +04:00
/* this should always be last */
2007-08-21 23:46:36 +04:00
arg ( ARG_COUNT , ' - ' , " " , NULL , 0 )
2003-04-02 23:14:43 +04:00
/* *INDENT-ON* */