save 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 with a LVM file system hosted on VMware. 

The pre-configured VM is ~20 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.

It’s now possible to download a 500 GB or a 1 TB VM  directly.

  1. Make a backup of your pre-configured Vm!
  2. Shut down the VM
  3. 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

    vmware1vmware2

  4. Boot the VM

    Log in as ocadmin/ncadmin and then become root

    :~$ sudo -i
  5. SCAN the new disk space
    :~$ echo "- - -" > /sys/class/scsi_host/host0/scan
  6. Use CFDISK to make a new partition
    :~$ cfdisk /dev/sda
  7. Create new partition

    Choose [Logical]

    [Primary]  [Logical] [Cancel ]

    When it asks you for the size, just press [enter] to choose the entire disk.

  8. Change Hex code

    Choose [Type]

    Enter filesystem type: 8E
  9. Write changes to disk
    Are you sure you want to write the partition table to disk? (yes or no): yes
  10. Quit cfdisk

    [Quit]

  11. Rescan the partitions
    :~$ partprobe -s
  12. check the nEWly created partition
    :~$ fdisk -l

    Likley it appears as /dev/sda6

  13. Format the partition

    Use the partition you identified in the previous step and type

    :~$ mkfs.ext4 /dev/sda6
  14. Create new partition
    :~$ pvcreate /dev/sda6
  15. Extend the Volume Group
    :~$ vgextend owncloud-vg /dev/sda6
    :~$ lvextend -L+XXG /dev/owncloud-vg/root

    Change XX to the same amount you extended the .vmdk with.

  16. Resize the disk to the new size
    :~$ resize2fs /dev/owncloud-vg/root
  17. Reboot
    :~$ sudo reboot
  18. Check new space after you rebooted
    :~$ df -h


 Pro tip

Secure your ownCloud against brute-force attempts. Setup Fail2ban! If you use Nextcloud you don’t need to, it’s built in.