TL;DR :
How can I extend the Thin-Pool if I'm not using LVM but Device Mapper itself directly?
Detailed version:
As far as I know,
when we create a thin-pool by dmsetup
, we can set a low_water_mark;
once the watermark is reached, a dmevent will be sent and the guard-daemon could extend the pool right away.
However, I was unable to find the way to perform such the task in trivial way; and I have no clue how it could be achieved.
Furthermore,
I dig into dm-thin.c
and find out there's a function named maybe_resize_data_dev
,
which will enlarge data device by r = dm_pool_resize_data_dev(pool->pmd, data_size)
if the remaining space is not enough.
Yet at the meanwhile, Device Mapper itself prevent you from doing that by verifying the status of data device:
if (le32_to_cpu(disk_super->data_block_size) != pmd->data_block_size) {
/* Verify the data block size hasn't changed */
if (le32_to_cpu(disk_super->data_block_size) != pmd->data_block_size) {
DMERR("changing the data block size (from %u to %llu) is not supported",
le32_to_cpu(disk_super->data_block_size),
(unsigned long long)pmd->data_block_size);
r = -EINVAL;
goto bad_unlock_sblock;
}
which is patched in commit 9aec862 , titled dm thin metadata: do not allow the data block size to change
.
The codes are quoted out from drivers/md/dm-thin.c
(ref-1) and drivers/md/dm-thin-metadata.c
(ref-2)
And What confuse me more is that I happened to know that it could be done if the pool is created by LVM utilities ; i.e.
lvextend -L+100M vg001/mythinpool
(from the Guide published by Red Hat) , which makes me wonder how it is achieved to do so.
ref-1 : drivers/md/dm-thin.c#L3246-L3292
ref-2 : drivers/md/dm-thin-metadata.c#L617-L621
Sorry, I cannot post more than two links because I'm too noob .