6.3. Managing Datastores

To keep your virtual machines and containers in Virtuozzo Storage, you can place them in datastores. A datastore is a directory in a Virtuozzo Storage cluster with a number of parameters set for it, namely tier, redundancy, and failure domain.

Warning

If you delete a datastore, all VMs, containers, or backups in it will be deleted!

6.3.1. Creating Datastores

To create a datastore, do the following:

  1. On the SERVICES > COMPUTE screen, click ADD DATASTORES.

    ../_images/stor_image46_2.png
  2. On the Add Datastore panel, specify a name.

  3. In Tier, select the storage tier that will be used for the object storage (explained in Understanding Storage Tiers).

  4. In Failure domain, choose a placement policy for replicas (explained in Understanding Failure Domains).

  5. In Data redundancy, select the redundancy mode that the datastore will use (explained in Understanding Data Redundancy).

    The general rule is as follows:

    • choose replication for highly loaded VMs, Windows VMs, and other workloads that generate lots of IOPS;

    • choose erasure coding for lightly loaded Linux VMs and backups.

  6. Click Done.

To change the datastore settings later, select it and click Configure.

6.3.2. Placing Virtual Environments and Backups in Datastores

After creating a datastore, you can set it to store your virtual environments and their backups

  • Via Virtuozzo Automator (for instructions, refer to Configuring Virtual Environments Host Settings) or

  • By creating symbolic links from the virtual environments and backups default location to this datastore as follows:

    1. Log in to the server as root.

    2. Check the default location of:

      1. Container private area in the /etc/vz/vz.conf file:

        VE_PRIVATE=/vz/private/$VEID
        
      2. Virtual machine files:

        # prlsrvctl info | grep "VM home"
        VM home: /vz/vmprivate
        
      3. Backup files:

        # prlsrvctl info | grep "Backup path"
        Backup path: /vz/vmprivate/backups
        
    3. If the /vz/private, /vz/vmprivate, and /vz/vmprivate/backups directories exist on the server, remove them.

    4. Make symbolic links from the containers, virtual machines and backups default locations to the desired datastores. For example, to store your virtual machines in the vmprivate datastore, containers in the private datastore, and their backups in the backups datastore, execute the following commands:

      # ln -s /mnt/vstorage/vols/datastores/vmprivate /vz/vmprivate
      # ln -s /mnt/vstorage/vols/datastores/private /vz/private
      # ln -s /mnt/vstorage/vols/datastores/backups /vz/vmprivate/backups
      

The newly created virtual environments and backups will be placed and stored in their respective datastores.

6.3.3. Moving Virtual Environments Between Datastores

In Virtuozzo Storage, you can move containers and virtual machines, online or offline, between datastores using the prlctl move command. For example, to move the virtual machine MyVM to the datastore vms_new, run:

# prlctl move MyVM --dst=/mnt/vstorage/vols/datastores/vms_new

Take note of the following:

  • For large virtual machines the process may take considerable time as it implies copying all files of a virtual environment.

  • After moving a virtual machine to another datastore, you cannot revert to its old snapshots.

  • Destination datastore’s redundancy mode is not applied automatically to the moved container. For example, a VE moved from a datastore with 3:2 replication to one with a different replication or encoding scheme retains its original 3:2 replication setting.

If the destination datastore does not exist, it will be automatically created with the default replication parameters. You can then configure new datastore’s redundancy mode, tier, and failure domain in the management panel.

To check that the virtual environment files have been successfully moved, use the prlctl list <CT|VM_name> -i | grep "Home" command. For example:

# prlctl list MyVM -i | grep "Home"
Home: /mnt/vstorage/vols/datastores/vms_new/d35d28e5-11f7-4b3f-9065-8fef6178bc5b/