{"id":731,"date":"2020-06-25T02:45:47","date_gmt":"2020-06-25T02:45:47","guid":{"rendered":"https:\/\/server-help.org\/?p=731"},"modified":"2020-12-20T14:36:49","modified_gmt":"2020-12-20T14:36:49","slug":"increase-lvm-partition-to-take-up-remaining-space-ubuntu","status":"publish","type":"post","link":"https:\/\/server-help.org\/index.php\/2020\/06\/25\/increase-lvm-partition-to-take-up-remaining-space-ubuntu\/","title":{"rendered":"Increase LVM Partition to Take Up Remaining Space UBUNTU"},"content":{"rendered":"\n<p>(For Cloud VPS, and Cloud servers NOT dedicated)<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Ubuntu VPS \/ Cloud<\/h1>\n\n\n\n<p><\/p>\n\n\n\n<ol><li>Change configuration to the size you want. Then reboot.<\/li><li>Via your cloud panel do a snapshot (actions &gt; create snapshot)<\/li><li>SSH in and perform the below.<\/li><\/ol>\n\n\n\n<p><strong>fdisk -l<\/strong><\/p>\n\n\n\n<p>Disk \/dev\/sda: 40 GiB, 42949672960 bytes, 83886080 sectors<br> Units: sectors of 1 * 512 = 512 bytes<br> Sector size (logical\/physical): 512 bytes \/ 512 bytes<br> I\/O size (minimum\/optimal): 512 bytes \/ 512 bytes<br> Disklabel type: dos<br> Disk identifier: 0x41577866<\/p>\n\n\n\n<p>Device     Boot  Start      End  Sectors  Size Id Type<br>\n\/dev\/sda1  *      2048   999423   997376  487M 83 Linux<br>\n\/dev\/sda2       999424 62914559 61915136 29.5G 8e Linux LVM<\/p>\n\n\n\n<p>Disk \/dev\/mapper\/vg00-lv00: 1.9 GiB, 2046820352 bytes, 3997696 sectors<br>\nUnits: sectors of 1 * 512 = 512 bytes<br>\nSector size (logical\/physical): 512 bytes \/ 512 bytes<br>\nI\/O size (minimum\/optimal): 512 bytes \/ 512 bytes<\/p>\n\n\n\n<p>Disk \/dev\/mapper\/vg00-lv01: 27.6 GiB, 29649534976 bytes, 57909248 sectors<br>\nUnits: sectors of 1 * 512 = 512 bytes<br>\nSector size (logical\/physical): 512 bytes \/ 512 bytes<br>\nI\/O size (minimum\/optimal): 512 bytes \/ 512 bytes<\/p>\n\n\n\n<p>root@:~#<strong> fdisk \/dev\/sda<\/strong><\/p>\n\n\n\n<p>Welcome to fdisk (util-linux 2.31.1).<br>\nChanges will remain in memory only, until you decide to write them.<br>\nBe careful before using the write command.<\/p>\n\n\n\n<p>Command (m for help):<strong> p<\/strong><br> Disk \/dev\/sda: 40 GiB, 42949672960 bytes, 83886080 sectors<br> Units: sectors of 1 * 512 = 512 bytes<br> Sector size (logical\/physical): 512 bytes \/ 512 bytes<br> I\/O size (minimum\/optimal): 512 bytes \/ 512 bytes<br> Disklabel type: dos<br> Disk identifier: 0x41577866<\/p>\n\n\n\n<p>Device     Boot  Start      End  Sectors  Size Id Type<br>\n\/dev\/sda1  *      2048   999423   997376  487M 83 Linux<br>\n\/dev\/sda2       999424 62914559 61915136 29.5G 8e Linux LVM<\/p>\n\n\n\n<p>Command (m for help): <strong>d<\/strong><br> Partition number (1,2, default 2): <strong>2<\/strong><\/p>\n\n\n\n<p>Partition 2 has been deleted.<\/p>\n\n\n\n<p>Command (m for help): <strong>n<\/strong><br> Partition type<br>    p   primary (1 primary, 0 extended, 3 free)<br>    e   extended (container for logical partitions)<br> Select (default p): <strong>p<\/strong><br> Partition number (2-4, default 2):<strong> 2<\/strong><br> First sector (999424-83886079, default 999424):                                       <strong>&lt;&lt;&lt; hit ENTER<\/strong><br> Last sector, +sectors or +size{K,M,G,T,P} (999424-83886079, default 83886079):                                         <strong>&lt;&lt;&lt; hit ENTER<\/strong> <\/p>\n\n\n\n<p>Created a new partition 2 of type &#8216;Linux&#8217; and of size 39.5 GiB.<br>\nPartition #2 contains a LVM2_member signature.<\/p>\n\n\n\n<p>Do you want to remove the signature? [Y]es\/[N]o:<strong> n<\/strong><\/p>\n\n\n\n<p>Command (m for help):<strong> p<\/strong><\/p>\n\n\n\n<p>Disk \/dev\/sda: 40 GiB, 42949672960 bytes, 83886080 sectors<br>\nUnits: sectors of 1 * 512 = 512 bytes<br>\nSector size (logical\/physical): 512 bytes \/ 512 bytes<br>\nI\/O size (minimum\/optimal): 512 bytes \/ 512 bytes<br>\nDisklabel type: dos<br>\nDisk identifier: 0x41577866<\/p>\n\n\n\n<p>Device     Boot  Start      End  Sectors  Size Id Type<br>\n\/dev\/sda1  *      2048   999423   997376  487M 83 Linux<br>\n\/dev\/sda2       999424 83886079 82886656 39.5G 83 Linux<\/p>\n\n\n\n<p>Command (m for help):<strong> t<\/strong><br> Partition number (1,2, default 2):<strong> 2<\/strong><br> Hex code (type L to list all codes): <strong>L<\/strong><\/p>\n\n\n\n<p>0  Empty           24  NEC DOS         81  Minix \/ old Lin bf  Solaris<br>  1  FAT12           27  Hidden NTFS Win 82  Linux swap \/ So c1  DRDOS\/sec (FAT-<br>  2  XENIX root      39  Plan 9          83  Linux           c4  DRDOS\/sec (FAT-<br>  3  XENIX usr       3c  PartitionMagic  84  OS\/2 hidden or  c6  DRDOS\/sec (FAT-<br>  4  FAT16 &lt;32M      40  Venix 80286     85  Linux extended  c7  Syrinx<br>  5  Extended        41  PPC PReP Boot   86  NTFS volume set da  Non-FS data<br>  6  FAT16           42  SFS             87  NTFS volume set db  CP\/M \/ CTOS \/ .<br>  7  HPFS\/NTFS\/exFAT 4d  QNX4.x          88  Linux plaintext de  Dell Utility<br>  8  AIX             4e  QNX4.x 2nd part 8e  Linux LVM       df  BootIt<br>  9  AIX bootable    4f  QNX4.x 3rd part 93  Amoeba          e1  DOS access<br>  a  OS\/2 Boot Manag 50  OnTrack DM      94  Amoeba BBT      e3  DOS R\/O<br>  b  W95 FAT32       51  OnTrack DM6 Aux 9f  BSD\/OS          e4  SpeedStor<br>  c  W95 FAT32 (LBA) 52  CP\/M            a0  IBM Thinkpad hi ea  Rufus alignment<br>  e  W95 FAT16 (LBA) 53  OnTrack DM6 Aux a5  FreeBSD         eb  BeOS fs<br>  f  W95 Ext&#8217;d (LBA) 54  OnTrackDM6      a6  OpenBSD         ee  GPT<br> 10  OPUS            55  EZ-Drive        a7  NeXTSTEP        ef  EFI (FAT-12\/16\/<br> 11  Hidden FAT12    56  Golden Bow      a8  Darwin UFS      f0  Linux\/PA-RISC b<br> 12  Compaq diagnost 5c  Priam Edisk     a9  NetBSD          f1  SpeedStor<br> 14  Hidden FAT16 &lt;3 61  SpeedStor       ab  Darwin boot     f4  SpeedStor<br> 16  Hidden FAT16    63  GNU HURD or Sys af  HFS \/ HFS+      f2  DOS secondary<br> 17  Hidden HPFS\/NTF 64  Novell Netware  b7  BSDI fs         fb  VMware VMFS<br> 18  AST SmartSleep  65  Novell Netware  b8  BSDI swap       fc  VMware VMKCORE<br> 1b  Hidden W95 FAT3 70  DiskSecure Mult bb  Boot Wizard hid fd  Linux raid auto<br> 1c  Hidden W95 FAT3 75  PC\/IX           bc  Acronis FAT32 L fe  LANstep<br> 1e  Hidden W95 FAT1 80  Old Minix       be  Solaris boot    ff  BBT<br> Hex code (type L to list all codes):<strong> 8e<\/strong><\/p>\n\n\n\n<p>Changed type of partition &#8216;Linux&#8217; to &#8216;Linux LVM&#8217;.<\/p>\n\n\n\n<p>Command (m for help): <strong>p<\/strong><br> Disk \/dev\/sda: 40 GiB, 42949672960 bytes, 83886080 sectors<br> Units: sectors of 1 * 512 = 512 bytes<br> Sector size (logical\/physical): 512 bytes \/ 512 bytes<br> I\/O size (minimum\/optimal): 512 bytes \/ 512 bytes<br> Disklabel type: dos<br> Disk identifier: 0x41577866<\/p>\n\n\n\n<p>Device     Boot  Start      End  Sectors  Size Id Type<br>\n\/dev\/sda1  *      2048   999423   997376  487M 83 Linux<br>\n\/dev\/sda2       999424 83886079 82886656 39.5G 8e Linux LVM<\/p>\n\n\n\n<p>Command (m for help): <strong>w<\/strong><br> The partition table has been altered.<br> Syncing disks.<\/p>\n\n\n\n<p>root@:~# <strong>partprobe<\/strong><\/p>\n\n\n\n<p><br> root@:~# <strong>pvresize \/dev\/sda2<\/strong><br>   Physical volume &#8220;\/dev\/sda2&#8221; changed<br>   1 physical volume(s) resized \/ 0 physical volume(s) not resized<\/p>\n\n\n\n<p><br> root@:~# <strong>pvs<\/strong><br>   PV         VG   Fmt  Attr PSize   PFree<br>   \/dev\/sda2  vg00 lvm2 a&#8211;  &lt;39.52g 10.00g<\/p>\n\n\n\n<p><br> root@:~# <strong>df -h<\/strong><br> Filesystem             Size  Used Avail Use% Mounted on<br> udev                   459M     0  459M   0% \/dev<br> tmpfs                   97M  860K   96M   1% \/run<br> \/dev\/mapper\/vg00-lv01   28G   18G  8.9G  66% \/<br> tmpfs                  482M     0  482M   0% \/dev\/shm<br> tmpfs                  5.0M   16K  5.0M   1% \/run\/lock<br> tmpfs                  482M     0  482M   0% \/sys\/fs\/cgroup<br> \/dev\/sda1              464M  113M  323M  26% \/boot<br> tmpfs                   97M     0   97M   0% \/run\/user\/0<\/p>\n\n\n\n<p><br> root@:~#<strong> lvresize -l +100%FREE \/dev\/mapper\/vg00-lv01<\/strong><br>   Size of logical volume vg00\/lv01 changed from 27.61 GiB (7069 extents) to 37.61 GiB (9629 extents).<br>   Logical volume vg00\/lv01 successfully resized.<\/p>\n\n\n\n<p><br> root@:~# <strong>mount | grep vg00-lv01<\/strong><br> \/dev\/mapper\/vg00-lv01 on \/ type ext4 (rw,relatime,errors=remount-ro,data=ordered)<\/p>\n\n\n\n<p><br> root@:~# <strong>resize2fs \/dev\/mapper\/vg00-lv01<\/strong><br> resize2fs 1.44.1 (24-Mar-2018)<br> Filesystem at \/dev\/mapper\/vg00-lv01 is mounted on \/; on-line resizing required<br> old_desc_blocks = 4, new_desc_blocks = 5<br> The filesystem on \/dev\/mapper\/vg00-lv01 is now 9860096 (4k) blocks long.<\/p>\n\n\n\n<p>root@:~# <strong>df -h<\/strong><br> Filesystem             Size  Used Avail Use% Mounted on<br> udev                   459M     0  459M   0% \/dev<br> tmpfs                   97M  860K   96M   1% \/run<br> \/dev\/mapper\/vg00-lv01   37G   18G   19G  49% \/<br> tmpfs                  482M     0  482M   0% \/dev\/shm<br> tmpfs                  5.0M   16K  5.0M   1% \/run\/lock<br> tmpfs                  482M     0  482M   0% \/sys\/fs\/cgroup<br> \/dev\/sda1              464M  113M  323M  26% \/boot<br> tmpfs                   97M     0   97M   0% \/run\/user\/0<\/p>\n","protected":false},"excerpt":{"rendered":"<p>(For Cloud VPS, and Cloud servers NOT dedicated) Ubuntu VPS \/ Cloud Change configuration to the size you want. Then reboot. Via your cloud panel do a snapshot (actions &gt; create snapshot) SSH in and perform the below. fdisk -l Disk \/dev\/sda: 40 GiB, 42949672960 bytes, 83886080 sectors Units: sectors of 1 * 512 =&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,4,1],"tags":[],"_links":{"self":[{"href":"https:\/\/server-help.org\/index.php\/wp-json\/wp\/v2\/posts\/731"}],"collection":[{"href":"https:\/\/server-help.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server-help.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server-help.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server-help.org\/index.php\/wp-json\/wp\/v2\/comments?post=731"}],"version-history":[{"count":5,"href":"https:\/\/server-help.org\/index.php\/wp-json\/wp\/v2\/posts\/731\/revisions"}],"predecessor-version":[{"id":756,"href":"https:\/\/server-help.org\/index.php\/wp-json\/wp\/v2\/posts\/731\/revisions\/756"}],"wp:attachment":[{"href":"https:\/\/server-help.org\/index.php\/wp-json\/wp\/v2\/media?parent=731"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server-help.org\/index.php\/wp-json\/wp\/v2\/categories?post=731"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server-help.org\/index.php\/wp-json\/wp\/v2\/tags?post=731"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}