Extend virtual machine disk size, enlarge filesystem

If you select “use entire disk and use LVM" during Ubuntu installation, the installer will use a weird disk topology:

  1. /boot on the first primary partition, sda1
  2. extended partition on sda3
  3. LVM partition on sda5

Super weird. So in order to enlarge the filesystem I decided to simply create a new partition and add it to LVM.

Quick notes on using fdisk:

fdisk /dev/sda
p
n
p
3
first sector is the end sector of the extended partition+1
reboot

Add sda3 to LVM, extend VG, extend LV, extend filesystem.

pvcreate /dev/sda3
vgextend xx-vg /dev/sda3
lvextend -l 100%FREE /dev/xx-vg/root
resize2fs /dev/xx-vg/root

發表迴響

在下方填入你的資料或按右方圖示以社群網站登入:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 變更 )

Twitter picture

You are commenting using your Twitter account. Log Out / 變更 )

Facebook照片

You are commenting using your Facebook account. Log Out / 變更 )

Google+ photo

You are commenting using your Google+ account. Log Out / 變更 )

連結到 %s