{"id":196,"date":"2020-10-24T10:57:07","date_gmt":"2020-10-24T10:57:07","guid":{"rendered":"https:\/\/online.osba.nl\/blog\/?p=196"},"modified":"2021-04-18T20:22:58","modified_gmt":"2021-04-18T20:22:58","slug":"lvm-extend-and-grow-ext4-file-system","status":"publish","type":"post","link":"https:\/\/blog.osba.nl\/en\/2020\/10\/24\/lvm-extend-and-grow-ext4-file-system\/","title":{"rendered":"LVM extend, and grow ext4 file system"},"content":{"rendered":"\n<p>First run in test mode (-t)<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>root@linhovo:~# lvextend \/dev\/mapper\/data-linh \/dev\/sda3 -tvrL +30G\nTEST MODE: Metadata will NOT be updated and volumes will not be (de)activated.\nExecuting: \/sbin\/fsadm --dry-run --verbose check \/dev\/data\/linh\nfsadm: \"ext4\" filesystem found on \"\/dev\/mapper\/data-linh\".\nfsadm: Skipping filesystem check for device \"\/dev\/mapper\/data-linh\" as the filesystem is mounted on \/home\/linh\n\/sbin\/fsadm failed: 3\nTest mode: Skipping archiving of volume group.\nExtending logical volume data\/linh to &lt;285.58 GiB Size of logical volume data\/linh changed from &lt;255.58 GiB (65428 extents) to &lt;285.58 GiB (73108 extents). Test mode: Skipping backup of volume group. Logical volume data\/linh successfully resized. Executing: \/sbin\/fsadm --dry-run --verbose resize \/dev\/data\/linh 299450368K fsadm: \"ext4\" filesystem found on \"\/dev\/mapper\/data-linh\". fsadm: Device \"\/dev\/mapper\/data-linh\" size is 274424922112 bytes fsadm: Parsing tune2fs -l \"\/dev\/mapper\/data-linh\" fsadm: Resizing filesystem on device \"\/dev\/mapper\/data-linh\" to 306637176832 bytes (66998272 -&gt; 74862592 blocks of 4096 bytes)\nfsadm: Dry execution resize2fs \/dev\/mapper\/data-linh 74862592\n<\/code><\/pre>\n\n\n\n<p>Notice &#8216;\/sbin\/fsadm failed: 3&#8217;, because of a mounted file system. Unmount it:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">root@linhovo:~# umount \/home\/linh<\/pre>\n\n\n\n<p>Now run vgextend without -t, to actually have the logical volume and the file system resized:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">root@linhovo:~# lvextend \/dev\/mapper\/data-linh \/dev\/sda3 -tvrL +30G\nTEST MODE: Metadata will NOT be updated and volumes will not be (de)activated.\nExecuting: \/sbin\/fsadm --dry-run --verbose check \/dev\/data\/linh\nfsadm: \"ext4\" filesystem found on \"\/dev\/mapper\/data-linh\".\nfsadm: Filesystem has not been checked after the last mount, using fsck -f\nfsadm: Dry execution fsck -f -p \/dev\/mapper\/data-linh\nTest mode: Skipping archiving of volume group.\nExtending logical volume data\/linh to &lt;285.58 GiB Size of logical volume data\/linh changed from &lt;255.58 GiB (65428 extents) to &lt;285.58 GiB (73108 extents). Test mode: Skipping backup of volume group. Logical volume data\/linh successfully resized. Executing: \/sbin\/fsadm --dry-run --verbose resize \/dev\/data\/linh 299450368K fsadm: \"ext4\" filesystem found on \"\/dev\/mapper\/data-linh\". fsadm: Device \"\/dev\/mapper\/data-linh\" size is 274424922112 bytes fsadm: Parsing tune2fs -l \"\/dev\/mapper\/data-linh\" fsadm: Resizing filesystem on device \"\/dev\/mapper\/data-linh\" to 306637176832 bytes (66998272 -&gt; 74862592 blocks of 4096 bytes)\nfsadm: Dry execution resize2fs \/dev\/mapper\/data-linh 74862592\nroot@linhovo:~# lvextend \/dev\/mapper\/data-linh \/dev\/sda3 -vrL +30G\nExecuting: \/sbin\/fsadm --verbose check \/dev\/data\/linh\nfsadm: \"ext4\" filesystem found on \"\/dev\/mapper\/data-linh\".\nfsadm: Filesystem has not been checked after the last mount, using fsck -f\nfsadm: Executing fsck -f -p \/dev\/mapper\/data-linh\nfsck from util-linux 2.33.1\nlinh: 74099\/16752640 files (5.8% non-contiguous), 63802054\/66998272 blocks\nArchiving volume group \"data\" metadata (seqno 4).\nExtending logical volume data\/linh to &lt;285.58 GiB Size of logical volume data\/linh changed from &lt;255.58 GiB (65428 extents) to &lt;285.58 GiB (73108 extents). Loading table for data-linh (254:3). Suspending data-linh (254:3) with device flush Resuming data-linh (254:3). Creating volume group backup \"\/etc\/lvm\/backup\/data\" (seqno 5). Logical volume data\/linh successfully resized. Executing: \/sbin\/fsadm --verbose resize \/dev\/data\/linh 299450368K fsadm: \"ext4\" filesystem found on \"\/dev\/mapper\/data-linh\". fsadm: Device \"\/dev\/mapper\/data-linh\" size is 306637176832 bytes fsadm: Parsing tune2fs -l \"\/dev\/mapper\/data-linh\" fsadm: Resizing filesystem on device \"\/dev\/mapper\/data-linh\" to 306637176832 bytes (66998272 -&gt; 74862592 blocks of 4096 bytes)\nfsadm: Executing resize2fs \/dev\/mapper\/data-linh 74862592\nresize2fs 1.44.5 (15-Dec-2018)\nResizing the filesystem on \/dev\/mapper\/data-linh to 74862592 (4k) blocks.\nThe filesystem on \/dev\/mapper\/data-linh is now 74862592 (4k) blocks long.<\/pre>\n\n\n\n<p>Check that the space is added. Some part of the system is smart enough to translate the mount point of the unmounted partition to the right partition:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">root@linhovo:~# df -h \/home\/linh<br>Filesystem Size Used Avail Use% Mounted on<br>\/dev\/mapper\/data-home 58G 17G 39G 31% \/home<\/pre>\n\n\n\n<p>UPDATE: I was quite surprised the free space for the file system was found even when not mounted. Upon rereading, I notice that it actually is not the case. The amount of free space matched my expectations, so I glanced over the details. <\/p>\n\n\n\n<p>What actually is shown, is df for the partition on which the mount point \/home\/linh resides. <\/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>First run in test mode (-t) Notice &#8216;\/sbin\/fsadm failed: 3&#8217;, because of a mounted file system. Unmount it: root@linhovo:~# umount \/home\/linh Now run vgextend without -t, to actually have the logical volume and the file system resized: root@linhovo:~# lvextend \/dev\/mapper\/data-linh \/dev\/sda3 -tvrL +30G TEST MODE: Metadata will NOT be updated and volumes will not be &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/blog.osba.nl\/en\/2020\/10\/24\/lvm-extend-and-grow-ext4-file-system\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;LVM extend, and grow ext4 file system&#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=193","activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":4,"activitypub_interaction_policy_quote":"anyone","activitypub_status":"","footnotes":""},"categories":[15],"tags":[],"class_list":["post-196","post","type-post","status-publish","format-standard","hentry","category-homeserver","en-US"],"_links":{"self":[{"href":"https:\/\/blog.osba.nl\/wp-json\/wp\/v2\/posts\/196","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=196"}],"version-history":[{"count":3,"href":"https:\/\/blog.osba.nl\/wp-json\/wp\/v2\/posts\/196\/revisions"}],"predecessor-version":[{"id":328,"href":"https:\/\/blog.osba.nl\/wp-json\/wp\/v2\/posts\/196\/revisions\/328"}],"wp:attachment":[{"href":"https:\/\/blog.osba.nl\/wp-json\/wp\/v2\/media?parent=196"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.osba.nl\/wp-json\/wp\/v2\/categories?post=196"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.osba.nl\/wp-json\/wp\/v2\/tags?post=196"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}