TAGS

There are no tags associated with this article.

How to attach a volume and migrate Sen4CAP products

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. First, we need to 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.

 

and select the newly created volume from the menu:

 

Now everything is ready for the instance to mount additional space for Sen4CAP applications. Check new volume available in the system with "lsblk" command.

New volume should be visible without partition yet.

[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    2T  0 disk 

Run fdisk command to create a new partition for the volume

[eouser@sen4cap ~]$ sudo fdisk /dev/sdb
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0x35c1317a.

WARNING: The size of this disk is 2.2 TB (2199023255552 bytes).
DOS partition table format can not be used on drives for volumes
larger than (2199023255040 bytes) for 512-byte sectors. Use parted(1) and GUID 
partition table format (GPT).

Change the partition type to GPT. This allows you to create partitions bigger than 2TB.

Command (m for help): g

Created a new GPT disklabel (GUID: 05B2F3D8-CB60-1648-BD91-D163FEDE4DFC).

Type n to create a new partition

Command (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): 

Type p select primary partition

Using default response p
Partition number (1-4, default 1): 
First sector (2048-4294967295, default 2048): 
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-4294967294, default 4294967294): 
Using default value 4294967294
Partition 1 of type Linux and of size 2 TiB is set

Type w to write changes

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

Format new partition with the command

sudo mkfs.ext4 /dev/sdb1

We have volume partition ready. We need to mount it somewhere temporary to move Sen4CAP data. In this example, we will use /disk directory

sudo mkdir /disk
sudo chmod 777 /disk/
sudo mount /dev/sdb1 /disk/

Stop Sen4CAP services

sudo systemctl stop sen2agri-services

Sen4CAP keeps downloaded data in /mnt. We need to sync all data from /mnt directory to the volume. We can do it with rsync command like on the following example:

sudo rsync -rtva /mnt/ /disk/

When there is a lot of data and rsync will stop you can resume it with the same command. When rsync finish coping, delete the content of /mnt directory and edit fstab:

sudo nano /etc/fstab

Add the following line:

/dev/sdb1 /mnt ext4 rw,user,exec 0 0

Reboot the system with

sudo reboot

That is all. You can see additional space available in Sen4CAP Panel. You can delete /disk directory as it will be no longer needed.