How to extend ownCloud storage


#1

Hello,

I am kind of new with this and my search did not help me find any solutions that I could understand. In short, I am trying to expand the default disk size of the ownCloud server (from 50Go) to a full 350Go. It is already done in VMware but were do I make it available in the server and/or in ownCloud?

Thanks,

Ozan


#2

Hi,

so I guess you have already resized your VM’s Virtual Disk, right?

And now your are wondering why the extra space is not shown in the ownCloud Appliance, right?

I suggest you do the following steps, after you logged in to your VM:

Start parted, resize the main partition, exit the shell and reboot the VM.


#3

Hi Dimitri,

Thanks but it does not work when I try “parted” when I am logged as “root” or even “Administrator”. When I type “sudo -i”, it goes back to “root@a1000: ~#” … like if I never typed anything. Its weird.

Ozan


#4

Hi,

sorry of being so late. But yes, it is somehow a pain to resize the Owncloud-Appliance.

I just did it today, check the steps (these steps are valid for a Owncloud image downloaded just recently, some numbers might change in later or earlier editions):

1. Extend the HDD of the virtual machine (VM) itself

a. Power off the VM
b. Edit Settings and extend from 50GB to the desired size
c. Take a snapshot for rollback in case something goes wrong
d. Power on the VM

2. Edit partition table

a. Login on the command line as root
b. fdisk /dev/sda
c. Print current partition table, note the "start" values of /dev/sda2 and /dev/sda5
Command (m for help): p
Disk /dev/sda: 150 GiB, 161061273600 bytes, 314572800 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x1ed9986f

Device     Boot   Start       End   Sectors  Size Id Type
/dev/sda1  *       2048    999423    997376  487M 83 Linux
/dev/sda2       1001470 104855551 103854082 49,5G  5 Extended
/dev/sda5       1001472 104855551 103854080 49,5G 8e Linux LVM

d. Delete (yes!) partition 5 and 2 (in that order!)
Command (m for help): d
Partition number (1,2,5, default 5): 5

Partition 5 has been deleted.

Command (m for help): d
Partition number (1,2, default 2): 2

Partition 2 has been deleted.
e. Re-Create the logical partition /dev/sda2 with the starting block as noted above (usually 1001470)
Command (m for help): n
Partition type
   p   primary (1 primary, 0 extended, 3 free)
   e   extended (container for logical partitions)
Select (default p): e
Partition number (2-4, default 2): 
First sector (999424-314572799, default 999424): 1001470
Last sector, +sectors or +size{K,M,G,T,P} (1001470-314572799, default 314572799): 

Created a new partition 2 of type 'Extended' and of size 149,5 GiB.
f. Re-create the extended partition /dev/sda5 with a whatever starting point (just press enter both times!). Take care NOT to remove the ext4 signature!
Command (m for help): n
All space for primary partitions is in use.
Adding logical partition 5
First sector (1003518-314572799, default 1003520): 
Last sector, +sectors or +size{K,M,G,T,P} (1003520-314572799, default 314572799): 

Created a new partition 5 of type 'Linux' and of size 149,5 GiB.
Partition #5 contains a ext4 signature.

Do you want to remove the signature? [Y]es/[N]o: n
g. Change into the Expert menu and set the beginning of you new /dev/sda5 to the previously noted value (usually 1001472):
Command (m for help): x

Expert command (m for help): b
Partition number (1,2,5, default 5): 
New beginning of data (1001471-314572799, default 1003520): 1001472 

h. Verify starting numbers of /dev/sda2 and /dev/sda5 are the same as noted above in step 2c.
Expert command (m for help): p

Disk /dev/sda: 150 GiB, 161061273600 bytes, 314572800 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x1ed9986f

Device     Boot   Start       End   Sectors Id Type     Start-C/H/S End-C/H/S Attrs
/dev/sda1  *       2048    999423    997376 83 Linux        0/32/33  62/53/55    80
/dev/sda2       1001470 314572799 313571330  5 Extended    62/86/23  125/64/3      
/dev/sda5       1001472 314572799 313571328 83 Linux      62/118/57  125/64/3      

i. Leave the expert menu and write the partition table to disk, leave fdisk
Expert command (m for help): r

Command (m for help): w

The partition table has been altered.
Calling ioctl() to re-read partition table.
Re-reading the partition table failed.: Das Gerät oder die Ressource ist belegt

The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8).

j. Reboot the VM; it should come up properly

3. Resize LVM and filesystem


a. Login again to the VM as in previous steps
b. Resize physical volume: pvresize /dev/sda5
root@owncloud:~# pvresize /dev/sda5
  Physical volume "/dev/sda5" changed
  1 physical volume(s) resized / 0 physical volume(s) not resized
c. Verify it has been resized, the line "Free PE" should NOT be zero!
root@owncloud:~# pvdisplay -v
    Wiping internal VG cache
    Wiping cache of LVM-capable devices
  --- Physical volume ---
  PV Name               /dev/sda5
  VG Name               vg_ucs
  PV Size               149,52 GiB / not usable 2,00 MiB
  Allocatable           yes 
  PE Size               4,00 MiB
  Total PE              38277
  Free PE               25600
  Allocated PE          12677
  PV UUID               eEOcDZ-x27e-ivIp-HAUf-Um67-t5MP-Pzbdp2
d. Resize the logical volume and use the number of FreePE from 3c.
root@owncloud:~# lvresize /dev/vg_ucs/root -l +25600
  Size of logical volume vg_ucs/root changed from 47,52 GiB (12165 extents) to 147,52 GiB (37765 extents).
  Logical volume vg_ucs/root successfully resized.
e. Resize the filesystem itself:
root@owncloud:~# resize2fs /dev/vg_ucs/root 
resize2fs 1.43.4 (31-Jan-2017)
Dateisystem bei /dev/vg_ucs/root ist auf / eingehängt; Online-Größenänderung ist
erforderlich
old_desc_blocks = 10, new_desc_blocks = 19
Das Dateisystem auf /dev/vg_ucs/root is nun 38671360 (4k) Blöcke lang.
f. Verify by df:
root@owncloud:~# df -h
Dateisystem             Größe Benutzt Verf. Verw% Eingehängt auf
udev                      10M       0   10M    0% /dev
tmpfs                    292M     17M  276M    6% /run
/dev/mapper/vg_ucs-root  143G    3,6G  133G    3% /
tmpfs                    730M       0  730M    0% /dev/shm
tmpfs                    5,0M       0  5,0M    0% /run/lock
tmpfs                    730M       0  730M    0% /sys/fs/cgroup
/dev/sda1                472M     61M  387M   14% /boot
overlay                  143G    3,6G  133G    3% /var/lib/docker/overlay/662d4e26b808c849850c03b569052b578f311fde1afce09df1bcc9bfd9d63227/merged
shm                       64M       0   64M    0% /var/lib/docker/containers/332300a8c307b732a76bf22720b5585a14b53aab5fc969783253add8c8543109/shm

All done now. You Owncloud appliance now has more disk space available.
Note: It would be much easier to do if Owncloud had mounted /var on a different disk!

/KNEBB