

Disk quota¶
Note
This only applies to self hosted Scalr.
Scalr customers are recommended to configure disk quota. The function of using disk quotas is to allocate limited disk space in a reasonable way.
Configuration of the xfs volume¶
To enable disk quota, xfs volume, mounted in advance with “pquota” option is required.
To mount xfs volume with “pquota” option:
Create xfs volume:
mkfs.xfs /dev/device
Mount xfs volume:
# create directory to mount disk to mkdir /path/to/directory # mount volume to specified directory mount /dev/device /path/to/directory
To confirm, that
/path/to/directory
is actually using the xfs volume:# command mount | grep ' /path/to/directory ' # expected output /dev/device on /path/to/directory type xfs (rw,relatime,attr2,inode64,noquota)
If you see “noquota” in the xfs mount options for the
/dev/device
:Edit the file
/etc/default/grub
:Find the line with the variable “GRUB_CMDLINE_LINUX”, that might look like this (it may not look exactly the same, don’t worry):
GRUB_CMDLINE_LINUX="rd.lvm.lv=centos/swap vconsole.font=latarcyrheb-sun16 rd.lvm.lv=centos/root crashkernel=auto vconsole.keymap=us rhgb quiet"
Put a “rootflags=” variable at the end of the line, add uquota,pquota as the values
GRUB_CMDLINE_LINUX="rd.lvm.lv=centos/swap vconsole.font=latarcyrheb-sun16 rd.lvm.lv=centos/root crashkernel=auto vconsole.keymap=us rhgb quiet rootflags=uquota,pquota"
Based on provided setup, backup and create a new grub.cfg file:
cp /boot/grub2/grub.cfg /boot/grub2/grub.cfg.orig grub2-mkconfig -o /boot/grub2/grub.cfg
Note
Path of the grub.cfg file is different on centos. Please use the following:
cp /boot/efi/EFI/centos/grub.cfg /boot/efi/EFI/centos/grub.cfg.orig grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg
Reboot the system
reboot
When the system is live again, check that usrquota and prjquota are enabled:
# command mount | grep ' /path/to/directory ' # expected output /dev/device on /path/to/directory type xfs (rw,relatime,attr2,inode64,usrquota,prjquota)
Backup of data¶
Note
This only applies if disk quota is configured for already installed Scalr. Skip if this is a first installation.
When disk quota is enabled, Scalr uses non-default directories for tf-worker and docker services. Any data stored in those directories (docker images, tf-worker tasks results, etc.) will be lost. To prevent data loss, those directories have to be backed up.
To backup docker and tf-worker directories:
Create any directory where backup will be stored
mkdir /backup
Backup directories using tar
tar -cvpzf /backup/docker_backup.tar.gz /opt/scalr-server/var/lib/docker tar -cvpzf /backup/tf_worker_backup.tar.gz /opt/scalr-server/var/lib/tf-worker
Configuration of the disk quota¶
To enable disk quota:
Update the
/opt/scalr-server/embedded/cookbooks/scalr-server/attributes/default.rb
file on the app server:# has to be true default[:scalr_server][:app][:disk_quota][:enable] = true # directory on the xfs volume default[:scalr_server][:app][:disk_quota][:home_dir] = /path/to/directory
Run
scalr-server-ctl reconfigure
on the app server.Restore tf-worker and docker directories from the backup.
Note
This only applies if disk quota is configured for already installed Scalr. Skip if this is a first installation.
# /path/to/directory is the directory previously specified in disk quota configuration tar -xvf /backup/docker_backup.tar.gz -C /path/to/directory/docker tar -xvf /backup/tf_worker_backup.tar.gz -C /path/to/directory/tf-worker