How to attach a volume and migrate Sen4CAP products on WEkEO Elasticity
Sen4CAP may need a lot more space than was initially planned. The easiest way to extend space for Sen4CAP applications is to attach the additional volume.
Prerequisites
No 1. Account
You need a WEkEO Elasticity hosting account with access to the Horizon interface: https://horizon.cloudferro.com.
No. 2 Sen4CAP already created
If you need to create a new VM for Sen4CAP, this article will be of help: How to access Sen4CAP.
Create a volume
First, create a volume. In OpenStack Dashboard go to Project → Volumes → Volumes and select Create Volume.
Name your new volume and provide a size
When the new volume is created navigate to Project → Compute → Instances and attach the new volume.
Then select the newly created volume from the menu:
Check visibility of the new volume
Now everything is ready for the instance to mount additional space for Sen4CAP applications. Run lsblk command to check whether the new volume is available within the system.
[eouser@sen4cap ~]$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 128G 0 disk
└─sda1 8:1 0 128G 0 part /
sdb 8:16 0 5T 0 disk
We see that the new volume is visible in the system as sdb.
Create a new partition
Create a new partition with mkfs. The following command will format the new volume with all available space there.
[eouser@sen4cap ~]$ sudo mkfs.ext4 /dev/sdb
Here is the entire output of that command; note that you will have to confirm that you want to proceed with the creation of new partition.
[eouser@sen4cap ~]$ sudo mkfs.ext4 /dev/sdb
mke2fs 1.42.9 (28-Dec-2013)
/dev/sdb is entire device, not just one partition!
Proceed anyway? (y,n) y
Discarding device blocks: done
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
167772160 inodes, 1342177280 blocks
67108864 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=3489660928
40960 block groups
32768 blocks per group, 32768 fragments per group
4096 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000, 214990848, 512000000, 550731776, 644972544
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
Create temporary location to move the partition
We now have the volume partition ready. To move Sen4CAP data, you need to mount it to a temporary location. In this example, we will use /disk directory:
sudo mkdir /disk
sudo chmod 777 /disk/
sudo mount /dev/sdb /disk/
Stop Sen4CAP services:
sudo systemctl stop sen2agri-services
Mount the partition
Sen4CAP keeps downloaded data in folder /mnt. Use rsync command to sync all data from /mnt directory to the volume.
sudo rsync -rtva /mnt/ /disk/
When there is a lot of data and rsync would stop, issue the same command again – rsync will continue where it stopped. When finished, compare the sizes of directories to check that rsync ran properly.
[eouser@sen4cap ~]$ du -hs /mnt/
22G /mnt/
[eouser@sen4cap ~]$ du -hs /disk/
22G /disk/
Enter volume into fstab
When volume is ready, we need to add a proper entry in fstab to have it mounted automatically on every reboot. Label your new volume with the following command:
[eouser@sen4cap /]$ sudo e2label /dev/sdb volume1
[eouser@sen4cap /]$ lsblk --fs /dev/sdb
NAME FSTYPE LABEL UUID MOUNTPOINT
sdb ext4 volume1 930affa6-8971-47c8-8591-e46e9333c34b
The result of command lsblk –fs /dev/sdb is, in this example, string 930affa6-8971-47c8-8591-e46e9333c34b under UUID header; you will, of course, get something else so use that string to make a change in fstab. First open fstab:
sudo nano /etc/fstab
then add the following line, using your own UUID:
UUID=930affa6-8971-47c8-8591-e46e9333c34b /mnt ext4 rw,user,exec 0 0
Delete the content of /mnt directory
Warning
Sen4CAP uses /mnt directory to keep its data. There should be two directories only in /mnt directory: archive and upload. If there is anything else in your system, check what is the origin of that data. Linux systems use /mnt directory to mount drives.
Unmount and mount volume back according to fstab entry:
sudo umount -lf /disk && sudo mount -a
Start Sen4CAP services.