... | @@ -41,7 +41,7 @@ setup caching |
... | @@ -41,7 +41,7 @@ setup caching |
|
|
|
|
|
## Disabling / Recovering from a cache failure
|
|
## Disabling / Recovering from a cache failure
|
|
|
|
|
|
If for some reason the cache LV is destroyed or loss (typically by
|
|
If for some reason the cache LV is destroyed or lost (typically by
|
|
naive operator error), it might be possible to restore the original LV
|
|
naive operator error), it might be possible to restore the original LV
|
|
functionality with:
|
|
functionality with:
|
|
|
|
|
... | @@ -192,6 +192,80 @@ Note that the resize process can take a while. Growing an active 20TB |
... | @@ -192,6 +192,80 @@ Note that the resize process can take a while. Growing an active 20TB |
|
partition to 30TB took about 5 minutes, for example. The `-p` flag
|
|
partition to 30TB took about 5 minutes, for example. The `-p` flag
|
|
that could show progress only works in the "offline" procedure (below).
|
|
that could show progress only works in the "offline" procedure (below).
|
|
|
|
|
|
|
|
If the above fails because of the following error:
|
|
|
|
|
|
|
|
```
|
|
|
|
Unable to resize logical volumes of cache type.
|
|
|
|
```
|
|
|
|
|
|
|
|
It's because the logical volume has a cache attached. Follow the above
|
|
|
|
procedure to "uncache" the logical volume and then re-enable the
|
|
|
|
cache.
|
|
|
|
|
|
|
|
WARNING: Make sure you remove the physical volume cache from the
|
|
|
|
volume group before you resize, otherwise the logical volume will be
|
|
|
|
extended to also cover that and re-enabling the cache won't be
|
|
|
|
possible! A typical, incorrect session looks like:
|
|
|
|
|
|
|
|
```
|
|
|
|
root@materculae:~# lvextend -l '+100%FREE' vg_materculae/srv
|
|
|
|
Unable to resize logical volumes of cache type.
|
|
|
|
root@materculae:~# lvconvert --uncache vg_materculae/srv
|
|
|
|
Logical volume "srv_cache" successfully removed
|
|
|
|
Logical volume vg_materculae/srv is not cached.
|
|
|
|
root@materculae:~# lvextend -l '+100%FREE' vg_materculae/srv
|
|
|
|
Size of logical volume vg_materculae/srv changed from <150.00 GiB (38399 extents) to 309.99 GiB (79358 extents).
|
|
|
|
Logical volume vg_materculae/srv successfully resized.
|
|
|
|
root@materculae:~# lvs
|
|
|
|
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
|
|
|
|
srv vg_materculae -wi-ao---- 309.99g
|
|
|
|
root@materculae:~# vgs
|
|
|
|
VG #PV #LV #SN Attr VSize VFree
|
|
|
|
vg_materculae 2 1 0 wz--n- 309.99g 0
|
|
|
|
root@materculae:~# pvs
|
|
|
|
PV VG Fmt Attr PSize PFree
|
|
|
|
/dev/sdc vg_materculae lvm2 a-- <10.00g 0
|
|
|
|
/dev/sdd vg_materculae lvm2 a-- <300.00g 0
|
|
|
|
```
|
|
|
|
|
|
|
|
A proper procedure is:
|
|
|
|
|
|
|
|
VG=vg_$(hostname)
|
|
|
|
FAST=/dev/sdc
|
|
|
|
lvconvert --uncache $VG/srv
|
|
|
|
vgreduce $VG/srv $FAST # remove the cache volume
|
|
|
|
lvextend -l '+100%FREE' $VG/srv # resize the volume
|
|
|
|
vgextend $VG $FAST # re-add the cache volume
|
|
|
|
lvcreate -n cache -l '100%FREE' $VG $FAST
|
|
|
|
lvconvert --type cache --cachevol cache $VG
|
|
|
|
|
|
|
|
And here's a successful run:
|
|
|
|
|
|
|
|
```
|
|
|
|
root@materculae:~# VG=vg_$(hostname)
|
|
|
|
root@materculae:~# FAST=/dev/sdc
|
|
|
|
root@materculae:~# vgreduce $VG $FAST
|
|
|
|
Removed "/dev/sdc" from volume group "vg_materculae"
|
|
|
|
root@materculae:~# vgs
|
|
|
|
VG #PV #LV #SN Attr VSize VFree
|
|
|
|
vg_materculae 1 1 0 wz--n- <300.00g <10.00g
|
|
|
|
root@materculae:~# lvextend -l '+100%FREE' $VG
|
|
|
|
Size of logical volume vg_materculae/srv changed from 150.00 GiB (38400 extents) to <300.00 GiB (76799 extents).
|
|
|
|
Logical volume vg_materculae/srv successfully resized.
|
|
|
|
root@materculae:~# vgextend $VG $FAST
|
|
|
|
Volume group "vg_materculae" successfully extended
|
|
|
|
root@materculae:~# lvcreate -n cache -l '100%FREE' $VG $FAST
|
|
|
|
Logical volume "cache" created.
|
|
|
|
root@materculae:~# lvconvert --type cache --cachevol cache vg_materculae
|
|
|
|
Erase all existing data on vg_materculae/cache? [y/n]: y
|
|
|
|
Logical volume vg_materculae/srv is now cached.
|
|
|
|
Command on LV vg_materculae/cache_cvol requires LV with properties: lv_is_visible .
|
|
|
|
```
|
|
|
|
|
|
|
|
Note that the above output was edited for correctness: the actual run
|
|
|
|
was much bumpier and involved shrinking the logical volume as the
|
|
|
|
"incorrect" run was actually done in [tpo/tpa/team#41258](https://gitlab.torproject.org/tpo/tpa/team/-/issues/41258).
|
|
|
|
|
|
## offline procedure (ext2)
|
|
## offline procedure (ext2)
|
|
|
|
|
|
To resize the partition to take up all available free space, you
|
|
To resize the partition to take up all available free space, you
|
... | | ... | |