../../_images/login_button.png ../../_images/signup_button.png



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:

  1. Create xfs volume:

    mkfs.xfs /dev/device
    
  2. 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:

    1. 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"
      
    2. 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"
      
    3. 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
      
    4. Reboot the system

      reboot
      
    5. 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:

  1. Create any directory where backup will be stored

    mkdir /backup
    
  2. 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:

  1. 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
    
  2. Run scalr-server-ctl reconfigure on the app server.

  3. 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