| 83 | == resize == |
| 84 | * 用語については -> [http://man7.org/linux/man-pages/man7/lvmthin.7.html lvmthin(7) - Linux manual page] |
| 85 | * ArchLinux 4.0.1-1-ARCH, lvm2 2.02.116-1 にて実験 |
| 86 | |
| 87 | === lvextend === |
| 88 | * ThinDataLV, ThinMetaLVとも、extendについては問題なく行える |
| 89 | |
| 90 | 1. ThinPoolLV, ThinLVの作成 |
| 91 | * # lvcreate -L 2G -T --thinpool pool0 vg |
| 92 | {{{ |
| 93 | Logical volume "pool0" created. |
| 94 | }}} |
| 95 | * # lvcreate -T vg/pool0 -V 3G -n lv1 |
| 96 | {{{ |
| 97 | Logical volume "lv1" created. |
| 98 | }}} |
| 99 | * # lvs -a --units 4m |
| 100 | {{{ |
| 101 | LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert |
| 102 | lv1 vg Vwi-a-tz-- 768.00U pool0 0.00 |
| 103 | [lvol0_pmspare] vg ewi------- 1.00U |
| 104 | pool0 vg twi-aotz-- 512.00U 0.00 1.17 |
| 105 | [pool0_tdata] vg Twi-ao---- 512.00U |
| 106 | [pool0_tmeta] vg ewi-ao---- 1.00U |
| 107 | }}} |
| 108 | 2. データの書き込み |
| 109 | * # mkfs.ext4 /dev/vg/lv1 |
| 110 | * # mount /dev/vg/lv1 /data/lv1/ |
| 111 | * # dd if=/dev/urandom of=/data/lv1/tmp bs=1024 count=1024000 |
| 112 | * # sha1sum -b /data/lv1/tmp > /tmp/sha1 |
| 113 | * # lvs -a --units 4m |
| 114 | {{{ |
| 115 | LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert |
| 116 | lv1 vg Vwi-aotz-- 768.00U pool0 36.24 |
| 117 | [lvol0_pmspare] vg ewi------- 1.00U |
| 118 | pool0 vg twi-aotz-- 512.00U 54.37 14.65 |
| 119 | [pool0_tdata] vg Twi-ao---- 512.00U |
| 120 | [pool0_tmeta] vg ewi-ao---- 1.00U |
| 121 | }}} |
| 122 | 3. lvextend ThinLV |
| 123 | * # lvextend -L+2G /dev/vg/lv1 |
| 124 | {{{ |
| 125 | Size of logical volume vg/lv1 changed from 3.00 GiB (768 extents) to 5.00 GiB (1280 extents). |
| 126 | Logical volume lv1 successfully resized |
| 127 | }}} |
| 128 | * # lvs -a --units 4m |
| 129 | {{{ |
| 130 | LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert |
| 131 | lv1 vg Vwi-aotz-- 1280.00U pool0 21.75 |
| 132 | [lvol0_pmspare] vg ewi------- 1.00U |
| 133 | pool0 vg twi-aotz-- 512.00U 54.37 14.65 |
| 134 | [pool0_tdata] vg Twi-ao---- 512.00U |
| 135 | [pool0_tmeta] vg ewi-ao---- 1.00U |
| 136 | }}} |
| 137 | 4. lvextend ThinPoolLV |
| 138 | * # lvextend -l+1 /dev/vg/pool0 |
| 139 | {{{ |
| 140 | Size of logical volume vg/pool0_tdata changed from 2.00 GiB (512 extents) to 2.00 GiB (513 extents). |
| 141 | Logical volume pool0 successfully resized |
| 142 | }}} |
| 143 | * # lvs -a --units 4m |
| 144 | {{{ |
| 145 | LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert |
| 146 | lv1 vg Vwi-aotz-- 1280.00U pool0 21.75 |
| 147 | [lvol0_pmspare] vg ewi------- 1.00U |
| 148 | pool0 vg twi-aotz-- 513.00U 54.26 14.65 |
| 149 | [pool0_tdata] vg Twi-ao---- 513.00U |
| 150 | [pool0_tmeta] vg ewi-ao---- 1.00U |
| 151 | }}} |
| 152 | 5. ThinDataLVを指定しての拡張は出来ない |
| 153 | * # lvextend -l+100 /dev/vg/pool0_tdata |
| 154 | {{{ |
| 155 | Can't resize internal logical volume pool0_tdata |
| 156 | Run `lvextend --help' for more information. |
| 157 | }}} |
| 158 | * # lvextend -l+100 /dev/vg/pool0 |
| 159 | {{{ |
| 160 | Size of logical volume vg/pool0_tdata changed from 2.00 GiB (513 extents) to 2.39 GiB (613 extents). |
| 161 | Logical volume pool0 successfully resized |
| 162 | }}} |
| 163 | {{{ |
| 164 | pool0 vg twi-aotz-- 613.00U 45.41 14.65 |
| 165 | }}} |
| 166 | 6. lvextend ThinMetaLV |
| 167 | * # lvextend -l+100 /dev/vg/pool0_tmeta |
| 168 | {{{ |
| 169 | Size of logical volume vg/pool0_tmeta changed from 4.00 MiB (1 extents) to 404.00 MiB (101 extents). |
| 170 | Logical volume pool0_tmeta successfully resized |
| 171 | }}} |
| 172 | * # lvs -a --units 4m |
| 173 | {{{ |
| 174 | LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert |
| 175 | lv1 vg Vwi-aotz-- 1280.00U pool0 21.75 |
| 176 | [lvol0_pmspare] vg ewi------- 1.00U |
| 177 | pool0 vg twi-aotz-- 613.00U 45.41 0.15 |
| 178 | [pool0_tdata] vg Twi-ao---- 613.00U |
| 179 | [pool0_tmeta] vg ewi-ao---- 101.00U |
| 180 | }}} |
| 181 | * # sha1sum -c /tmp/sha1 |
| 182 | {{{ |
| 183 | /data/lv1/tmp: OK |
| 184 | }}} |
| 185 | |
| 186 | === lvreduce === |
| 187 | * Thin Poolのlvreduceは現在は行えない |
| 188 | |
| 189 | * metadataは一見縮小できるように見えるが、問題が起きる |
| 190 | * # lvs -a --units 4m |
| 191 | {{{ |
| 192 | LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert |
| 193 | lv1 vg Vwi-a-tz-- 1280.00U pool0 21.75 |
| 194 | [lvol0_pmspare] vg ewi------- 1.00U |
| 195 | pool0 vg twi-aotz-- 613.00U 45.41 0.15 |
| 196 | [pool0_tdata] vg Twi-ao---- 613.00U |
| 197 | [pool0_tmeta] vg ewi-ao---- 101.00U |
| 198 | }}} |
| 199 | * # umount /data/lv1 |
| 200 | * # lvchange -an /dev/vg/lv1 |
| 201 | * # lvchange -an /dev/vg/pool0 |
| 202 | * # lvs -a --units 4m |
| 203 | {{{ |
| 204 | LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert |
| 205 | lv1 vg Vwi---tz-- 1280.00U pool0 |
| 206 | [lvol0_pmspare] vg ewi------- 1.00U |
| 207 | pool0 vg twi---tz-- 613.00U |
| 208 | [pool0_tdata] vg Twi------- 613.00U |
| 209 | [pool0_tmeta] vg ewi------- 101.00U |
| 210 | }}} |
| 211 | * LVをinactivateすると、reduce出来るようになるが…… |
| 212 | * # lvreduce -l -1 /dev/vg/pool0_tmeta |
| 213 | {{{ |
| 214 | Size of logical volume vg/pool0_tmeta changed from 404.00 MiB (101 extents) to 400.00 MiB (100 extents). |
| 215 | Logical volume pool0_tmeta successfully resized |
| 216 | }}} |
| 217 | * # lvs -a --units 4m |
| 218 | {{{ |
| 219 | LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert |
| 220 | lv1 vg Vwi---tz-- 1280.00U pool0 |
| 221 | [lvol0_pmspare] vg ewi------- 1.00U |
| 222 | pool0 vg twi---tz-- 613.00U |
| 223 | [pool0_tdata] vg Twi------- 613.00U |
| 224 | [pool0_tmeta] vg ewi------- 100.00U |
| 225 | }}} |
| 226 | * activate出来なくなる |
| 227 | * # lvchange -ay /dev/vg/pool0 |
| 228 | {{{ |
| 229 | device-mapper: resume ioctl on failed: Invalid argument |
| 230 | Unable to resume vg-pool0-tpool (252:2) |
| 231 | }}} |
| 232 | {{{ |
| 233 | May 10 20:31:58 raid-test kernel: device-mapper: thin: 252:2: metadata device (102400 blocks) too small: expected 103424 |
| 234 | May 10 20:31:58 raid-test kernel: device-mapper: table: 252:2: thin-pool: preresume failed, error = -22 |
| 235 | }}} |
| 236 | * # lvchange -ay /dev/vg/lv1 |
| 237 | {{{ |
| 238 | device-mapper: resume ioctl on failed: Invalid argument |
| 239 | Unable to resume vg-pool0-tpool (252:2) |
| 240 | }}} |
| 241 | {{{ |
| 242 | May 10 20:32:30 raid-test kernel: device-mapper: thin: 252:2: metadata device (102400 blocks) too small: expected 103424 |
| 243 | May 10 20:32:30 raid-test kernel: device-mapper: table: 252:2: thin-pool: preresume failed, error = -22 |
| 244 | }}} |
| 245 | * reduceする前より大きなサイズに戻すとactivate出来るようになる。ただし、内部的に不整合などが起きてないかは不明 |
| 246 | * # lvextend -l+1 /dev/vg/pool0_tmeta |
| 247 | {{{ |
| 248 | Size of logical volume vg/pool0_tmeta changed from 400.00 MiB (100 extents) to 404.00 MiB (101 extents). |
| 249 | Logical volume pool0_tmeta successfully resized |
| 250 | }}} |
| 251 | * # lvchange -ay /dev/vg/pool0 |
| 252 | * # lvchange -ay /dev/vg/lv1 |
| 253 | * # lvs -a --units 4m |
| 254 | {{{ |
| 255 | LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert |
| 256 | lv1 vg Vwi-a-tz-- 1280.00U pool0 21.75 |
| 257 | [lvol0_pmspare] vg ewi------- 1.00U |
| 258 | pool0 vg twi-aotz-- 613.00U 45.41 0.15 |
| 259 | [pool0_tdata] vg Twi-ao---- 613.00U |
| 260 | [pool0_tmeta] vg ewi-ao---- 101.00U |
| 261 | }}} |
| 262 | * # mount /dev/vg/lv1 /data/lv1/ |
| 263 | * # sha1sum -c /tmp/sha1 |
| 264 | {{{ |
| 265 | /data/lv1/tmp: OK |
| 266 | }}} |
| 267 | * ThinPoolLV, ThinDataLVが対象だと拒否される |
| 268 | * # lvreduce -l -1 /dev/vg/pool0_tdata |
| 269 | {{{ |
| 270 | Can't resize internal logical volume pool0_tdata |
| 271 | Run `lvreduce --help' for more information. |
| 272 | }}} |
| 273 | * # lvreduce -l -1 /dev/vg/pool0 |
| 274 | {{{ |
| 275 | Thin pool volumes cannot be reduced in size yet. |
| 276 | Run `lvreduce --help' for more information. |
| 277 | }}} |
| 278 | |