Skip to content

speters.org

all t3h ev1l things that you can imagine

Menu
  • About
  • impressum
Menu

Online disk resize

Posted on 2024-02-14 by serge

Alright. Things, that I always tend to forget is how to resize online the volume after the VMware guys did resize the disk of a VM.

1. Rescan

Before re-scan of the block device check the size. You can see here, that sda has the size of 450GB. It should be 500GB.

# lsblk
NAME                MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda                   8:0 0 450G 0 disk
??sda1                8:1 0 1M 0 part
??sda2                8:2 0 2G 0 part /boot
??sda3                8:3 0 448G 0 part
  ??system-swap     253:0 0 4G 0 lvm [SWAP]
  ??system-root     253:1 0 15G 0 lvm /
  ??system-var--log 253:2 0 5G 0 lvm /var/log
  ??system-docker   253:3 0 415.1G 0 lvm /var/lib/docker
sr0                  11:0 1 1024M 0 rom

Do the fancy rescan:

echo 1 > /sys/block/sda/device/rescan

Check again. You see, that the disk has now the size of 500GB.

# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 500G 0 disk
??sda1 8:1 0 1M 0 part
??sda2 8:2 0 2G 0 part /boot
??sda3 8:3 0 448G 0 part
  ??system-swap 253:0 0 4G 0 lvm [SWAP]
  ??system-root 253:1 0 15G 0 lvm /
  ??system-var--log 253:2 0 5G 0 lvm /var/log
  ??system-docker 253:3 0 415.1G 0 lvm /var/lib/docker
sr0 11:0 1 1024M 0 rom

2. Resize

I am simpleminded. If there are more, than 3 partitions, you have to destroy the partition table, and resize it. Can’t do it. I always fail. Luckily there are only 3 of them, so I use growpart to resize the 3rd partition. It can be found in the cloud-guest-utils package.

# growpart /dev/sda 3

Now check again. Now you see, that /dev/sda3 is resized.

# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 500G 0 disk
??sda1 8:1 0 1M 0 part
??sda2 8:2 0 2G 0 part /boot
??sda3 8:3 0 498G 0 part
  ??system-swap 253:0 0 4G 0 lvm [SWAP]
  ??system-root 253:1 0 15G 0 lvm /
  ??system-var--log 253:2 0 5G 0 lvm /var/log
  ??system-docker 253:3 0 415.1G 0 lvm /var/lib/docker
sr0 11:0 1 1024M 0 rom

3. Logical volume stuff

Alright, that you have it, check the physical volume:

# pvs
  PV         VG     Fmt  Attr PSize    PFree 
  /dev/sda3  system lvm2 a--  <448.00g <58.94g

Resize the volume according to your needs:

# lvresize -rL+50G /dev/mapper/system-docker

Categories

  • bike
  • c0de
  • cigars
  • followerpower
  • lecker
  • nöt züri
  • OPs
  • serge in danger
  • sinnfrei
  • sport
  • züri

Comments

  • enkei on men’s room
  • serge on delete last 3 files
  • enkei on delete last 3 files
  • serge on norman antivirus + eclipse + heap space
  • serge on heidelbeer muffins

Blogroll

  • blafasel.org
  • floriankohl.de
  • ichundderbaer.de
  • kunkelundkohl.de
  • revista verlag

Archives

  • February 2024 (1)
  • July 2018 (1)
  • June 2018 (2)
  • May 2018 (1)
  • April 2018 (2)
  • October 2017 (1)
  • September 2017 (4)
  • August 2017 (1)
  • July 2017 (1)
  • June 2017 (5)
  • May 2017 (2)
  • October 2013 (2)
  • September 2013 (1)
  • August 2013 (2)
  • June 2013 (1)
  • May 2012 (1)
  • February 2012 (2)
  • May 2011 (1)
  • September 2010 (2)
  • August 2010 (2)
  • April 2010 (2)
  • March 2010 (1)
  • February 2010 (1)
  • October 2009 (2)
  • August 2009 (1)
  • June 2009 (1)
  • August 2008 (2)
  • July 2008 (2)
  • June 2008 (2)
  • April 2008 (5)
  • July 2007 (3)

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org
May 2025
M T W T F S S
 1234
567891011
12131415161718
19202122232425
262728293031  
« Feb    
© 2025 speters.org | Powered by Minimalist Blog WordPress Theme