{"id":676,"date":"2023-10-21T03:14:18","date_gmt":"2023-10-21T01:14:18","guid":{"rendered":"https:\/\/online.osba.nl\/blog\/?p=676"},"modified":"2023-11-19T22:08:41","modified_gmt":"2023-11-19T20:08:41","slug":"lvm-cache-aan-bestaande-lvm-raid1-mirror-toevoegen","status":"publish","type":"post","link":"https:\/\/blog.osba.nl\/en\/2023\/10\/21\/lvm-cache-aan-bestaande-lvm-raid1-mirror-toevoegen\/","title":{"rendered":"Add LVM cache to existing LVM RAID1 mirror"},"content":{"rendered":"\n<p>The new HP Microserver gen8 is configured with Proxmox.<br><br>Proxmox is installed on a RAID1 LVM that runs on two uSD cards: on in the uSD card slot integrated into the motherboard, the other via a USB-to-uSD adapter in the internal USB A connector on the motherboard.<br>I totally forgot about it, until I realized why <code>apt dist-upgrade<\/code> was running at a snails pace. <\/p>\n\n\n\n<p>For the rest there is little remarkable about the performance of the server. I do worry a bit about writing log records, and I did not configure any swap on the SD cards.<br><\/p>\n\n\n\n<p>To alleviate the pressure on the memorycards, I add a single GB of LVM cache on SSD (on a total size of 18 GB for each of the mirrored partitions). <\/p>\n\n\n\n<p>Steps to perform: <\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>SSD partitioning\n<ul class=\"wp-block-list\">\n<li><code>fdisk \/dev\/sdh<\/code><\/li>\n\n\n\n<li>for a new\/unused medium: <code>g<\/code> voor GPT partitielabel<\/li>\n\n\n\n<li>n for a new partition, <code>t<\/code> for type <code>lvm<\/code>, <code>w<\/code> to write and save the configuration.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Earmark the partitions for LVM-usage\n<ul class=\"wp-block-list\">\n<li><code>pvcreate \/dev\/sdh1<\/code><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Add the physical volume to the root partition&#8217;s volume group\n<ul class=\"wp-block-list\">\n<li><code>vgextend usbsdraid \/dev\/sdh1<\/code><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Add the future caching device to the existing volume group\n<ul class=\"wp-block-list\">\n<li><code>lvcreate -vn cache_mt_usbsdraid -l254 mt_usbsdraid \/dev\/sdh1<\/code><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Convert the volume to a cached volume, indicating the caching volume\n<ul class=\"wp-block-list\">\n<li><code>lvconvert --type cache --cachepool  cache_mt_usbsdraid \/mt_usbsdraid mt_prox_sys<\/code> <\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>IF THIS IS YOUR BOOT VOLUME : REGENERATE YOUR GRUB CONFIG AND IMAGE\n<ul class=\"wp-block-list\">\n<li>I forgot about this, and had to revert the changes on the next power outage, as the system had become unbootable. <\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<p>That is all. View the result by calling <code>lvs mt_usbsdraid<\/code>: <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># lvs mt_usbsdraid\n  LV          VG           Attr       LSize  Pool                       Origin              Data%  Meta%  Move Log Cpy%Sync Convert\n  mt_prox_sys mt_usbsdraid Cwi-aoC--- 18.00g &#91;cache_mt_usbsdraid_cpool] &#91;mt_prox_sys_corig] 0.04   2.10            0.00     <\/code><\/pre>\n\n\n\n<p class=\"has-small-font-size\"><\/p>\n<p class=\"wpf_wrapper\"><a class=\"print_link\" href=\"\" target=\"_blank\">Print this entry<\/a><\/p><!-- .wpf_wrapper -->","protected":false},"excerpt":{"rendered":"<p>The new HP Microserver gen8 is configured with Proxmox. Proxmox is installed on a RAID1 LVM that runs on two uSD cards: on in the uSD card slot integrated into the motherboard, the other via a USB-to-uSD adapter in the internal USB A connector on the motherboard.I totally forgot about it, until I realized why &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/blog.osba.nl\/en\/2023\/10\/21\/lvm-cache-aan-bestaande-lvm-raid1-mirror-toevoegen\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Add LVM cache to existing LVM RAID1 mirror&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_locale":"en_US","_original_post":"https:\/\/online.osba.nl\/blog\/?p=676","activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":4,"activitypub_interaction_policy_quote":"anyone","activitypub_status":"","footnotes":""},"categories":[30,17],"tags":[28,41,64,27,29],"class_list":["post-676","post","type-post","status-publish","format-standard","hentry","category-lvm","category-proxmox","tag-lv","tag-lvm","tag-lvmcache","tag-pv","tag-sn","en-US"],"_links":{"self":[{"href":"https:\/\/blog.osba.nl\/wp-json\/wp\/v2\/posts\/676","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.osba.nl\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.osba.nl\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.osba.nl\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.osba.nl\/wp-json\/wp\/v2\/comments?post=676"}],"version-history":[{"count":7,"href":"https:\/\/blog.osba.nl\/wp-json\/wp\/v2\/posts\/676\/revisions"}],"predecessor-version":[{"id":701,"href":"https:\/\/blog.osba.nl\/wp-json\/wp\/v2\/posts\/676\/revisions\/701"}],"wp:attachment":[{"href":"https:\/\/blog.osba.nl\/wp-json\/wp\/v2\/media?parent=676"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.osba.nl\/wp-json\/wp\/v2\/categories?post=676"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.osba.nl\/wp-json\/wp\/v2\/tags?post=676"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}