How to extend ownCloud storage

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

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.

resize

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.

OzanUntitled

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

4 Likes

I need to extend the space on the harddrive of my owncloud. I followed this guide and this worked two times on different UCS ownclouds so far, but now with the 3 installation everytime i complete the first half my owncloud just stops working completely.

After the reboot the ucs is still up but the owncloud seems to be damaged. I can’t connect to the owncloud via browser ( Proxyerror, etc) . Restarting Apache won’t help. Trying to get into the docker container is impossible (it’ll display that owncloud is not running)

Why the heck isn’t there an easy way to resize the harddrive in UCS?

Edit:
In case someone runs intothe issue that after extending the harddrive the owncloud ist not reachable via webbrowser. In my case the service MariaDB wasn’t bale to start because the database log prohibited the correct start!

Excellent information. Thank you for taking the time to generate it.

I just wanted to pass on a “Duhhh” situation that can catch the stupid, like me.
When you get step 3d the last line in the code pane shows
Logical volume vg_ucs/root successfully resized.
and the first line outside of the code pane says
All done now. You Owncloud appliance now has more disk space available.

Don’t make the mistake of rebooting as there is another step 3e hiding from you. Scroll the code pane to show it.
Personal stupidity I know but if you didn’t make that backup copy mentioned at the start you now have a dead VM.

kudos, great procedure. Thanks.

If Mariadb doesn’t start after expanding the storage, It could be you just need to delete /var/lib/mysql/tc.log, this appears to work as I had mariadb not starting anymore. After a long search I found out deleting the log did help and everything is back up again!

Thank you so much for this incredibly excellent guide!
I did this twice already. One question though at last step when I check the df -h, I see everything 3 times.

:~$ sudo df -h
Fájlrendszer            Méret Fogl. Szab. Fo.% Csatol. pont
udev                      10M     0   10M   0% /dev
tmpfs                    1,6G   15M  1,6G   1% /run
/dev/mapper/vg_ucs-root  1,6T  166G  1,4T  11% /
tmpfs                    3,9G  4,0K  3,9G   1% /dev/shm
tmpfs                    5,0M     0  5,0M   0% /run/lock
tmpfs                    3,9G     0  3,9G   0% /sys/fs/cgroup
/dev/sda1                472M  164M  284M  37% /boot
overlay                  1,6T  166G  1,4T  11% /var/lib/docker/overlay/3e26e06c642e0059665715eb55a618100711bd1ac6c0adffeb384b23dd698cee/merged
overlay                  1,6T  166G  1,4T  11% /var/lib/docker/overlay/2919271de8755695a2ffb612cc3efa2b7a2355f7d461d7f094ba3b5c9c031709/merged
shm                       64M     0   64M   0% /var/lib/docker/containers/bdf5864bc9ac2d91f8114f62181d65ec1945e82b75dc993454fc8818010ce149/mounts/shm
shm                       64M     0   64M   0% /var/lib/docker/containers/6b171d15720a1d41d087f25b3146af62973bd1c4a285503b1cee39d595d8ee5d/mounts/shm
overlay                  1,6T  166G  1,4T  11% /var/lib/docker/overlay/694d747f5af9a5bc37625caf515acb8fc8b0ece252b1fa027844c59a32e9c1dc/merged
shm                       64M     0   64M   0% /var/lib/docker/containers/055e60e9a8cf18552a1047ba514a8aa119b4439551c89b2a38014eafa9c16867/mounts/shm
overlay                  1,6T  166G  1,4T  11% /var/lib/docker/overlay/e9a9d4ed928f4f326e446f82423d23f046041e852dc20486ccda444809dfd297/merged
overlay                  1,6T  166G  1,4T  11% /var/lib/docker/overlay/8670f21786d7ca625baf2f478cc5fe817e5045694fe8adcb50622ca25662a564/merged
overlay                  1,6T  166G  1,4T  11% /var/lib/docker/overlay/f0226db6550b8b7d5c572d983b0de7b7e3ee8d3e6dbcbdbb0a622f0e45a79799/merged
shm                       64M     0   64M   0% /var/lib/docker/containers/ada820b76668a43e117831f9c3fa550edfb9c69ecfb195b5e899d9ec98368f7f/mounts/shm
shm                       64M     0   64M   0% /var/lib/docker/containers/43c8d6857afe963ad025a28a64e00b2498f487f56edb9a7368a2dc84bebeebeb/mounts/shm
shm                       64M     0   64M   0% /var/lib/docker/containers/02bc1a60a7a099ef03e3e27ae2dff18e58152a7756bc83b5c97a84fede3170a8/mounts/shm

Should I do something about it?

Hi,

I guess this is docker related. Ignore it.

/CV

1 Like

Thank you for taking your time to create this tutorial. I wonder why this info is not part of the documentation.
Great help. Thank you again!

Mastodon