Skip to content

Instantly share code, notes, and snippets.

@t0mmyt
Created November 17, 2015 16:16
Show Gist options
  • Select an option

  • Save t0mmyt/005dad990cde059234fb to your computer and use it in GitHub Desktop.

Select an option

Save t0mmyt/005dad990cde059234fb to your computer and use it in GitHub Desktop.
LVM cache
[root@localhost ~]# lvcreate -L 10G -n root_cache fedora /dev/sdb2
Logical volume "root_cache" created.
[root@localhost ~]# lvcreate -L 20M -n root_cache_meta fedora /dev/sdb2
Logical volume "root_cache_meta" created.
[root@localhost ~]# man lvconvert
[root@localhost ~]# lvconvert --type cache-pool --cachemode writeback --poolmetadata fedora/root_cache_meta fedora/root_cache
WARNING: Converting logical volume fedora/root_cache and fedora/root_cache_meta to pool's data and metadata volumes.
THIS WILL DESTROY CONTENT OF LOGICAL VOLUME (filesystem etc.)
Do you really want to convert fedora/root_cache and fedora/root_cache_meta? [y/n]: y
Converted fedora/root_cache to cache pool.
[root@localhost ~]# lvconvert --type cache-pool --cachemode writeback --poolmetadata fedora/root_cache_meta fedora/^Cache
[root@localhost ~]# lvcreate -L 100M -n home_cache_meta fedora /dev/sdb2
Logical volume "home_cache_meta" created.
[root@localhost ~]# lvcreate -L 100G -n home_cache fedora /dev/sdb2
Logical volume "home_cache" created.
[root@localhost ~]# lvconvert --type cache-pool --cachemode writeback --poolmetadata fedora/home_cache_meta fedora/home_cache
WARNING: Converting logical volume fedora/home_cache and fedora/home_cache_meta to pool's data and metadata volumes.
THIS WILL DESTROY CONTENT OF LOGICAL VOLUME (filesystem etc.)
Do you really want to convert fedora/home_cache and fedora/home_cache_meta? [y/n]: y
Converted fedora/home_cache to cache pool.
[root@localhost ~]# lvconvert --type cache --cachepool fedora/home_cache fedora/home
Logical volume fedora/home is now cached.
[root@localhost ~]# lvconvert --type cache --cachepool fedora/root_cache fedora/root
Logical volume fedora/root is now cached.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment