Increase the space on your ownCloud or Nextcloud VM
This is a guide on how to extend the space on a Ubuntu 14.04/16.04/18.04 with a LVM file system hosted on VMware.
Please note that this guide won’t work for /mnt/ncdata on Nextcloud VMs from 13.0.2 and onwards due to a new file system called ZFS in the later versions of the VM. Though there’s a community member who has taken the time to write a new guide
The pre-configured VM holds a data disk that is ~40 GB as you may have noticed. We decided to make it that size because in most cases that’s enough, but not always. Here is a guide on how to add space to the existing VM. Use this to expand your space with an additional hard drive, partition or existing space on the hard drive that you choose to have the VM on. You can also use this guide made by a user of the VM.
Make a backup of your pre-configured Vm!
Shut down the VM
Extend your Virtual DISK
Use VMware or VirutalBox do to this, and after it’s done you have to make it available to your ownCloud VM
Boot the VM
Log in as ocadmin/ncadmin and then become root
:~$ sudo -i
SCAN the new disk space
:~$ echo "- - -" > /sys/class/scsi_host/host0/scan
Use CFDISK to make a new partition
:~$ cfdisk /dev/sda
Create new partition
Select the empty drive and choose [New]:
When it asks you for the size, just press [enter] to choose the entire disk.
Change Hex code
Enter filesystem type: 8E (Linux LVM)
Write changes to disk
Are you sure you want to write the partition table to disk? (yes or no): yes
Rescan the partitions
:~$ partprobe -s
check the nEWly created partition
:~$ fdisk -l
Likley it appears as /dev/sda6
Format the partition
Use the partition you identified in the previous step and type
:~$ mkfs.ext4 /dev/sda6
Create new partition
:~$ pvcreate /dev/sda6
Extend the Volume Group
:~$ vgextend owncloud-vg /dev/sda6
:~$ lvextend -L+XXG /dev/nextcloud-vg/root
Change XX to the same amount you extended the .vmdk with.
Resize the disk to the new size
:~$ resize2fs /dev/nextcloud-vg/root
:~$ sudo reboot
Check new space after you rebooted
:~$ df -h