If your FileCap server is not having enough disk space left and you want to expand the disk this can be done by following these steps.
Important: Please be aware that making changes to hard disk size/partitions can cause data loss if something goes wrong. Make sure you have a full backup of the FileCap Server.
Determine the correct procedure
- Login to the FileCap server with SSH
- In the console menu choose option 3. “Admin prompt”.
- Determine if the FileCap server is using LVM partitioning or not
To do this enter the command: ‘fdisk -l’ and review the result.- If you see “Linux LVM” (like in the image above) the FileCap server is using LVM and you can continue to “Steps if the FileCap Server is using LVM“.
- If you don’t see “Linux LVM” anywhere the FileCap server is probably not using LVM, please continue to “Steps if the FileCap server is using something else”.
Steps if the FileCap server is using LVM
- Backup the whole FileCap server, because we are changing partitions something can go wrong, so a backup is necessary.
- Expand the virtual disk (in VMware/Hyper-V) to the desired size. (For advised hard disk sizing see the chapter “System requirements“)
- Login to the FileCap server with SSH
- In the console menu choose option 3. “Admin prompt”
- Create a new partition with the command: ‘fdisk -c /dev/sda’
- Enter: ‘n’, to create a new partition
- Enter: ‘p’, to create a new primary partition
- Choose the default partition number (in the example: 3, so it will create /dev/sda3)
- Cilinder values choose the default as fdisk will give you a default value for the first and last cylinder. Note: the cylinder values will vary on your system.
- Enter: ‘t’, to change the partition type
- Enter the partition number (in this example: 3)
- Enter the partition type: ‘8e’
- Enter: ‘w’, to write changes to disk.
You’ll get a message about the kernel still using the old partition table, and to reboot to use the new table. The reboot is not needed as you can also rescan for those partitions using partx.Run the following to scan for the newly created partition: ‘partx -v -a /dev/sda’. If that still does not show you the newly created partition for you to use, you have to reboot the server.
- Afterwards, you can see the newly created partition with fdisk by entering: ‘fdisk -l /dev/sda’
- Create a physical volume with command: ‘pvcreate /dev/sda3’ (Please replace /dev/sda3 with the newly created partition)
- Find out how your Volume Group is called with the command ‘vgdisplay’ in this example it is called “filecap-vg”
- Extend the volume group by adding the physical volume with the command: ‘vgextend filecap-vg /dev/sda3’ (Please replace /dev/sda3 with the newly created partition and filecap-vg with your volumegroup name)
- With ‘pvscan’, we can see our newly added physical volume, and the usable space (16GB in this case).
- Use the command ‘lvextend /dev/filecap-vg/root /dev/sda3’ to expand the Logical Volume.
- Resize the file system to the volume group, so we can use the space. Enter the command: ‘resize2fs /dev/filecap-vg/root’ (Please replace filecap-vg with your volumegroup name)
- The Filesystem is now extended, you can check this with the command ‘df -h’ to see the available space.
Steps if the FileCap server is using something else
- Backup the whole FileCap server, because we are changing partitions something can go wrong, so a backup is necessary.
- Download the latest stable version of the partition manager GParted ISO file from https://gparted.org/download.php
- Shutdown the FileCap server
- Expand the virtual disk (in VMware/Hyper-V) to the desired size. (For advised hard disk sizing see the chapter “System requirements“)
- Connect the GParted ISO file to the FileCap virtual machine.
- Boot the FileCap server from ISO file.
- Select “Don’t touch keymap”
- Keep the default language US English, option “33” press enter.
- Keep the default mode, option “0” press enter.
- Now GParted would start automatically and you see the next screen.
Note: This screen can be different on every server depending on hard disk size and previous partitioning.
- First we need to extend the Extended partition (/dev/sda2 color light blue)
Click on the rule /dev/sda2 and click the “Resize/Move” button. - Move the bar to the right, like this:
- If you moved the bar you see this, and you can click the “Resize/Move” button:
- When step 13 is completed you get back to the overview and the /dev/sda2 partition is wider.
- Now we need to extend the /dev/sda6 ext4 partition (/dev/sda6 color dark blue)
Click on the rule /dev/sda6 and click the “Resize/Move” button. - Move the bar to the right, like this:
- If you moved the bar you see this, and you can click the “Resize/Move” button:
- When step 17 is completed you get back to the overview and the /dev/sda6 partition is wider.
- Now you can click the “Apply” button, next you see the following message where you also can click on “Apply” to change the partition.
Note: Please make sure you have a full backup of the FileCap server before applying. - Wait for all operations to be completed
- The partitions are now changed and the free space is added. Gparted can now be closed
- Now you can shutdown the server by clicking “Exit” and after that choose “Shutdown”.
- Disconnect the GParted ISO file from the FileCap virtual machine.
- Start the FileCap server, the disk is now expanded.
Check disk space
- Login to the FileCap server with SSH
- in the console menu choose option 3. “Admin prompt”
- Enter the command ‘df -h’ to check used/available disk space.