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.

Before any other action it good to make a backup copy of the instance. You can use "Create Snapshot" option in the instance menu.

The new volume should be visible in your system. Run "lsblk" command to see attaches by system name.

[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

From the out above we can see the new volume is visible in the system as sdb. 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
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

We have the 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/sdb /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 would stop you can resume the syncing with the same command. rsync will continue where stopped. When finished, compare the sizes of directories to check rsync went properly.

[eouser@sen4cap ~]$ du -hs /mnt/
22G /mnt/
[eouser@sen4cap ~]$ du -hs /disk/
22G /disk/

When volume is ready we need to add a proper entry in fstab to have it mounted automatically 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

UUID showed by your "lsblk --fs /dev/sdb" command will be used in the next step with fstab

Edit fstab:

sudo nano /etc/fstab

Add the following line (use your own UUID):

UUID=930affa6-8971-47c8-8591-e46e9333c34b    /mnt            ext4    rw,user,exec 0 0

Delete the content of /mnt directory

Sen4CAP uses /mnt directory to keep its data. There should be two directories only in /mnt directory: "archive" and "upload". If there anything else in your system please 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.