{"id":15301,"date":"2023-01-25T00:52:29","date_gmt":"2023-01-24T21:52:29","guid":{"rendered":"https:\/\/kifarunix.com\/?p=15301"},"modified":"2024-03-09T23:44:34","modified_gmt":"2024-03-09T20:44:34","slug":"how-to-reduce-or-shrink-physical-volume-in-linux","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/how-to-reduce-or-shrink-physical-volume-in-linux\/","title":{"rendered":"How to Reduce or Shrink Physical Volume in Linux"},"content":{"rendered":"\n<p>How do I shrink physical volume in Linux? In this tutorial, you will learn how to reduce or shrink Physical Volume in Linux. In a Linux system, a hard drive, or a partition or a group of them can be allocated a Physical Volume for storing data. Sometimes, you may assign a system more disk space than is required. If you are managing such storage devices via <a href=\"https:\/\/linux.die.net\/man\/8\/lvm\" target=\"_blank\" rel=\"noreferrer noopener\">LVM<\/a>, it would really be easy for you to reduce or shrink physical volume in Linux.<\/p>\n\n\n\n<div class=\"wp-block-rank-math-toc-block\" id=\"rank-math-toc\"><h2>Table of Contents<\/h2><nav><ul><li><a href=\"#reduce-or-shrink-physical-volume-in-linux\">Reduce or Shrink Physical Volume in Linux<\/a><ul><li><a href=\"#backup-your-system\">Backup your System<\/a><\/li><li><a href=\"#attach-and-boot-your-system-from-live-cd\">Attach and Boot your System from Live CD<\/a><\/li><li><a href=\"#reduce-or-shrink-logical-volume\">Reduce or Shrink Logical Volume<\/a><\/li><li><a href=\"#reduce-or-shrink-physical-volume\">Reduce or Shrink Physical Volume<\/a><\/li><li><a href=\"#reduce-or-shrink-the-physical-volume-partition\">Reduce or Shrink the\u00a0Physical Volume Partition<\/a><ul><li><a href=\"#disks-with-primary-partitions-only\">Disks with Primary Partitions Only<\/a><\/li><li><a href=\"#disks-with-primary-and-extended-logical-partitions\">Disks with Primary and Extended\/Logical Partitions<\/a><\/li><\/ul><\/li><li><a href=\"#detach-live-cd-from-the-system\">Detach Live CD from the System<\/a><\/li><li><a href=\"#confirm-physical-volume-resize-shrink\">Confirm Physical Volume Resize\/Shrink<\/a><\/li><li><a href=\"#other-tutorials\">Other Tutorials<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"reduce-or-shrink-physical-volume-in-linux\">Reduce or Shrink Physical Volume in Linux<\/h2>\n\n\n\n<p>So, how do you reduce physical volume? Well, this is a not a walk in the park procedure especially if you are dealing with a physical volume that is mounted and it is containing root filesystem.<\/p>\n\n\n\n<p>In order to reduce or shrink physical volume in Linux;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"backup-your-system\">Backup your System<\/h3>\n\n\n\n<p>Attempting to shrink a physical volume at least with root filesystem might make you loose your data. As a precaution, if there is a really a need for you to reduce or shrink physical volume, then at least backup the system.<\/p>\n\n\n\n<p>You can backup by cloning the system, or taking snapshot to allow you restore in case the procedure doesn&#8217;t work out.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"attach-and-boot-your-system-from-live-cd\">Attach and Boot your System from Live CD<\/h3>\n\n\n\n<p>On-line resize of root filesystem not possible. Thus, to ensure that we can work on the partition seamlessly, download and attach Live CD into your Linux system.<\/p>\n\n\n\n<p>As already mentioned, we are using Ubuntu 22.04 headless server as an example in this guide;<\/p>\n\n\n\n<p>Current disk usage;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>df -hT<\/code><\/pre>\n\n\n\n<p>Sample output;<\/p>\n\n\n\n<pre class=\"scroll-box\"><code>\nFilesystem                        Type   Size  Used Avail Use% Mounted on\ntmpfs                             tmpfs  198M  1.2M  197M   1% \/run\n<strong>\/dev\/mapper\/ubuntu--vg-ubuntu--lv ext4    37G  7.3G   28G  21% \/<\/strong>\ntmpfs                             tmpfs  988M     0  988M   0% \/dev\/shm\ntmpfs                             tmpfs  5.0M     0  5.0M   0% \/run\/lock\n\/dev\/sda2                         ext4   1.8G  245M  1.4G  15% \/boot\ntmpfs                             tmpfs  198M  4.0K  198M   1% \/run\/user\/1000\n<\/code><\/pre>\n\n\n\n<p>As you can see, we only have 7.3G disk space used out of 37G. We will need to shrink this to at least 15G total disk space.<\/p>\n\n\n\n<p>Thus;<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>power off your virtual machine<\/li>\n\n\n\n<li>attach a live CD and configure the machine to boot via Live CD<\/li>\n<\/ul>\n\n\n\n<div><a href=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/01\/boot-live-cd-try-ubuntu.png\" class=\"td-modal-image\"><figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"937\" height=\"721\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/01\/boot-live-cd-try-ubuntu.png\" alt=\"How to Reduce or Shrink Physical Volume in Linux\" class=\"wp-image-15303\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/01\/boot-live-cd-try-ubuntu.png?v=1674583256 937w, https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/01\/boot-live-cd-try-ubuntu-768x591.png?v=1674583256 768w\" sizes=\"(max-width: 937px) 100vw, 937px\" \/><\/figure><\/a><\/div>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"reduce-or-shrink-logical-volume\">Reduce or Shrink Logical Volume<\/h3>\n\n\n\n<p>To reduce or shrink Physical Volume in Linux, begin by shrinking logical volume and the underlying filesystem.<\/p>\n\n\n\n<p>Logical volume details can be displayed using <strong><code>lvs<\/code><\/strong> or <strong><code>lvdisplay<\/code><\/strong> command;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>lvdisplay<\/code><\/pre>\n\n\n\n<p>Sample output;<\/p>\n\n\n\n<pre class=\"scroll-box\"><code>\n  --- Logical volume ---\n  LV Path                \/dev\/ubuntu-vg\/ubuntu-lv\n  LV Name                ubuntu-lv\n  VG Name                ubuntu-vg\n  LV UUID                nmfKLT-IsWR-FfLX-CspJ-yaGz-CwR7-cGKSk2\n  LV Write Access        read\/write\n  LV Creation host, time ubuntu-server, 2022-04-29 05:05:06 +0000\n  LV Status              available\n  # open                 0\n  LV Size                <37.29 GiB\n  Current LE             9545\n  Segments               1\n  Allocation             inherit\n  Read ahead sectors     auto\n  - currently set to     256\n  Block device           253:0\n<\/code><\/pre>\n\n\n\n<p>If the volumes are not activated on system boot, activate using the command below;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>vgchange -ay<\/code><\/pre>\n\n\n\n<p>To shrink the logical volume and the underlying filesystem, use <code><strong>lvreduce --resizefs<\/strong><\/code> command as follows;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>lvreduce &#91;-r|--resizefs] &#91;-L|--size &#91;-]Size&#91;m|UNIT] &lt;path\/to\/LV&gt;<\/code><\/pre>\n\n\n\n<p>e.g;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>lvreduce -r -L 15G \/dev\/ubuntu-vg\/ubuntu-lv<\/code><\/pre>\n\n\n\n<p>Sample output;<\/p>\n\n\n\n<pre class=\"scroll-box\"><code>\nfsck from util-linux 2.37.2\n\/dev\/mapper\/ubuntu--vg-ubuntu--lv: 164766\/2449408 files (0.1% non-contiguous), 2093538\/9774080 blocks\nresize2fs 1.46.5 (30-Dec-2021)\nResizing the filesystem on \/dev\/mapper\/ubuntu--vg-ubuntu--lv to 3932160 (4k) blocks.\nThe filesystem on \/dev\/mapper\/ubuntu--vg-ubuntu--lv is now 3932160 (4k) blocks long.\n\n  Size of logical volume ubuntu-vg\/ubuntu-lv changed from <37.29 GiB (9545 extents) to 15.00 GiB (3840 extents).\n  Logical volume ubuntu-vg\/ubuntu-lv successfully resized.\n\n<\/code><\/pre>\n\n\n\n<p>Confirm the shrinkage;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>lvdisplay<\/code><\/pre>\n\n\n\n<pre class=\"scroll-box\"><code>\n  --- Logical volume ---\n  LV Path                \/dev\/ubuntu-vg\/ubuntu-lv\n  LV Name                ubuntu-lv\n  VG Name                ubuntu-vg\n  LV UUID                nmfKLT-IsWR-FfLX-CspJ-yaGz-CwR7-cGKSk2\n  LV Write Access        read\/write\n  LV Creation host, time ubuntu-server, 2022-04-29 05:05:06 +0000\n  LV Status              available\n  # open                 0\n  <strong>LV Size                15.00 GiB<\/strong>\n  Current LE             3840\n  Segments               1\n  Allocation             inherit\n  Read ahead sectors     auto\n  - currently set to     256\n  Block device           253:0\n<\/code><\/pre>\n\n\n\n<p>If all is good, then proceed!<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"reduce-or-shrink-physical-volume\">Reduce or Shrink Physical Volume<\/h3>\n\n\n\n<p>You can now proceed to reduce or shrink Physical volume.<\/p>\n\n\n\n<p>At the moment, our physical volume, \/dev\/sda3, is ~37.29g. We will shrink it as well to 15G.<\/p>\n\n\n\n<p>You can show the details about Physical volume using <strong><code>pvs<\/code><\/strong> or <strong><code>pvdisplay<\/code><\/strong> command.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>pvdisplay<\/code><\/pre>\n\n\n\n<pre class=\"scroll-box\"><code>\n  --- Physical volume ---\n  PV Name               \/dev\/sda3\n  VG Name               ubuntu-vg\n<strong>  PV Size               &lt;37.29 GiB \/ not usable 2.98 MiB\n<\/strong>  Allocatable           yes \n  PE Size               4.00 MiB\n  Total PE              9545\n  Free PE               5705\n  Allocated PE          3840\n  PV UUID               2l4lAf-vXju-afXg-LfeQ-jcl2-Q3mR-99iXpg\n<\/code><\/pre>\n\n\n\n<p>In our example, we need to resize our physical volume to 15G.<\/p>\n\n\n\n<p>As you can see from the example above, we have Allocated PE of 3840 each of size 4.00 MiB. This totals to 15360 MiB (15 GiB) of space.<\/p>\n\n\n\n<p>To ensure that the last sector is counted while resizing, add 1 Extent (4 MiB). <\/p>\n\n\n\n<p>You can get the information about the start and length of each physical extents;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>pvs -v --segments \/dev\/sda3<\/code><\/pre>\n\n\n\n<p>Sample output;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>  PV         VG        Fmt  Attr PSize  PFree Start SSize LV        Start Type   PE Ranges       \n  \/dev\/sda3  ubuntu-vg lvm2 a--  15.00g    0      0  3840 ubuntu-lv     0 linear \/dev\/sda3:0-3839<\/code><\/pre>\n\n\n\n<p>The total allocated extents are 3840. When you add 1 extent, it becomes 3841 extents which is equivalent to (3841x4) = 15364 MiB.<\/p>\n\n\n\n<p>Since pvresize command doesn't take extents an option, we can use the total volume size in MiB. Hence, to reduce or shrink our volume size to 15G, we can use the command;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>pvresize \/dev\/sda3 --setphysicalvolumesize 15364<\/code><\/pre>\n\n\n\n<p>Sample output;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/dev\/sda3: Requested size 15.00 GiB is less than real size &lt;37.29 GiB. Proceed?  &#91;y\/n]: y\n  WARNING: \/dev\/sda3: Pretending size is 31465472 not 78200799 sectors.\n  Physical volume \"\/dev\/sda3\" changed\n  <strong>1 physical volume(s) resized or updated<\/strong> \/ 0 physical volume(s) not resized<\/code><\/pre>\n\n\n\n<p>You may get an output that says cannot resize to XXXX extents as YYYY are allocated. In this case, you need to ensure that your segments are aligned properly.<\/p>\n\n\n\n<p>Confirm new Physical volume size;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>pvdisplay<\/code><\/pre>\n\n\n\n<pre class=\"scroll-box\"><code>\n  --- Physical volume ---\n  PV Name               \/dev\/sda3\n  VG Name               ubuntu-vg\n  PV Size               <strong>15.00 GiB<\/strong> \/ not usable 3.00 MiB\n  Allocatable           yes (but full)\n  PE Size               4.00 MiB\n  Total PE              3840\n  Free PE               0\n  Allocated PE          3840\n  PV UUID               2l4lAf-vXju-afXg-LfeQ-jcl2-Q3mR-99iXpg\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"reduce-or-shrink-the-physical-volume-partition\">Reduce or Shrink the&nbsp;Physical Volume Partition<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"disks-with-primary-partitions-only\">Disks with Primary Partitions Only<\/h4>\n\n\n\n<p>You can now shrink the physical volume partition. You can use <strong>fdisk<\/strong> command;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>fdisk \/dev\/sda<\/code><\/pre>\n\n\n\n<p>List the partitions by pressing <strong>p<\/strong>.<\/p>\n\n\n\n<pre class=\"scroll-box\"><code>\nWelcome to fdisk (util-linux 2.37.2).\nChanges will remain in memory only, until you decide to write them.\nBe careful before using the write command.\n\nThis disk is currently in use - repartitioning is probably a bad idea.\nIt's recommended to umount all file systems, and swapoff all swap\npartitions on this disk.\n\n\nCommand (m for help): p\n<\/code><\/pre>\n\n\n\n<p>Sample output;<\/p>\n\n\n\n<pre class=\"scroll-box\"><code>\nDisk \/dev\/sda: 39.06 GiB, 41943040000 bytes, 81920000 sectors\nDisk model: VBOX HARDDISK   \nUnits: sectors of 1 * 512 = 512 bytes\nSector size (logical\/physical): 512 bytes \/ 512 bytes\nI\/O size (minimum\/optimal): 512 bytes \/ 512 bytes\nDisklabel type: gpt\nDisk identifier: 55B779AD-FE40-4978-9911-787F868D006B\n\nDevice       Start      End  Sectors  Size Type\n\/dev\/sda1     2048     4095     2048    1M BIOS boot\n\/dev\/sda2     4096  3719167  3715072  1.8G Linux filesystem\n\/dev\/sda3  3719168 81919966 78200799 37.3G Linux filesystem\n<\/code><\/pre>\n\n\n\n<p>We need to delete root partition in this case, \/dev\/sda3;<\/p>\n\n\n\n<p>Hence, press d and select partition 3;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Command (m for help): d\nPartition number (1-3, default 3): \n\nPartition 3 has been deleted.\n\nCommand (m for help):<\/code><\/pre>\n\n\n\n<p>Create a new partition and allocate 15364M (Note that we set the PV to 15364 MiB) and when prompted to remove the signature, select <strong>No;<\/strong><\/p>\n\n\n\n<pre class=\"scroll-box\"><code>\nCommand (m for help): n\nPartition number (3-128, default 3): \nFirst sector (3719168-81919966, default 3719168): \nLast sector, +\/-sectors or +\/-size{K,M,G,T,P} (3719168-81919966, default 81919966): +15364M\n\nCreated a new partition 3 of type 'Linux filesystem' and of size 15 GiB.\nPartition #3 contains a LVM2_member signature.\n\nDo you want to remove the signature? [Y]es\/[N]o: N\n\nCommand (m for help):\n<\/code><\/pre>\n\n\n\n<p>Print the partition tables again to confirm the size;<\/p>\n\n\n\n<pre class=\"scroll-box\"><code>\nCommand (m for help): p\n\nDisk \/dev\/sda: 39.06 GiB, 41943040000 bytes, 81920000 sectors\nDisk model: VBOX HARDDISK   \nUnits: sectors of 1 * 512 = 512 bytes\nSector size (logical\/physical): 512 bytes \/ 512 bytes\nI\/O size (minimum\/optimal): 512 bytes \/ 512 bytes\nDisklabel type: gpt\nDisk identifier: 55B779AD-FE40-4978-9911-787F868D006B\n\nDevice       Start      End  Sectors  Size Type\n\/dev\/sda1     2048     4095     2048    1M BIOS boot\n\/dev\/sda2     4096  3719167  3715072  1.8G Linux filesystem\n\/dev\/sda3  3719168 35176447 31457280   15G Linux filesystem\n\nCommand (m for help):\n<\/code><\/pre>\n\n\n\n<p>Write changes and exit fdisk;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Command (m for help): w\nThe partition table has been altered.\nSyncing disks.<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"disks-with-primary-and-extended-logical-partitions\">Disks with Primary and Extended\/Logical Partitions<\/h4>\n\n\n\n<p>What if you have a disk with Extended and logical partitions? And the first logical partition is is the one with the disk physical volume?<\/p>\n\n\n\n<p>This is an example;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>fdisk -l \/dev\/sda<\/code><\/pre>\n\n\n\n<pre class=\"scroll-box\"><code>\nDisk \/dev\/sda: 20 GiB, 21474836480 bytes, 41943040 sectors\nDisk model: QEMU HARDDISK   \nUnits: sectors of 1 * 512 = 512 bytes\nSector size (logical\/physical): 512 bytes \/ 512 bytes\nI\/O size (minimum\/optimal): 512 bytes \/ 512 bytes\nDisklabel type: dos\nDisk identifier: 0x75b85259\n\n<strong>Device     Boot   Start      End  Sectors  Size Id Type\n\/dev\/sda1  *       2048   999423   997376  487M 83 Linux\n\/dev\/sda2       1001470 41940991 40939522 19.5G  5 Extended\n\/dev\/sda5       1001472 41940991 40939520 19.5G 8e Linux LVM<\/strong>\n<\/code><\/pre>\n\n\n\n<p>You need to delete the logical and extended partition and recreate them as shown below;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>fdisk \/dev\/sda<\/code><\/pre>\n\n\n\n<pre class=\"scroll-box\"><code>\nWelcome to fdisk (util-linux 2.37.2).\nChanges will remain in memory only, until you decide to write them.\nBe careful before using the write command.\n\nThis disk is currently in use - repartitioning is probably a bad idea.\nIt's recommended to umount all file systems, and swapoff all swap\npartitions on this disk.\n\n\nCommand (m for help):\n<\/code><\/pre>\n\n\n\n<p>List the partitions by typing <strong>p<\/strong> and press ENTER;<\/p>\n\n\n\n<pre class=\"scroll-box\"><code>\nCommand (m for help): p\n\nDisk \/dev\/sda: 20 GiB, 21474836480 bytes, 41943040 sectors\nDisk model: QEMU HARDDISK   \nUnits: sectors of 1 * 512 = 512 bytes\nSector size (logical\/physical): 512 bytes \/ 512 bytes\nI\/O size (minimum\/optimal): 512 bytes \/ 512 bytes\nDisklabel type: dos\nDisk identifier: 0x75b85259\n\nDevice     Boot   Start      End  Sectors  Size Id Type\n\/dev\/sda1  *       2048   999423   997376  487M 83 Linux\n\/dev\/sda2       1001470 41940991 40939522 19.5G  5 Extended\n\/dev\/sda5       1001472 41940991 40939520 19.5G 8e Linux LVM\n\nCommand (m for help):\n<\/code><\/pre>\n\n\n\n<p>So, we need to delete the Logical partition (\/dev\/sda5) and Extended partition (\/dev\/sda2) using <strong>d<\/strong> option;<\/p>\n\n\n\n<pre class=\"scroll-box\"><code>\nCommand (m for help): d\nPartition number (1,2,5, default 5): \n\nPartition 5 has been deleted.\n\nCommand (m for help): d\nPartition number (1,2, default 2): \n\nPartition 2 has been deleted.\n\nCommand (m for help):\n<\/code><\/pre>\n\n\n\n<p>Next, create the Extended partition. The size should be exactly same as the physical volume size. Consider this physical size;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>pvdisplay<\/code><\/pre>\n\n\n\n<pre class=\"scroll-box\"><code>\n  --- Physical volume ---\n  PV Name               \/dev\/sda5\n  VG Name               bookworm-vg\n  PV Size               10.00 GiB \/ not usable 3.00 MiB\n  Allocatable           yes (but full)\n  PE Size               4.00 MiB\n  Total PE              2560\n  Free PE               0\n  Allocated PE          2560\n  PV UUID               JK72C1-ginB-1kph-t96A-NV4c-8H3e-6wxgpc\n<\/code><\/pre>\n\n\n\n<p>So, in this case, we would set the size to (2560+1)x4=10244MiB. Hence, in this case, this should be our Extended partition size.<\/p>\n\n\n\n<p>Hence, type <strong>n<\/strong> and press enter to create new Extended partition;<\/p>\n\n\n\n<p>Partition type is Extended (<strong>e<\/strong>)<\/p>\n\n\n\n<pre class=\"scroll-box\"><code>\nCommand (m for help): n\nPartition type\n   p   primary (1 primary, 0 extended, 3 free)\n   e   extended (container for logical partitions)\nSelect (default p): e\nPartition number (2-4, default 2): \nFirst sector (999424-41943039, default 999424): \nLast sector, +\/-sectors or +\/-size{K,M,G,T,P} (999424-41943039, default 41943039): <strong>+10244M<\/strong>\n\n<strong>Created a new partition 2 of type 'Extended' and of size 10 GiB.<\/strong>\n<\/code><\/pre>\n\n\n\n<p>Next, create another parition, which is the logical partition. It should be same size as the extended partition above. <strong>While creating the logical partition, you will be prompted whether to remove the signature<\/strong>. <strong>PLEASE DO NOT<\/strong>. Enter <strong>N<\/strong> for No!<\/p>\n\n\n\n<p>Partition type is Logical (<strong>l<\/strong>);<\/p>\n\n\n\n<pre class=\"scroll-box\"><code>\nCommand (m for help): n\nPartition type\n   p   primary (1 primary, 1 extended, 2 free)\n   l   logical (numbered from 5)\nSelect (default p): <strong>l<\/strong>\n\nAdding logical partition 5\nFirst sector (1001472-21979135, default 1001472): \nLast sector, +\/-sectors or +\/-size{K,M,G,T,P} (1001472-21979135, default 21979135): <strong>+10244M<\/strong>\n\nCreated a new partition 5 of type 'Linux' and of size 10 GiB.\nPartition #5 contains a LVM2_member signature.\n\nDo you want to remove the signature? [Y]es\/[N]o: <strong>N<\/strong>\n<\/code><\/pre>\n\n\n\n<p>Write the changes to the disk by typing <strong>w<\/strong>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"detach-live-cd-from-the-system\">Detach Live CD from the System<\/h3>\n\n\n\n<p>Shutdown the system and remove live CD iso.<\/p>\n\n\n\n<p>After that, boot the system.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"confirm-physical-volume-resize-shrink\">Confirm Physical Volume Resize\/Shrink<\/h3>\n\n\n\n<p>Check if all is good.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>pvdisplay<\/code><\/pre>\n\n\n\n<pre class=\"scroll-box\"><code>\n  --- Physical volume ---\n  PV Name               \/dev\/sda3\n  VG Name               ubuntu-vg\n  PV Size               15.00 GiB \/ not usable 3.00 MiB\n  Allocatable           yes (but full)\n  PE Size               4.00 MiB\n  Total PE              3840\n  Free PE               0\n  Allocated PE          3840\n  PV UUID               2l4lAf-vXju-afXg-LfeQ-jcl2-Q3mR-99iXpg\n<\/code><\/pre>\n\n\n\n<p>Check disk usage;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>df -hT<\/code><\/pre>\n\n\n\n<pre class=\"scroll-box\"><code>\nFilesystem                        Type   Size  Used Avail Use% Mounted on\ntmpfs                             tmpfs  198M  1.2M  197M   1% \/run\n<strong>\/dev\/mapper\/ubuntu--vg-ubuntu--lv ext4    15G  7.3G  6.8G  53% \/<\/strong>\ntmpfs                             tmpfs  988M     0  988M   0% \/dev\/shm\ntmpfs                             tmpfs  5.0M     0  5.0M   0% \/run\/lock\n\/dev\/sda2                         ext4   1.8G  245M  1.4G  15% \/boot\ntmpfs                             tmpfs  198M  4.0K  198M   1% \/run\/user\/1000\n<\/code><\/pre>\n\n\n\n<p>And there you go! You have learnt how to successfully reduce or shrink physical volume in Linux (Ubuntu 22.04) using live CD!<\/p>\n\n\n\n<p>That marks the end of our tutorial on reducing or shrinking Physical Volume in Linux.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"other-tutorials\">Other Tutorials<\/h3>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/easy-way-to-extend-kvm-virtual-machine-disk-size\/\" target=\"_blank\" rel=\"noreferrer noopener\">Easy Way to Extend KVM Virtual Machine Disk Size<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/change-windows-boot-device-from-ide-to-virtio-on-kvm\/\" target=\"_blank\" rel=\"noreferrer noopener\">Change Windows Boot Device from IDE to Virtio on KVM<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>How do I shrink physical volume in Linux? In this tutorial, you will learn how to reduce or shrink Physical Volume in Linux. In a<\/p>\n","protected":false},"author":10,"featured_media":15308,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_lock_modified_date":false,"footnotes":""},"categories":[39,121,43],"tags":[6314,6312,6313,6311,6308,6309,6310],"class_list":["post-15301","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-storage","category-howtos","category-lvm","tag-how-do-i-shrink-physical-volume-in-linux","tag-how-do-you-reduce-physical-volume","tag-how-do-you-shrink-a-logical-volume","tag-linux-shrink-physical-volume","tag-reduce-or-shrink-physical-volume-in-linux","tag-resize-physical-volume-in-linux","tag-shrink-physical-volume-in-linux","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-50","resize-featured-image"],"_links":{"self":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/15301"}],"collection":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/comments?post=15301"}],"version-history":[{"count":10,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/15301\/revisions"}],"predecessor-version":[{"id":20677,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/15301\/revisions\/20677"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media\/15308"}],"wp:attachment":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media?parent=15301"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/categories?post=15301"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/tags?post=15301"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}