{"id":354,"date":"2018-03-24T13:55:50","date_gmt":"2018-03-24T13:55:50","guid":{"rendered":"http:\/\/kloxo.web.id\/?p=354"},"modified":"2018-03-24T13:56:29","modified_gmt":"2018-03-24T13:56:29","slug":"resize-hdd-di-proxmox-virtual-machine","status":"publish","type":"post","link":"https:\/\/kloxo.web.id\/?p=354","title":{"rendered":"Resize HDD di Virtual Machine &#8211; Proxmox"},"content":{"rendered":"<p>Lagi asyik belajar ngoprek &#8216;docker&#8217; di vm&#8230;loh koq waktu &#8216;yum\/apt-get update&#8217; nongol pesan &#8216;insufficient disk space&#8217;..dan cek ke &#8216;df -h&#8217;, ternyata hdd root &#8216;\/&#8217; nya udah 99%&#8230;.waduh!<\/p>\n<p>Daripada harus install ulang VM, lebih baik belajar resize hdd nya aja ya?..yuk ah kita mulai :<\/p>\n<p>1. anggaplah posisi awal hdd pada \/dev\/sda sebagai berikut :<br \/>\n<a href=\"http:\/\/kloxo.web.id\/wp-content\/uploads\/2018\/03\/sebelum-resize.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-355\" src=\"http:\/\/kloxo.web.id\/wp-content\/uploads\/2018\/03\/sebelum-resize-300x188.png\" alt=\"\" width=\"300\" height=\"188\" srcset=\"https:\/\/kloxo.web.id\/wp-content\/uploads\/2018\/03\/sebelum-resize-300x188.png 300w, https:\/\/kloxo.web.id\/wp-content\/uploads\/2018\/03\/sebelum-resize.png 675w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><br \/>\n\/dev\/sda1 8.0GB dan kapasitas terpakai 44%, ini partisi yang akan kita resize menjadi 33.4GB dari total hdd Disk \/dev\/sda: 34.4GB dan untuk swap 1.0GB<\/p>\n<p>2. shutdown VM dan lakukan &#8216;resize disk&#8217; dibagian &#8216;hardware&#8217; nya VM :<br \/>\n<a href=\"http:\/\/kloxo.web.id\/wp-content\/uploads\/2018\/03\/sebelum-resize-vm.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/kloxo.web.id\/wp-content\/uploads\/2018\/03\/sebelum-resize-vm-300x146.png\" alt=\"\" width=\"300\" height=\"146\" class=\"alignnone size-medium wp-image-356\" srcset=\"https:\/\/kloxo.web.id\/wp-content\/uploads\/2018\/03\/sebelum-resize-vm-300x146.png 300w, https:\/\/kloxo.web.id\/wp-content\/uploads\/2018\/03\/sebelum-resize-vm-768x374.png 768w, https:\/\/kloxo.web.id\/wp-content\/uploads\/2018\/03\/sebelum-resize-vm.png 845w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><br \/>\nnyalakan ulang VM dan masuk ke console nya.<\/p>\n<p>3. langkah dibawah ini untuk menghapus partisi swap, karena menghalangi sector \/dev\/sda1 ketika di resize :<br \/>\n&#8212;<br \/>\nroot@docker-ce:~# parted \/dev\/sda<br \/>\nGNU Parted 3.2<br \/>\nUsing \/dev\/sda<br \/>\nWelcome to GNU Parted! Type &#8216;help&#8217; to view a list of commands.<br \/>\n(parted) print<br \/>\nModel: QEMU QEMU HARDDISK (scsi)<br \/>\nDisk \/dev\/sda: 34.4GB<br \/>\nSector size (logical\/physical): 512B\/512B<br \/>\nPartition Table: msdos<br \/>\nDisk Flags:<\/p>\n<p>Number  Start   End     Size    Type      File system     Flags<br \/>\n 1      1049kB  8053MB  8052MB  primary   ext4            boot<br \/>\n 2      8054MB  8589MB  535MB   extended<br \/>\n 5      8054MB  8589MB  535MB   logical   linux-swap(v1)<\/p>\n<p>(parted) rm 5<br \/>\nWarning: Partition \/dev\/sda5 is being used. Are you sure you want to continue?<br \/>\nYes\/No? Yes<br \/>\nError: Partition(s) 5 on \/dev\/sda have been written, but we have been unable to<br \/>\ninform the kernel of the change, probably because it\/they are in use.  As a<br \/>\nresult, the old partition(s) will remain in use.  You should reboot now before<br \/>\nmaking further changes.<br \/>\nIgnore\/Cancel? I<br \/>\n(parted) rm 2<br \/>\nError: Partition(s) 5 on \/dev\/sda have been written, but we have been unable to<br \/>\ninform the kernel of the change, probably because it\/they are in use.  As a<br \/>\nresult, the old partition(s) will remain in use.  You should reboot now before<br \/>\nmaking further changes.<br \/>\nIgnore\/Cancel? I<br \/>\n&#8212;<br \/>\n4. lanjutkan dengan resize partisi \/dev\/sda1 :<br \/>\n&#8212;<br \/>\n(parted) resizepart \/dev\/sda1<br \/>\nError: Expecting a partition number.<br \/>\n(parted) resizepart 1<br \/>\nWarning: Partition \/dev\/sda1 is being used. Are you sure you want to continue?<br \/>\nYes\/No? Yes<br \/>\nEnd?  [8053MB]? 33.4GB<br \/>\n&#8212;<br \/>\npartisi \/dev\/sda1 kita ubah menjadi 33.4GB dan menyisakan 1.0GB untuk swap.<\/p>\n<p>5. langkah dibawah ini untuk melakukan create ulang swap partisi yang tadinya dihapus :<br \/>\n&#8212;<br \/>\n(parted) mkpart primary linux-swap 33.4GB 34.4GB<br \/>\n&#8212;<\/p>\n<p>6. karena ubuntu menggunakan UUID dan kode nya tidak akan sama lagi akibat resize dan swap yang dihapus pada langkah no.3, maka sesuaikan aja isi \/etc\/fstab :<br \/>\nnano \/etc\/fstab<br \/>\n&#8212;<br \/>\n\/dev\/sda1 \/               ext4    errors=remount-ro 0       1<br \/>\n\/dev\/sda2 none            swap    sw              0       0<br \/>\n&#8212;<br \/>\nreboot vm nya agar dibaca konfigurasi fstab yang baru&#8230;<\/p>\n<p>7. langkah terakhir adalah mengenalkan hdd size  \/dev\/sda1 yang baru ke sistem :<br \/>\n&#8212;<br \/>\nroot@docker-ce:~# resize2fs \/dev\/sda1<br \/>\n&#8212;<\/p>\n<p>cek hasil resize pada \/dev\/sda1 apakah sudah bertambah kapasitas nya?<br \/>\n&#8212;<br \/>\nroot@docker-ce:~# df -h<br \/>\nFilesystem      Size  Used Avail Use% Mounted on<br \/>\n&#8230;<br \/>\n\/dev\/sda1        31G  3.0G   27G  11% \/<br \/>\n&#8230;<\/p>\n<p>untuk meyakinkan hasil resize hdd bisa berjalan dengan baik&#8230;reboot vm nya&#8230;<\/p>\n<p>selamat mencoba!.. D.W.Y.O.R bro!<\/p>\n<p>referensi sumber :<br \/>\nhttps:\/\/www.tecmint.com\/parted-command-to-create-resize-rescue-linux-disk-partitions\/<br \/>\nhttps:\/\/linuxadmin.io\/using-parted-create-new-swap-disk\/<br \/>\nhttps:\/\/askubuntu.com\/questions\/24027\/how-can-i-resize-an-ext-root-partition-at-runtime<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Lagi asyik belajar ngoprek &#8216;docker&#8217; di vm&#8230;loh koq waktu &#8216;yum\/apt-get update&#8217; nongol pesan &#8216;insufficient disk space&#8217;..dan cek ke &#8216;df -h&#8217;, ternyata hdd root &#8216;\/&#8217; nya udah 99%&#8230;.waduh! Daripada harus install ulang VM, lebih baik belajar resize hdd nya aja ya?..yuk ah kita mulai : 1. anggaplah posisi awal hdd pada \/dev\/sda sebagai berikut : \/dev\/sda1 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-354","post","type-post","status-publish","format-standard","hentry","category-linux-server"],"_links":{"self":[{"href":"https:\/\/kloxo.web.id\/index.php?rest_route=\/wp\/v2\/posts\/354","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kloxo.web.id\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kloxo.web.id\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kloxo.web.id\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/kloxo.web.id\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=354"}],"version-history":[{"count":2,"href":"https:\/\/kloxo.web.id\/index.php?rest_route=\/wp\/v2\/posts\/354\/revisions"}],"predecessor-version":[{"id":358,"href":"https:\/\/kloxo.web.id\/index.php?rest_route=\/wp\/v2\/posts\/354\/revisions\/358"}],"wp:attachment":[{"href":"https:\/\/kloxo.web.id\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=354"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kloxo.web.id\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=354"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kloxo.web.id\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=354"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}