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?
2 Answers
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.
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
-
This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker. - From Review Commented Jul 23, 2022 at 5:40
-
This is how I actually resized the disk on my Ubuntu VM on a Synology Disk Station. Did you pay atention?– JB68Commented Dec 27, 2023 at 19:26
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