-1

I've created a Virtual Machine in Synology Disk Station Manager (an ubuntu server) with a specific amount of storage space in a virtual disk, but I have depleted it. Went to Synology Disk Station / Virtual Machine Manager again and expanded the virtual disk; however, the space is not recognized inside Ubuntu Server. How can I fix this?

enter image description here

BMM
  • 151
  • 3
  • 10
  • You'll need to grow the partition inside your Ubuntu server. Run `lsblk` and look for your device (It might be "sda" or "sdb" or something). Then run: `sudo parted /dev/sda --print` (replace "sda" with your actual device) to get the partition information on Ubuntu. If it's ext4, then chances are, you just need to run the following command: `sudo resize2fs /dev/sda` – David W Dec 13 '20 at 19:32
  • Thank you. I have updated the question with an image. What I need to resize is a logical volume (ubuntu--vg-ubuntu--lv) which resides inside sda3. As shown, sda3 has 29G available while the logical volume is only using 19GB. – BMM Dec 13 '20 at 20:02

2 Answers2

0

I have managed to find a solution. First I booted the system using GParted Live ISO and used the "VERIFY" command on the partition that was showing an exclamation mark, which was the right one. Then booted into the virtual machine and, in the command line, expanded the LVM and filesystem using the commands:

lvdisplay

(to identify the MOUNTPOINT), and then:

lvextend –l +100%FREE [MOUNTPOINT]

to extend the LVM partition and

resize2fs [MOUNTPOINT]

to resize the filesystem.

BMM
  • 151
  • 3
  • 10
0

I search a lot and ended up here however I found out that there is a more simple way that worked for me without the need to boot another image . After you resize your VM storage from synology interface, you should be able to see the free space. You can take advantage of it using normal tools like fdisk and create a new partition. If you want to grow your space without booting a different image you will be limited to last partition, in your case sda3. In order to do this, start your VM log into it and install growpart that is part of cloud-utills

sudo apt-get install -y cloud-utils

resize partition -> you can grow only the last partition from lsblk in my case was sda1

sudo growpart /dev/sda 1 1 is actual partition number ( ex sda1 )

resize your volume in my case I had ext4 sudo resize2fs /dev/sda1

You have a logical volume so that can span on multiple partitions so you can try ether to create a new partition then extend logical volume on it or just grow the exited one as I suggested. Here is more info on logical volumes. https://www.golinuxhub.com/2014/03/how-to-extendresize-lvm-and-volume

JB68
  • 1
  • 1
  • This does not provide an answer to the question. Once you have sufficient [reputation](https://serverfault.com/help/whats-reputation) you will be able to [comment on any post](https://serverfault.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/late-answers/526005) – Zareh Kasparian Jul 23 '22 at 05:40