master - reports: FIXME for unnecessary cache wipes.
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d36f721bb984c1...
Commit: d36f721bb984c16bd20733325be0d9fc73706709
Parent: 3f0f5587864e8bb0457089d1cca50b2231b421de
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Fri Apr 4 01:41:06 2014 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Fri Apr 4 01:41:06 2014 +0100
reports: FIXME for unnecessary cache wipes.
---
tools/reporter.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/tools/reporter.c b/tools/reporter.c
index e070bc2..2591fd5 100644
--- a/tools/reporter.c
+++ b/tools/reporter.c
@@ -271,6 +271,9 @@ static int _report(struct cmd_context *cmd, int argc, char **argv,
report_type == LABEL ||
report_type == PVSEGS) ? 1 : 0;
+ /*
+ * FIXME Trigger scans based on unrecognised listed devices instead.
+ */
if (args_are_pvs && argc)
cmd->filter->wipe(cmd->filter);
10 years, 1 month
master - dev-cache: Improve open device check messages.
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=3f0f5587864e8b...
Commit: 3f0f5587864e8bb0457089d1cca50b2231b421de
Parent: c16c1a9f7071ab91e0f14f42d172adfe0db1e9cf
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Fri Apr 4 01:39:42 2014 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Fri Apr 4 01:39:42 2014 +0100
dev-cache: Improve open device check messages.
---
lib/device/dev-cache.c | 22 ++++++++++++++--------
lib/device/dev-cache.h | 5 ++++-
2 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/lib/device/dev-cache.c b/lib/device/dev-cache.c
index b16ace4..f76e527 100644
--- a/lib/device/dev-cache.c
+++ b/lib/device/dev-cache.c
@@ -763,26 +763,32 @@ int dev_cache_init(struct cmd_context *cmd)
return 0;
}
+/*
+ * Returns number of devices still open.
+ */
static int _check_for_open_devices(int close_immediate)
{
struct device *dev;
struct dm_hash_node *n;
- int r = 0;
+ int num_open = 0;
dm_hash_iterate(n, _cache.names) {
dev = (struct device *) dm_hash_get_data(_cache.names, n);
if (dev->fd >= 0) {
- log_error("Device '%s' has been left open (%d).",
+ log_error("Device '%s' has been left open (%d remaining references).",
dev_name(dev), dev->open_count);
- r++;
+ num_open++;
if (close_immediate)
dev_close_immediate(dev);
}
}
- return r;
+ return num_open;
}
+/*
+ * Returns number of devices left open.
+ */
int dev_cache_check_for_open_devices(void)
{
return _check_for_open_devices(0);
@@ -790,11 +796,11 @@ int dev_cache_check_for_open_devices(void)
int dev_cache_exit(void)
{
- int cnt = 0;
+ int num_open = 0;
if (_cache.names)
- if ((cnt = _check_for_open_devices(1)) > 0)
- log_error(INTERNAL_ERROR "%d device(s) have been closed.", cnt);
+ if ((num_open = _check_for_open_devices(1)) > 0)
+ log_error(INTERNAL_ERROR "%d device(s) were left open and have been closed.", num_open);
if (_cache.preferred_names_matcher)
_cache.preferred_names_matcher = NULL;
@@ -814,7 +820,7 @@ int dev_cache_exit(void)
dm_list_init(&_cache.dirs);
dm_list_init(&_cache.files);
- return (cnt == 0);
+ return (!num_open);
}
int dev_cache_add_dir(const char *path)
diff --git a/lib/device/dev-cache.h b/lib/device/dev-cache.h
index c18d5f6..fcc69a5 100644
--- a/lib/device/dev-cache.h
+++ b/lib/device/dev-cache.h
@@ -36,8 +36,11 @@ struct dev_filter {
*/
struct cmd_context;
int dev_cache_init(struct cmd_context *cmd);
-int dev_cache_check_for_open_devices(void);
int dev_cache_exit(void);
+/*
+ * Returns number of open devices.
+ */
+int dev_cache_check_for_open_devices(void);
/* Trigger(1) or avoid(0) a scan */
void dev_cache_scan(int do_scan);
10 years, 1 month
master - clvmd: Update new remove_info INTERNAL_ERRORS.
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=c16c1a9f7071ab...
Commit: c16c1a9f7071ab91e0f14f42d172adfe0db1e9cf
Parent: 12ddaa5f104a35df777b97802d9025ceaaadd0db
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Fri Apr 4 01:37:43 2014 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Fri Apr 4 01:37:43 2014 +0100
clvmd: Update new remove_info INTERNAL_ERRORS.
---
daemons/clvmd/lvm-functions.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/daemons/clvmd/lvm-functions.c b/daemons/clvmd/lvm-functions.c
index 4ce0fcc..f4fb7fd 100644
--- a/daemons/clvmd/lvm-functions.c
+++ b/daemons/clvmd/lvm-functions.c
@@ -180,15 +180,17 @@ static int insert_info(const char *resource, struct lv_info *lvi)
static void remove_info(const char *resource)
{
+ int num_open;
+
pthread_mutex_lock(&lv_hash_lock);
dm_hash_remove(lv_hash, resource);
/* When last lock is remove, validate there are not left opened devices */
if (!dm_hash_get_first(lv_hash)) {
- if (dev_cache_check_for_open_devices())
- log_error(INTERNAL_ERROR "Nothing is locked however there are still opened devices.");
if (critical_section())
- log_error(INTERNAL_ERROR "Nothing is locked however clvmd is left in critical section.");
+ log_error(INTERNAL_ERROR "No volumes are locked however clvmd is in activation mode critical section.");
+ if ((num_open = dev_cache_check_for_open_devices()))
+ log_error(INTERNAL_ERROR "No volumes are locked however %d devices are still open.", num_open);
}
pthread_mutex_unlock(&lv_hash_lock);
10 years, 1 month
master - lib: Share lvm_even_rand for random numbers.
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=12ddaa5f104a35...
Commit: 12ddaa5f104a35df777b97802d9025ceaaadd0db
Parent: e7b8e0a10c500f94f8d7815d83d88f0a45f2c570
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Fri Apr 4 01:26:19 2014 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Fri Apr 4 01:26:19 2014 +0100
lib: Share lvm_even_rand for random numbers.
---
WHATS_NEW | 1 +
lib/metadata/metadata.c | 25 +------------------------
lib/misc/lvm-wrappers.c | 21 +++++++++++++++++++++
lib/misc/lvm-wrappers.h | 5 +++++
4 files changed, 28 insertions(+), 24 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 70b39c1..b5e96fd 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.106 -
====================================
+ Export lvm_even_rand() for controlled provision of random numbers.
Add lvmthin man page to section 7.
Extend internal validation of lv names size is less then 128 chars.
Fail in resume for lvrename will result in failing command.
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index 798f3ab..65a288c 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -1057,29 +1057,6 @@ uint64_t extents_from_size(struct cmd_context *cmd, uint64_t size,
return size / extent_size;
}
-/*
- * Return random integer in [0,max) interval
- *
- * The loop rejects numbers that come from an "incomplete" slice of the
- * RAND_MAX space (considering the number space [0, RAND_MAX] is divided
- * into some "max"-sized slices and at most a single smaller slice,
- * between [n*max, RAND_MAX] for suitable n -- numbers from this last slice
- * are discarded because they could distort the distribution in favour of
- * smaller numbers.
- */
-static unsigned _even_rand( unsigned *seed, unsigned max )
-{
- unsigned r, ret;
-
- /* make sure distribution is even */
- do {
- r = (unsigned) rand_r( seed );
- ret = r % max;
- } while ( r - ret > RAND_MAX - max );
-
- return ret;
-}
-
static dm_bitset_t _bitset_with_random_bits(struct dm_pool *mem, uint32_t num_bits,
uint32_t num_set_bits, unsigned *seed)
{
@@ -1102,7 +1079,7 @@ static dm_bitset_t _bitset_with_random_bits(struct dm_pool *mem, uint32_t num_bi
/* Perform loop num_set_bits times, selecting one bit each time */
while (i++ < num_bits) {
/* Select a random bit between 0 and (i-1) inclusive. */
- bit_selected = _even_rand(seed, i);
+ bit_selected = lvm_even_rand(seed, i);
/*
* If the bit was already set, set the new bit that became
diff --git a/lib/misc/lvm-wrappers.c b/lib/misc/lvm-wrappers.c
index 7ea3ac5..5604ce7 100644
--- a/lib/misc/lvm-wrappers.c
+++ b/lib/misc/lvm-wrappers.c
@@ -118,3 +118,24 @@ int read_urandom(void *buf, size_t len)
return 1;
}
+/*
+ * Return random integer in [0,max) interval
+ *
+ * The loop rejects numbers that come from an "incomplete" slice of the
+ * RAND_MAX space. Considering the number space [0, RAND_MAX] is divided
+ * into some "max"-sized slices and at most a single smaller slice,
+ * between [n*max, RAND_MAX] for suitable n, numbers from this last slice
+ * are discarded because they could distort the distribution in favour of
+ * smaller numbers.
+ */
+unsigned lvm_even_rand(unsigned *seed, unsigned max)
+{
+ unsigned r, ret;
+
+ do {
+ r = (unsigned) rand_r(seed);
+ ret = r % max;
+ } while (r - ret > RAND_MAX - max);
+
+ return ret;
+}
diff --git a/lib/misc/lvm-wrappers.h b/lib/misc/lvm-wrappers.h
index b8d1217..9368e25 100644
--- a/lib/misc/lvm-wrappers.h
+++ b/lib/misc/lvm-wrappers.h
@@ -32,6 +32,11 @@ int lvm_getpagesize(void);
*/
int read_urandom(void *buf, size_t len);
+/*
+ * Return random integer in [0,max) interval
+ */
+unsigned lvm_even_rand(unsigned *seed, unsigned max);
+
# ifndef HAVE_SIGINTERRUPT
# define siginterrupt(sig, flag) \
do { \
10 years, 1 month
master - vgsplit: Mark cache moving code NOTREACHED.
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e7b8e0a10c500f...
Commit: e7b8e0a10c500f94f8d7815d83d88f0a45f2c570
Parent: 6d2a26f6b6031f275b89a0210a9c5436e006a544
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Fri Apr 4 01:19:04 2014 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Fri Apr 4 01:19:04 2014 +0100
vgsplit: Mark cache moving code NOTREACHED.
---
tools/vgsplit.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/tools/vgsplit.c b/tools/vgsplit.c
index 150be1d..9d26079 100644
--- a/tools/vgsplit.c
+++ b/tools/vgsplit.c
@@ -299,6 +299,8 @@ static int _move_cache(struct volume_group *vg_from,
log_error("Unable to split VG while it contains cache LVs");
return 0;
+ /* NOTREACHED */
+
if (lv_is_cache(lv)) {
orig = seg_lv(seg, 0);
data = seg_lv(first_seg(seg->pool_lv), 0);
10 years, 1 month
master - man: Add lvmthin(7).
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=6d2a26f6b6031f...
Commit: 6d2a26f6b6031f275b89a0210a9c5436e006a544
Parent: 6c6468f91d9b7a93a85726dfb1b397b555502c1c
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Fri Apr 4 01:14:25 2014 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Fri Apr 4 01:14:25 2014 +0100
man: Add lvmthin(7).
---
WHATS_NEW | 1 +
man/Makefile.in | 24 ++++++++++++++++++------
2 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 0a95f3d..70b39c1 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.106 -
====================================
+ Add lvmthin man page to section 7.
Extend internal validation of lv names size is less then 128 chars.
Fail in resume for lvrename will result in failing command.
Validate length of new LV name in lvrename to not exceed 127 characters.
diff --git a/man/Makefile.in b/man/Makefile.in
index 72098e6..6c59c8e 100644
--- a/man/Makefile.in
+++ b/man/Makefile.in
@@ -56,18 +56,26 @@ ifneq ("@CLVMD@", "none")
else
MAN8CLUSTER=
endif
+
ifeq ("@BUILD_CMIRRORD@", "yes")
MAN8CLUSTER+=cmirrord.8
endif
+ifneq ("@THIN@", "none")
+ MAN7=lvmthin.7
+else
+ MAN7=
+endif
+
MAN8DM=dmsetup.8 $(DMEVENTDMAN)
MAN5DIR=$(mandir)/man5
+MAN7DIR=$(mandir)/man7
MAN8DIR=$(mandir)/man8
MAN8SYSTEMD_GENERATORS=lvm2-activation-generator.8
-CLEAN_TARGETS=$(MAN5) $(MAN8) $(MAN8CLUSTER) $(FSADMMAN) $(BLKDEACTIVATEMAN) $(DMEVENTDMAN) $(MAN8DM)
-DISTCLEAN_TARGETS=fsadm.8 clvmd.8 cmirrord.8 dmeventd.8
+CLEAN_TARGETS=$(MAN5) $(MAN7) $(MAN8) $(MAN8CLUSTER) $(FSADMMAN) $(BLKDEACTIVATEMAN) $(DMEVENTDMAN) $(MAN8DM)
+DISTCLEAN_TARGETS=fsadm.8 clvmd.8 cmirrord.8 dmeventd.8 lvmthin.7 blkdeactivate.8
include $(top_builddir)/make.tmpl
@@ -77,13 +85,13 @@ endif
all: man device-mapper
-.PHONY: man install_man5 install_man8
+.PHONY: man install_man5 install_man7 install_man8
device-mapper: $(MAN8DM)
-man: $(MAN5) $(MAN8) $(MAN8CLUSTER)
+man: $(MAN5) $(MAN7) $(MAN8) $(MAN8CLUSTER)
-$(MAN5) $(MAN8) $(MAN8DM) $(MAN8CLUSTER): Makefile
+$(MAN5) $(MAN7) $(MAN8) $(MAN8DM) $(MAN8CLUSTER): Makefile
%: %.in
@case "$@" in \
@@ -95,11 +103,15 @@ install_man5: $(MAN5)
$(INSTALL) -d $(MAN5DIR)
$(INSTALL_DATA) $(MAN5) $(MAN5DIR)/
+install_man7: $(MAN8)
+ $(INSTALL) -d $(MAN7DIR)
+ $(INSTALL_DATA) $(MAN7) $(MAN7DIR)/
+
install_man8: $(MAN8)
$(INSTALL) -d $(MAN8DIR)
$(INSTALL_DATA) $(MAN8) $(MAN8DIR)/
-install_lvm2: install_man5 install_man8
+install_lvm2: install_man5 install_man7 install_man8
install_cluster: $(MAN8CLUSTER)
$(INSTALL) -d $(MAN8DIR)
10 years, 1 month
master - RAID: Improve an error message
by Jonathan Brassow
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=6c6468f91d9b7a...
Commit: 6c6468f91d9b7a93a85726dfb1b397b555502c1c
Parent: f242c0611d142c9e79328d4e927c0c55d08564d1
Author: Jonathan Brassow <jbrassow(a)redhat.com>
AuthorDate: Thu Apr 3 16:57:41 2014 -0500
Committer: Jonathan Brassow <jbrassow(a)redhat.com>
CommitterDate: Thu Apr 3 16:57:41 2014 -0500
RAID: Improve an error message
When down-converting a RAID1 LV, if the user specifies too few devices,
they will get a confusing message.
Ex:
[root]# lvcreate -m 2 --type raid1 -n raid -L 500M taft
Logical volume "raid" created
[root]# lvconvert -m 0 taft/raid /dev/sdd1
Unable to extract enough images to satisfy request
Failed to extract images from taft/raid
This patch makes the error message a bit clearer by telling the user
the count they are trying to remove and the number of devices they
supplied.
[root@bp-01 lvm2]# lvcreate --type raid1 -m 3 -L 200M -n lv vg
Logical volume "lv" created
[root@bp-01 lvm2]# lvconvert -m -3 vg/lv /dev/sdb1
Unable to remove 3 images: Only 1 device given.
Failed to extract images from vg/lv
[root@bp-01 lvm2]# lvconvert -m -3 vg/lv /dev/sd[bc]1
Unable to remove 3 images: Only 2 devices given.
Failed to extract images from vg/lv
[root@bp-01 lvm2]# lvconvert -m -3 vg/lv /dev/sd[bcd]1
[root@bp-01 lvm2]# lvs -a -o name,attr,devices vg
LV Attr Devices
lv -wi-a----- /dev/sde1(1)
This patch doesn't work in all cases. The user can specify the right
number of devices, but not a sufficient amount of devices from the LV.
This will produce the old error message:
[root@bp-01 lvm2]# lvconvert -m -3 vg/lv /dev/sd[bcf]1
Unable to extract enough images to satisfy request
Failed to extract images from vg/lv
However, I think this error message is sufficient for this case.
---
lib/metadata/raid_manip.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index d1759ae..f1cb012 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -840,6 +840,12 @@ static int _raid_extract_images(struct logical_volume *lv, uint32_t new_count,
log_verbose("Extracting %u %s from %s/%s", extract,
(extract > 1) ? "images" : "image",
lv->vg->name, lv->name);
+ if (dm_list_size(target_pvs) < extract) {
+ log_error("Unable to remove %d images: Only %d device%s given.",
+ extract, dm_list_size(target_pvs),
+ (dm_list_size(target_pvs) == 1) ? "" : "s");
+ return 0;
+ }
lvl_array = dm_pool_alloc(lv->vg->vgmem,
sizeof(*lvl_array) * extract * 2);
10 years, 1 month
master - man: lvmthin pool space exhaustion
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f242c0611d142c...
Commit: f242c0611d142c9e79328d4e927c0c55d08564d1
Parent: 7b11b1b4b56d7a3bcf0e70d1b883a4c5aaf0cecd
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Apr 3 16:20:15 2014 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Apr 3 16:20:15 2014 -0500
man: lvmthin pool space exhaustion
Initial description and instructions for
data/metadata space exhaustion.
---
man/lvmthin.7.in | 102 +++++++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 93 insertions(+), 9 deletions(-)
diff --git a/man/lvmthin.7.in b/man/lvmthin.7.in
index 3ecec61..56bc93e 100644
--- a/man/lvmthin.7.in
+++ b/man/lvmthin.7.in
@@ -17,18 +17,18 @@ blocks in a thin LV are allocated (during use) from a special "thin pool
LV". The thin pool LV contains blocks of physical storage, and blocks in
thin LVs just reference blocks in the thin pool LV.
-A thin pool LV must be created before thin LV's can be created within it.
-A thin pool LV is created by combining two standard LV's: a large data LV
+A thin pool LV must be created before thin LVs can be created within it.
+A thin pool LV is created by combining two standard LVs: a large data LV
that will hold blocks for thin LVs, and a metadata LV that will hold
metadata. The metadata tracks which data blocks belong to each thin LV.
Snapshots of thin LVs are efficient because the data blocks common to a
-thin LV and its snapshot are shared. Snapshots may be taken of thin LV's
+thin LV and its snapshot are shared. Snapshots may be taken of thin LVs
or of other thin snapshots. Blocks common to recursive snapshots are also
shared in the thin pool. There is no limit to or degradation from
sequences of snapshots.
-As thin LV's or snapshot LV's are written to, they consume data blocks in
+As thin LVs or snapshot LVs are written to, they consume data blocks in
the thin pool. As free data blocks in the pool decrease, more free blocks
may need to be supplied. This is done by extending the thin pool data LV
with additional physical space from the VG. Removing thin LVs or
@@ -146,7 +146,7 @@ The primary method for using lvm thin provisioning:
Create a new thin LV from the thin pool LV.
The thin LV is created with a virtual size.
- Multiple new thin LV's may be created in the thin pool.
+ Multiple new thin LVs may be created in the thin pool.
Thin LV names must be unique in the VG.
The thinpool argument specifies which thin pool will
contain the ThinLV.
@@ -221,7 +221,7 @@ Automatic pool metadata LV
.br
Activation of thin snapshots
.br
-Removing thin pool LV's, thin LV's and snapshots
+Removing thin pool LVs, thin LVs and snapshots
.br
Manually manage free data space of thin pool LV
.br
@@ -231,6 +231,10 @@ Using fstrim to increase free space in a thin pool LV
.br
Automatically extend thin pool LV
.br
+Data space exhaustion
+.br
+Metadata space exhaustion
+.br
Zeroing
.br
Discard
@@ -348,7 +352,7 @@ If the thin_check command finds a problem with the metadata,
the thin pool LV is not activated, and the thin pool metadata should
be repaired.
-Command to repair a thin pool LV:
+Command to repair a thin pool:
.nf
lvconvert --repair VG/ThinPoolLV
.fi
@@ -460,7 +464,7 @@ See lvm.conf auto_set_activation_skip to set default usage of
activation skip.
-.SS Removing thin pool LV's, thin LV's and snapshots
+.SS Removing thin pool LVs, thin LVs and snapshots
\&
@@ -471,7 +475,7 @@ thin LVs and snapshots.
Removing a thin pool LV removes both the data LV and metadata LV
and returns the space to the VG.
-lvremove of thin pool LV's, thin LV's and snapshots cannot be
+lvremove of thin pool LVs, thin LVs and snapshots cannot be
reversed with vgcfgrestore.
vgcfgbackup does not back up thin pool metadata.
@@ -486,6 +490,9 @@ with the lvs command. Free space can be added by extending
the thin pool LV.
.nf
+Command to extend thin pool data space:
+lvextend -L Size VG/ThinPoolLV
+
Example
1. A thin pool LV is using 26.96% of its data blocks.
@@ -514,6 +521,11 @@ fstrim on the file system using a thin LV.
The available metadata space in a thin pool LV can be displayed
with the lvs -o+metadata_percent command.
+Command to extend thin pool metadata space:
+.nf
+lvextend -L Size VG/ThinPoolLV_tmeta
+.fi
+
Example
1. A thin pool LV is using 12.40% of its metadata blocks.
@@ -639,6 +651,78 @@ For a 1G pool, using 700M will trigger a resize to 1.2G. When the usage exceeds
840M, the pool will be extended to 1.44G, and so on.
+.SS Data space exhaustion
+
+\&
+
+If thin pool data space is exhausted, writes to thin LVs will be queued
+until the the data space is extended. Reading is still possible.
+
+When data space is exhausted, the lvs command displays 100 under Data% for
+the thin pool LV:
+
+.nf
+# lvs vg/pool0
+LV VG Attr LSize Pool Origin Data%
+pool0 vg twi-a-tz-- 512.00m 100.00
+.fi
+
+A thin pool can run out of data blocks for any of the following reasons:
+
+1. Automatic extension of the thin pool is disabled, and the thin pool is
+not manually extended. (Disabling automatic extension is not
+recommended.)
+
+2. The dmeventd daemon is not running and the thin pool is not manually
+extended. (Disabling dmeventd is not recommended.)
+
+3. Automatic extension of the thin pool is too slow given the rate of
+writes to thin LVs in the pool. (This can be addressed by tuning the
+thin_pool_autoextend_threshold and thin_pool_autoextend_percent.)
+
+4. The VG does have enough free blocks to extend the thin pool.
+
+The response to data space exhaustion is to extend the thin pool. This is
+described in the section "Manually manage free data space of thin pool
+LV".
+
+
+.SS Metadata space exhaustion
+
+\&
+
+If thin pool metadata space is exhausted (or a thin pool metadata
+operation fails), errors will be returned for IO operations on thin LVs.
+
+When metadata space is exhausted, the lvs command displays 100 under Meta%
+for the thin pool LV:
+
+.nf
+# lvs -o lv_name,size,data_percent,metadata_percent vg/pool0
+LV LSize Data% Meta%
+pool0 100.00
+.fi
+
+The same reasons for thin pool data space exhaustion apply to thin pool
+metadata space.
+
+Metadata space exhaustion can lead to inconsistent thin pool metadata and
+inconsistent file systems, so the response requires offline checking and
+repair.
+
+1. Deactivate the thin pool LV, or reboot the system if this is not possible.
+
+2. Repair thin pool with lvconvert --repair.
+.br
+ See "Metadata check and repair".
+
+3. Extend pool metadata space with lvextend VG/ThinPoolLV_tmeta.
+.br
+ See "Manually manage free metadata space of a thin pool LV".
+
+4. Check and repair file system with fsck.
+
+
.SS Zeroing
\&
10 years, 1 month
master - man: add lvmthin man page
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=7b11b1b4b56d7a...
Commit: 7b11b1b4b56d7a3bcf0e70d1b883a4c5aaf0cecd
Parent: c2876ee1c9086bd4c0a8e898e05919cfcb6aded7
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Mar 13 16:19:05 2014 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Apr 1 16:04:08 2014 -0500
man: add lvmthin man page
---
man/lvmthin.7.in | 874 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 874 insertions(+), 0 deletions(-)
diff --git a/man/lvmthin.7.in b/man/lvmthin.7.in
new file mode 100644
index 0000000..3ecec61
--- /dev/null
+++ b/man/lvmthin.7.in
@@ -0,0 +1,874 @@
+.TH "LVMTHIN" "7" "LVM TOOLS #VERSION#" "Red Hat, Inc" "\""
+
+.SH NAME
+lvmthin - LVM thin provisioning
+
+.SH DESCRIPTION
+
+Blocks in a standard logical volume are allocated when the LV is created,
+but blocks in a thin provisioned logical volume are allocated as they are
+written. Because of this, a thin provisioned LV is given a virtual size,
+and can then be much larger than physically available storage. The amount
+of physical storage provided for thin provisioned LVs can be increased
+later as the need arises.
+
+Blocks in a standard LV are allocated (during creation) from the VG, but
+blocks in a thin LV are allocated (during use) from a special "thin pool
+LV". The thin pool LV contains blocks of physical storage, and blocks in
+thin LVs just reference blocks in the thin pool LV.
+
+A thin pool LV must be created before thin LV's can be created within it.
+A thin pool LV is created by combining two standard LV's: a large data LV
+that will hold blocks for thin LVs, and a metadata LV that will hold
+metadata. The metadata tracks which data blocks belong to each thin LV.
+
+Snapshots of thin LVs are efficient because the data blocks common to a
+thin LV and its snapshot are shared. Snapshots may be taken of thin LV's
+or of other thin snapshots. Blocks common to recursive snapshots are also
+shared in the thin pool. There is no limit to or degradation from
+sequences of snapshots.
+
+As thin LV's or snapshot LV's are written to, they consume data blocks in
+the thin pool. As free data blocks in the pool decrease, more free blocks
+may need to be supplied. This is done by extending the thin pool data LV
+with additional physical space from the VG. Removing thin LVs or
+snapshots from the thin pool can also free blocks in the thin pool.
+However, removing LVs is not always an effective way of freeing space in a
+thin pool because the amount is limited to the number of blocks not shared
+with other LVs in the pool.
+
+Incremental block allocation from thin pools can cause thin LVs to become
+fragmented. Standard LVs generally avoid this problem by allocating all
+the blocks at once during creation.
+
+
+.SH Thin Terms
+
+.TP
+ThinDataLV
+.br
+thin data LV
+.br
+large LV created in a VG
+.br
+used by thin pool to store ThinLV blocks
+
+.TP
+ThinMetaLV
+.br
+thin metadata LV
+.br
+small LV created in a VG
+.br
+used by thin pool to track data block usage
+
+.TP
+ThinPoolLV
+.br
+thin pool LV
+.br
+combination of ThinDataLV and ThinMetaLV
+.br
+contains ThinLVs and SnapLVs
+
+.TP
+ThinLV
+.br
+thin LV
+.br
+created from ThinPoolLV
+.br
+appears blank after creation
+
+.TP
+SnapLV
+.br
+snapshot LV
+.br
+created from ThinPoolLV
+.br
+appears as a snapshot of another LV after creation
+
+
+
+.SH Thin Usage
+
+The primary method for using lvm thin provisioning:
+
+.nf
+1. create ThinDataLV
+
+ Create an LV that will hold thin pool data.
+
+ Command
+ lvcreate -n ThinDataLV -L LargeSize VG
+
+ Example
+ # lvcreate -n pool0 -L 100G vg
+
+2. create ThinMetaLV
+
+ Create an LV that will hold thin pool metadata.
+
+ Command
+ lvcreate -n ThinMetaLV -L SmallSize VG
+
+ Example
+ # lvcreate -n pool0meta -L 1G vg
+
+ # lvs
+ pool0 vg -wi-a----- 10.00g
+ pool0meta vg -wi-a----- 1.00g
+
+3. create ThinPoolLV
+
+ Combine the data and metadata LVs into a thin pool LV.
+ ThinDataLV is renamed to hidden ThinPoolLV_tdata.
+ ThinMetaLV is renamed to hidden ThinPoolLV_tmeta.
+ The new ThinPoolLV takes the previous name of ThinDataLV.
+
+ Command
+ lvconvert --thinpool VG/ThinDataLV --poolmetadata VG/ThinMetaLV
+
+ Example
+ # lvconvert --thinpool vg/pool0 --poolmetadata vg/pool0meta
+
+ # lvs vg/pool0
+ LV VG Attr LSize Pool Origin Data%
+ pool0 vg twi-a-tz-- 10.00g 0.00
+
+ # lvs -a
+ pool0 vg twi-a-tz-- 10.00g
+ [pool0_tdata] vg Twi-ao---- 10.00g
+ [pool0_tmeta] vg ewi-ao---- 1.00g
+
+4. create ThinLV
+
+ Create a new thin LV from the thin pool LV.
+ The thin LV is created with a virtual size.
+ Multiple new thin LV's may be created in the thin pool.
+ Thin LV names must be unique in the VG.
+ The thinpool argument specifies which thin pool will
+ contain the ThinLV.
+
+ Command
+ lvcreate --type thin -n ThinLV -V VirtualSize --thinpool VG/ThinPoolLV
+
+ Example
+ Create a thin LV in a thin pool:
+ # lvcreate --type thin -n thin1 -V 1T --thinpool vg/pool0
+
+ Create another thin LV in the same thin pool:
+ # lvcreate --type thin -n thin2 -V 1T --thinpool vg/pool0
+
+ # lvs vg/thin1 vg/thin2
+ LV VG Attr LSize Pool Origin Data%
+ thin1 vg Vwi-a-tz-- 1.00t pool0 0.00
+ thin2 vg Vwi-a-tz-- 1.00t pool0 0.00
+
+5. create SnapLV
+
+ Create snapshots of an existing ThinLV or SnapLV.
+
+ Command
+ lvcreate --type thin -n SnapLV -s ThinLV --thinpool VG/ThinPoolLV
+ lvcreate --type thin -n SnapLV -s PrevSnapLV --thinpool VG/ThinPoolLV
+
+ Example
+ Create first snapshot of an existing ThinLV:
+ # lvcreate --type thin -n thin1s1 -s thin1 --thinpool vg/pool0
+
+ Create second snapshot of the same ThinLV:
+ # lvcreate --type thin -n thin1s2 -s thin1 --thinpool vg/pool0
+
+ Create a snapshot of the first snapshot:
+ # lvcreate --type thin -n thin1s1s1 -s thin1s1 --thinpool vg/pool0
+
+ # lvs vg/thin1s1 vg/thin1s2 vg/thin1s1s1
+ LV VG Attr LSize Pool Origin
+ thin1s1 vg Vwi---tz-k 1.00t pool0 thin1
+ thin1s2 vg Vwi---tz-k 1.00t pool0 thin1
+ thin1s1s1 vg Vwi---tz-k 1.00t pool0 thin1s1
+
+6. activate SnapLV
+
+ Thin snapshots are created with the persistent "activation skip"
+ flag, indicated by the "k" attribute. Use -K with lvchange
+ or vgchange to activate thin snapshots with the "k" attribute.
+
+ Command
+ lvchange -ay -K VG/SnapLV
+
+ Example
+ # lvchange -ay -K vg/thin1s1
+
+ # lvs vg/thin1s1
+ thin1s1 vg Vwi-a-tz-k 1.00t pool0 thin1
+.fi
+
+
+.SH Thin Topics
+
+Specify devices for data and metadata LVs
+.br
+Tolerate device failures using raid
+.br
+Spare metadata LV
+.br
+Metadata check and repair
+.br
+Automatic pool metadata LV
+.br
+Activation of thin snapshots
+.br
+Removing thin pool LV's, thin LV's and snapshots
+.br
+Manually manage free data space of thin pool LV
+.br
+Manually manage free metadata space of a thin pool LV
+.br
+Using fstrim to increase free space in a thin pool LV
+.br
+Automatically extend thin pool LV
+.br
+Zeroing
+.br
+Discard
+.br
+Chunk size
+.br
+Size of pool metadata LV
+.br
+Create a thin snapshot of an external, read only LV
+.br
+Convert a standard LV to a thin LV with an external origin
+.br
+Single step thin pool LV creation
+.br
+Single step thin pool LV and thin LV creation
+.br
+
+\&
+
+.SS Specify devices for data and metadata LVs
+
+\&
+
+The data and metadata LVs in a thin pool are best created on
+separate physical devices. To do that, specify the device name(s)
+at the end of the lvcreate line. It can be especially helpful
+to use fast devices for the metadata LV.
+
+.nf
+lvcreate -n ThinDataLV -L LargeSize VG LargePV
+lvcreate -n ThinMetaLV -L SmallSize VG SmallPV
+lvconvert --thinpool VG/ThinDataLV --poolmetadata VG/ThinMetaLV
+
+Example
+# lvcreate -n pool0 -L 100G vg /dev/sdA
+# lvcreate -n pool0meta -L 1G vg /dev/sdB
+# lvconvert --thinpool vg/pool0 --poolmetadata vg/pool0meta
+.fi
+
+See lvm.conf thin_pool_metadata_require_separate_pvs to set
+default PV usage for thin pool creation.
+
+
+.SS Tolerate device failures using raid
+
+\&
+
+To tolerate device failures, use raid for the pool data LV and
+pool metadata LV. This is especially recommended for pool metadata LVs.
+
+.nf
+lvcreate --type raid1 -m 1 -n ThinMetaLV -L SmallSize VG PVA PVB
+lvcreate --type raid1 -m 1 -n ThinDataLV -L LargeSize VG PVC PVD
+lvconvert --thinpool VG/ThinDataLV --poolmetadata VG/ThinMetaLV
+
+Example
+# lvcreate --type raid1 -m 1 -n pool0 -L 100G vg /dev/sdA /dev/sdB
+# lvcreate --type raid1 -m 1 -n pool0meta -L 1G vg /dev/sdC /dev/sdD
+# lvconvert --thinpool vg/pool0 --poolmetadata vg/pool0meta
+.fi
+
+
+.SS Spare metadata LV
+
+\&
+
+The first time a thin pool LV is created, lvm will create a spare
+metadata LV in the VG. This behavior can be controlled with the
+option --poolmetadataspare y|n. (Future thin pool creations will
+also attempt to create the pmspare LV if none exists.)
+
+To create the pmspare ("pool metadata spare") LV, lvm first creates
+an LV with a default name, e.g. lvol0, and then converts this LV to
+a hidden LV with the _pmspare suffix, e.g. lvol0_pmspare.
+
+One pmspare LV is kept in a VG to be used for any thin pool.
+
+The pmspare LV cannot be created explicitly, but may be removed
+explicitly.
+
+.nf
+Example
+# lvcreate -n pool0 -L 10G vg
+# lvcreate -n pool0meta -L 10G vg
+# lvconvert --thinpool vg/pool0 --poolmetadata vg/pool0meta
+
+# lvs -a
+[lvol0_pmspare] vg ewi------- 10.00g
+pool0 vg twi---tz-- 10.00g
+[pool0_tdata] vg Twi------- 10.00g
+[pool0_tmeta] vg ewi------- 1.00g
+.fi
+
+The "Metadata check and repair" section describes the use of
+the pmspare LV.
+
+
+.SS Metadata check and repair
+
+\&
+
+If thin pool metadata is damaged, it may be repairable.
+Checking and repairing thin pool metadata is analagous to
+running fsck on a file system.
+
+When a thin pool LV is activated, lvm runs the thin_check command
+to check the correctness of the metadata on the pool metadata LV.
+
+To disable the thin_check step, set lvm.conf thin_check_executable to
+an empty string (""). This is not recommended.
+
+To set options for the thin_check command, set lvm.conf thin_check_options.
+
+If the thin_check command finds a problem with the metadata,
+the thin pool LV is not activated, and the thin pool metadata should
+be repaired.
+
+Command to repair a thin pool LV:
+.nf
+lvconvert --repair VG/ThinPoolLV
+.fi
+
+Repair performs the following steps:
+
+1. Creates a new, repaired copy of the metadata.
+.br
+lvconvert runs the thin_repair command to read damaged metadata
+from the existing pool metadata LV, and writes a new repaired
+copy to the VG's pmspare LV.
+
+2. Replaces the thin pool metadata LV.
+.br
+If step 1 is successful, the thin pool metadata LV is replaced
+with the pmspare LV containing the corrected metadata.
+The previous thin pool metadata LV, containing the damaged metadata,
+becomes visible with the new name ThinPoolLV_tmetaN (where N is 0,1,...).
+
+If the repair works, the thin pool LV and its thin LVs can be activated,
+and the LV containing the damaged thin pool metadata can be removed.
+It may be useful to move the new metadata LV (previously pmspare) to a
+better PV.
+
+If the repair does not work, the thin pool LV and its thin LVs are lost.
+
+If metadata is manually restored with thin_repair directly,
+the pool metadata LV can be manually swapped with another LV
+containing new metadata:
+
+.nf
+lvconvert --thinpool VG/ThinPoolLV --poolmetadata VG/NewThinMetaLV
+.fi
+
+The path to thin_check, thin_dump and thin_repair commands
+can be set in lvm.conf.
+
+
+.SS Automatic pool metadata LV
+
+\&
+
+A thin data LV can be converted to a thin pool LV without
+specifying a thin pool metadata LV. LVM will automatically
+create a metadata LV from the same VG.
+
+.nf
+lvcreate -n ThinDataLV -L LargeSize VG
+lvconvert --thinpool VG/ThinDataLV
+
+Example
+# lvcreate -n pool0 -L 10G vg
+# lvconvert --thinpool vg/pool0
+
+# lvs -a
+pool0 vg twi-a-tz-- 10.00g
+[pool0_tdata] vg Twi-ao---- 10.00g
+[pool0_tmeta] vg ewi-ao---- 16.00m
+.fi
+
+
+.SS Activation of thin snapshots
+
+\&
+
+When a thin snapshot LV is created, it is by default given the
+"activation skip" flag. This flag is indicated by the "k" attribute
+displayed by lvs:
+
+.nf
+# lvs vg/thin1s1
+LV VG Attr LSize Pool Origin
+thin1s1 vg Vwi---tz-k 1.00t pool0 thin1
+.fi
+
+This flag causes the snapshot LV to be skipped, i.e. not activated,
+by normal activation commands. The skipping behavior does not
+apply to deactivation commands.
+
+A snapshot LV with the "k" attribute can be activated using
+the -K (or --ignoreactivationskip) option in addition to the
+standard -ay (or --activate y) option.
+
+Command to activate a thin snapshot LV:
+.nf
+lvchange -ay -K VG/SnapLV
+.fi
+
+The persistent "activation skip" flag can be turned off during
+lvcreate, or later with lvchange using the -kn
+(or --setactivationskip n) option.
+It can be turned on again with -ky (or --setactivationskip y).
+
+When the "activation skip" flag is removed, normal activation
+commands will activate the LV, and the -K activation option is
+not needed.
+
+Command to create snapshot LV without the activation skip flag:
+.nf
+lvcreate --type thin -n SnapLV -kn -s ThinLV --thinpool VG/ThinPoolLV
+.fi
+
+Command to remove the activation skip flag from a snapshot LV:
+.nf
+lvchange -kn VG/SnapLV
+.fi
+
+See lvm.conf auto_set_activation_skip to set default usage of
+activation skip.
+
+
+.SS Removing thin pool LV's, thin LV's and snapshots
+
+\&
+
+Removing a thin LV and its related snapshots returns the blocks it
+used to the thin pool LV. These blocks will be reused for other
+thin LVs and snapshots.
+
+Removing a thin pool LV removes both the data LV and metadata LV
+and returns the space to the VG.
+
+lvremove of thin pool LV's, thin LV's and snapshots cannot be
+reversed with vgcfgrestore.
+
+vgcfgbackup does not back up thin pool metadata.
+
+
+.SS Manually manage free data space of thin pool LV
+
+\&
+
+The available free space in a thin pool LV can be displayed
+with the lvs command. Free space can be added by extending
+the thin pool LV.
+
+.nf
+Example
+
+1. A thin pool LV is using 26.96% of its data blocks.
+# lvs
+LV VG Attr LSize Pool Origin Data%
+pool0 vg twi-a-tz-- 10.00g 26.96
+
+2. Double the amount of physical space in the thin pool LV.
+# lvextend -L+10G vg/pool0
+
+3. The percentage of used data blocks is half the previous value.
+# lvs
+LV VG Attr LSize Pool Origin Data%
+pool0 vg twi-a-tz-- 20.00g 13.48
+.fi
+
+Other methods of increasing free data space in a thin pool LV
+include removing a thin LV and its related snapsots, or running
+fstrim on the file system using a thin LV.
+
+
+.SS Manually manage free metadata space of a thin pool LV
+
+\&
+
+The available metadata space in a thin pool LV can be displayed
+with the lvs -o+metadata_percent command.
+
+Example
+
+1. A thin pool LV is using 12.40% of its metadata blocks.
+.nf
+# lvs -oname,size,data_percent,metadata_percent vg/pool0
+LV LSize Data% Meta%
+pool0 20.00g 13.48 12.40
+.fi
+
+2. Display a thin pool LV with its component thin data LV and thin metadata LV.
+.nf
+# lvs -a -oname,attr,size vg
+LV Attr LSize
+pool0 twi-a-tz-- 20.00g
+[pool0_tdata] Twi-ao---- 20.00g
+[pool0_tmeta] ewi-ao---- 12.00m
+.fi
+
+3. Double the amount of physical space in the thin metadata LV.
+.nf
+# lvextend -L+12M vg/pool0_tmeta
+.fi
+
+4. The percentage of used metadata blocks is half the previous value.
+.nf
+# lvs -a -oname,size,data_percent,metadata_percent vg
+LV LSize Data% Meta%
+pool0 20.00g 13.48 6.20
+[pool0_tdata] 20.00g
+[pool0_tmeta] 24.00m
+.fi
+
+
+.SS Using fstrim to increase free space in a thin pool LV
+
+\&
+
+Removing files in a file system on top of a thin LV does not
+generally add free space back to the thin pool. Manually running
+the fstrim command can return space back to the thin pool that had
+been used by removed files. fstrim uses discards and will not work
+if the thin pool LV has discards mode set to ignore.
+
+Example
+
+A thin pool has 10G of physical data space, and a thin LV has a virtual
+size of 100G. Writing a 1G file to the file system reduces the
+free space in the thin pool by 10% and increases the virtual usage
+of the file system by 1%. Removing the 1G file restores the virtual
+1% to the file system, but does not restore the physical 10% to the
+thin pool. The fstrim command restores the physical space to the thin pool.
+
+.nf
+# lvs -a -oname,attr,size,pool_lv,origin,data_percent,metadata_percent vg
+LV Attr LSize Pool Origin Data% Meta%
+pool0 twi-a-tz-- 10.00g 47.01 21.03
+thin1 Vwi-aotz-- 100.00g pool0 2.70
+
+# df -h /mnt/X
+Filesystem Size Used Avail Use% Mounted on
+/dev/mapper/vg-thin1 99G 1.1G 93G 2% /mnt/X
+
+# dd if=/dev/zero of=/mnt/X/1Gfile bs=4096 count=262144; sync
+
+# lvs
+pool0 vg twi-a-tz-- 10.00g 57.01 25.26
+thin1 vg Vwi-aotz-- 100.00g pool0 3.70
+
+# df -h /mnt/X
+/dev/mapper/vg-thin1 99G 2.1G 92G 3% /mnt/X
+
+# rm /mnt/X/1Gfile
+
+# lvs
+pool0 vg twi-a-tz-- 10.00g 57.01 25.26
+thin1 vg Vwi-aotz-- 100.00g pool0 3.70
+
+# df -h /mnt/X
+/dev/mapper/vg-thin1 99G 1.1G 93G 2% /mnt/X
+
+# fstrim -v /mnt/X
+
+# lvs
+pool0 vg twi-a-tz-- 10.00g 47.01 21.03
+thin1 vg Vwi-aotz-- 100.00g pool0 2.70
+.fi
+
+
+.SS Automatically extend thin pool LV
+
+\&
+
+An lvm daemon (dmeventd) will by default monitor the data usage of
+thin pool LVs and extend them when the usage reaches a certain level.
+The necessary free space must exist in the VG to extend the thin pool
+LVs.
+
+Command to enable or disable the monitoring and automatic extension
+of an existing thin pool LV:
+
+.nf
+lvchange --monitor {y|n} VG/ThinPoolLV
+.fi
+
+The lvm.conf thin_pool_autoextend_threshold and thin_pool_autoextend_percent
+options define the autoextend behavior.
+
+thin_pool_autoextend_threshold is a percentage value that defines when
+the thin pool LV should be extended. Setting this to 100 disables
+automatic extention. The minimum value is 50.
+
+thin_pool_autoextend_percent defines how much extra data space should
+be added to the thin pool, in percent of its current size.
+
+Warnings are emitted through syslog when the use of a pool reaches 80%,
+85%, 90% and 95%.
+
+Example
+
+If thin_pool_autoextend_threshold is 70 and thin_pool_autoextend_percent is 20,
+whenever a pool exceeds 70% usage, it will be extended by another 20%.
+For a 1G pool, using 700M will trigger a resize to 1.2G. When the usage exceeds
+840M, the pool will be extended to 1.44G, and so on.
+
+
+.SS Zeroing
+
+\&
+
+When a thin pool provisions a new data block for a thin LV, the
+new block is first overwritten with zeros. The zeroing mode is
+indicated by the "z" attribute displayed by lvs. The option -Z
+(or --zero) can be added to commands to specify the zeroing mode.
+
+Command to set the zeroing mode when creating a thin pool LV:
+.nf
+lvconvert -Z{y|n} --thinpool VG/ThinDataLV --poolmetadata VG/ThinMetaLV
+.fi
+
+Command to change the zeroing mode of an existing thin pool LV:
+.nf
+lvchange -Z{y|n} VG/ThinPoolLV
+.fi
+
+If zeroing mode is changed from "n" to "y", previously provisioned
+blocks are not zeroed.
+
+Provisioning of large zeroed chunks impacts performance.
+
+See lvm.conf thin_pool_zero to set default zeroing mode.
+
+
+.SS Discard
+
+\&
+
+The discard behavior of a thin pool LV determines how discard requests
+are handled. Possible discard behaviors:
+
+ignore: Ignore any discards that are received.
+
+nopassdown: Process any discards in the thin pool itself and allow
+the no longer needed extends to be overwritten by new data.
+
+passdown: Process discards in the thin pool (as with nopassdown), and
+pass the discards down the the underlying device. This is the default
+mode.
+
+Command to display the current discard mode of a thin pool LV:
+.nf
+lvs -o+discards VG/ThinPoolLV
+.fi
+
+Command to set the discard mode when creating a thin pool LV:
+.nf
+lvconvert --discards {ignore|nopassdown|passdown}
+ --thinpool VG/ThinDataLV --poolmetadata VG/ThinMetaLV
+.fi
+
+Command to change the discard mode of an existing thin pool LV:
+.nf
+lvchange --discards {ignore|nopassdown|passdown} VG/ThinPoolLV
+.fi
+
+.nf
+Example
+# lvs -o name,discards vg/pool0
+pool0 passdown
+
+# lvchange --discards ignore vg/pool0
+.fi
+
+See lvm.conf thin_pool_discards to set the default discards mode.
+
+
+.SS Chunk size
+
+\&
+
+The size of data blocks managed by a thin pool can be specified with
+the --chunksize option when the thin pool LV is created. The default
+unit is kilobytes and the default value is 64KiB. The value must be a
+power of two between 4KiB and 1GiB.
+
+When a thin pool is used primarily for the thin provisioning feature,
+a larger value is optimal. To optimize for a lot of snapshotting,
+a smaller value reduces copying time and consumes less space.
+
+Command to display the thin pool LV chunk size:
+.nf
+lvs -o+chunksize VG/ThinPoolLV
+
+Example
+# lvs -o name,chunksize
+pool0 64.00k
+.fi
+
+See lvm.conf thin_pool_chunk_size to set the default chunk size.
+
+
+.SS Size of pool metadata LV
+
+\&
+
+The amount of thin metadata depends on how many blocks are shared
+between thin LVs (i.e. through snapshots). A thin pool with many
+snapshots may need a larger metadata LV.
+
+The range of supported metadata LV sizes is 2MiB to 16GiB.
+.br
+The default size is estimated with the formula:
+.br
+ThinPoolLVSize / ThinPoolLVChunkSize * 64b.
+
+When creating a thin metadata LV explicitly, the size is specified
+in the lvcreate command. When a command automatically creates a
+thin metadata LV, the --poolmetadatasize option can be used specify
+a non-default size. The default unit is megabytes.
+
+
+.SS Create a thin snapshot of an external, read only LV
+
+\&
+
+Thin snapshots are typically taken of other thin LVs or other
+thin snapshot LVs within the same thin pool. It is also possible
+to take thin snapshots of external, read only LVs. Writes to the
+snapshot are stored in the thin pool, and the external LV is used
+to read unwritten parts of the thin snapshot.
+
+.nf
+lvcreate --type thin -n SnapLV -s VG/ExternalOriginLV
+ --thinpool VG/ThinPoolLV
+
+Example
+# lvchange -an vg/lve
+# lvchange --permission r vg/lve
+# lvcreate --type thin -n snaplve -s vg/lve --thinpool vg/pool0
+
+# lvs vg/lve vg/snaplve
+LV VG Attr LSize Pool Origin Data%
+lve vg ori------- 10.00g
+snaplve vg Vwi-a-tz-- 10.00g pool0 lve 0.00
+.fi
+
+
+.SS Convert a standard LV to a thin LV with an external origin
+
+\&
+
+A new thin LV can be created and given the name of an existing
+standard LV. At the same time, the existing LV is converted to a
+read only external LV with a new name. Unwritten portions of the
+thin LV are read from the external LV.
+The new name given to the existing LV can be specified with
+--originname, otherwise the existing LV will be given a default
+name, e.g. lvol#.
+
+Convert ExampleLV into a read only external LV with the new name
+NewExternalOriginLV, and create a new thin LV that is given the previous
+name of ExampleLV.
+
+.nf
+lvconvert --type thin --thinpool VG/ThinPoolLV
+ --originname NewExternalOriginLV --thin VG/ExampleLV
+
+Example
+# lvcreate -n lv_example -L 10G vg
+
+# lvs
+lv_example vg -wi-a----- 10.00g
+
+# lvconvert --type thin --thinpool vg/pool0
+ --originname lv_external --thin vg/lv_example
+
+# lvs
+LV VG Attr LSize Pool Origin
+lv_example vg Vwi-a-tz-- 10.00g pool0 lv_external
+lv_external vg ori------- 10.00g
+.fi
+
+
+.SS Single step thin pool LV creation
+
+\&
+
+A thin pool LV can be created with a single lvcreate command,
+rather than using lvconvert on existing LVs.
+This one command creates a thin data LV, a thin metadata LV,
+and combines the two into a thin pool LV.
+
+.nf
+lvcreate -L LargeSize --thinpool VG/ThinPoolLV
+
+Example
+# lvcreate -l1 --thinpool vg/pool0
+
+# lvs vg/pool0
+LV VG Attr LSize Pool Origin Data%
+pool0 vg twi-a-tz-- 8.00m 0.00
+
+# lvs -a
+pool0 vg twi-a-tz-- 8.00m
+[pool0_tdata] vg Twi-ao---- 8.00m
+[pool0_tmeta] vg ewi-ao---- 8.00m
+.fi
+
+
+.SS Single step thin pool LV and thin LV creation
+
+\&
+
+A thin pool LV and a thin LV can be created with a single
+lvcreate command. This one command creates a thin data LV,
+a thin metadata LV, combines the two into a thin pool LV,
+and creates a thin LV in the new pool.
+.br
+-L LargeSize specifies the physical size of the thin pool LV.
+.br
+-V VirtualSize specifies the virtual size of the thin LV.
+
+.nf
+lvcreate -L LargeSize -V VirtualSize -n ThinLV --thinpool VG/ThinPoolLV
+
+Equivalent to:
+lvcreate -L LargeSize --thinpool VG/ThinPoolLV
+lvcreate --type thin -n ThinLV -V VirtualSize --thinpool VG/ThinPoolLV
+
+Example
+# lvcreate -L8M -V2G -n thin1 --thinpool vg/pool0
+
+# lvs -a
+pool0 vg twi-a-tz-- 8.00m
+[pool0_tdata] vg Twi-ao---- 8.00m
+[pool0_tmeta] vg ewi-ao---- 8.00m
+thin1 vg Vwi-a-tz-- 2.00g pool0
+.fi
+
10 years, 1 month
master - cache: enforce local exlusive activation
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=c2876ee1c9086b...
Commit: c2876ee1c9086bd4c0a8e898e05919cfcb6aded7
Parent: c95d43b28c5f89e1d96f2b16805ecd74eb4b02fb
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Apr 1 21:29:28 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Apr 1 21:29:28 2014 +0200
cache: enforce local exlusive activation
For cache flushing local exlusive activation is needed.
---
lib/metadata/cache_manip.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/lib/metadata/cache_manip.c b/lib/metadata/cache_manip.c
index b71e9e0..9a055e8 100644
--- a/lib/metadata/cache_manip.c
+++ b/lib/metadata/cache_manip.c
@@ -191,8 +191,9 @@ int lv_cache_remove(struct logical_volume *cache_lv)
}
/* Active volume is needed (writeback only?) */
- if (!activate_lv(cache_lv->vg->cmd, cache_lv)) {
- log_error("Failed to active cache %s.", cache_lv->name);
+ if (!lv_is_active_locally(cache_lv) &&
+ !activate_lv_excl_local(cache_lv->vg->cmd, cache_lv)) {
+ log_error("Failed to active cache locally %s.", cache_lv->name);
return 0;
}
10 years, 1 month