{"id":1030,"date":"2020-07-18T10:33:28","date_gmt":"2020-07-18T14:33:28","guid":{"rendered":"https:\/\/blog.lufamily.ca\/kang\/?p=1030"},"modified":"2024-02-15T14:00:33","modified_gmt":"2024-02-15T19:00:33","slug":"resizing-lvm-volume-with-cache","status":"publish","type":"post","link":"https:\/\/blog.lufamily.ca\/kang\/2020\/07\/18\/resizing-lvm-volume-with-cache\/","title":{"rendered":"Resizing LVM Volume with Cache"},"content":{"rendered":"\n<p>I had to increase the size of my media LVM logical volume again. In a previous <a rel=\"noreferrer noopener\" href=\"https:\/\/blog.lufamily.ca\/kang\/2018\/03\/11\/linux-lvm-super-simple-to-expand\/\" target=\"_blank\">post<\/a>, I provided the instructions. I have done this many times. However, this time around, I ran into a snag.<\/p>\n\n\n\n<p>Apparently this is the first time I try to increase the logical volume after I implemented LVM caching, which I wrote about in this <a rel=\"noreferrer noopener\" href=\"https:\/\/blog.lufamily.ca\/kang\/2019\/06\/01\/nvme-ssd-with-lvm-cache\/\" target=\"_blank\">post<\/a>.<\/p>\n\n\n\n<p>The steps in the &#8220;<a rel=\"noreferrer noopener\" href=\"https:\/\/blog.lufamily.ca\/kang\/2018\/03\/11\/linux-lvm-super-simple-to-expand\/\" target=\"_blank\">Linux LVM Super Simple to Expand<\/a>&#8221; post are the same right up to and including the step involving the resizing of the physical volume. Afterwards, in order to resize the logical volume, we first have to disable the cache temporarily.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo lvconvert --splitcache \/dev\/airvideovg2\/airvideo<\/code><\/pre>\n\n\n\n<p>Once the logical volume is no longer cached, then we can proceed with the resizing.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo lvresize -l +100%FREE \/dev\/airvideovg2\/airvideo<\/code><\/pre>\n\n\n\n<p>Once the resize is completed, we can unmount the volume and perform the required resizing of the filesystem.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl stop smbd.service\n\nsudo systemctl stop mpd.service\n\nsudo systemctl stop apache2.service\n\nsudo umount \/mnt\/airvideo\n\nsudo e2fsck -y -f \/dev\/airvideovg2\/airvideo\n\nsudo resize2fs -p \/dev\/airvideovg2\/airvideo<\/code><\/pre>\n\n\n\n<p>Note that <code>e2fsck<\/code> and <code>resize2fs<\/code> will take some time, between thirty minutes to an hour each. Once the file system is resized, we can reattach the cache.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo lvconvert --type cache --cachepool airvideovg2\/lv_cache airvideovg2\/airvideo<\/code><\/pre>\n\n\n\n<p>Usually it is a good idea to reboot the server after this just to make sure it mounts properly.<\/p>\n\n\n\n<p>This is a small snag and LVM is still super simple to expand.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I had to increase the size of my media LVM logical volume again. In a previous post, I provided the instructions. I have done this many times. However, this time around, I ran into a snag. Apparently this is the first time I try to increase the logical volume after I implemented LVM caching, which &hellip; <a href=\"https:\/\/blog.lufamily.ca\/kang\/2020\/07\/18\/resizing-lvm-volume-with-cache\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Resizing LVM Volume with Cache&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[111],"tags":[93,5,92,28,6],"class_list":["post-1030","post","type-post","status-publish","format-standard","hentry","category-tech","tag-lvm","tag-nas","tag-nvme","tag-technology","tag-ubuntu"],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p7V6i8-gC","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/blog.lufamily.ca\/kang\/wp-json\/wp\/v2\/posts\/1030","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.lufamily.ca\/kang\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.lufamily.ca\/kang\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.lufamily.ca\/kang\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.lufamily.ca\/kang\/wp-json\/wp\/v2\/comments?post=1030"}],"version-history":[{"count":2,"href":"https:\/\/blog.lufamily.ca\/kang\/wp-json\/wp\/v2\/posts\/1030\/revisions"}],"predecessor-version":[{"id":1070,"href":"https:\/\/blog.lufamily.ca\/kang\/wp-json\/wp\/v2\/posts\/1030\/revisions\/1070"}],"wp:attachment":[{"href":"https:\/\/blog.lufamily.ca\/kang\/wp-json\/wp\/v2\/media?parent=1030"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.lufamily.ca\/kang\/wp-json\/wp\/v2\/categories?post=1030"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.lufamily.ca\/kang\/wp-json\/wp\/v2\/tags?post=1030"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}