header-logo-left

The Lone Geek Blog

One geek in a sea of nerds.

header-logo-left

Resizing Root Fs for Ubuntu

| Comments

I needed to resize one of my VMs. This will serve as some better notes than what I see online.

1. Shutdown VM and open the ESXI WEB UI to resize the virtual disk and check a box to force the bios to open on power up.

2. Attach gparted iso to VM then power it up and adjust boot order to boot iso.

3. Once booted, deactivate LVM root volume and resize both extended and logical partitions to max disk size or as desired.

You should see something like this, with different sizes and uuid.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# vgdisplay
  --- Volume group ---
  VG Name               system
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  3
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               1
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               <15.52 GiB
  PE Size               4.00 MiB
  Total PE              3973
  Alloc PE / Size       2437 / <9.52 GiB
  Free  PE / Size       1536 / 6.00 GiB
  VG UUID               rVuKv3-0fim-f6CQ-4HJs-XqnE-Vaec-xc2jr9

4. Extend LVM Volume

1
# lvextend -l +1536 /dev/mapper/system-root

5. Extend filesystem.

1
# resize2fs /dev/mapper/system-root

6. End result. More space. :) Enjoy.

1
2
3
# df -h /
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/system-root   16G  8.3G  6.3G  57% /

Comments