We are committed to provide service 24 X 7

Deals, Shopping, Training, Tools

23
1.134.617,20

Cart

Quantity 19.800,00
Quantity 16.900,00
Quantity 6.500,00

Learn how to – Configure NFS Filesystem as OpenNebula Datastores

Learn how to – Configure NFS Filesystem as OpenNebula Datastores.

Welcome to our guide on how you can configure NFS Filesystem for use in OpenNebula Cloud Storage. In OpenNebula a Storage datastore is is required to store disk images for running virtual machines. There are three different datastore types officially supported by OpenNebula:

  • Images Datastore: This stores the images repository.
  • System Datastore: This holds disk for running virtual machines. Disk are moved, or cloned to/from the Images datastore when the VMs are deployed or terminated; or when disks are attached or snapshotted.
  • Files & Kernels Datastore: Used to store plain files and not disk images. The plain files can be used as kernels, ram-disks or context files.

Disk images are transferred between the Image and System datastores by the transfer manager (TM) drivers. These drivers are specialized pieces of software that perform low-level storage operations.

The following table summarizes the available transfer modes for each datastore:

Datastore Image to System Datastore disk transfers methods
Filesystem shared, images are exported in a shared filesystem ssh, images are copied using the ssh protocol qcow2, like shared but specialized for the qcow2 format
Ceph ceph, all images are exported in Ceph poolsshared, volatile & context disks exported in a shared FS.
LVM fs_lvm, images exported in a shared FS but dumped to a LV
Raw Devices dev, images are existing block devices in the nodes
iSCSI libvirt iscsi, images are iSCSI targets

Step 1: Install NFS Server

This should be done on an NFS Server instance

Ubuntu / Debian

Update APT package index:

sudo apt update

Then install NFS Server packages:

sudo apt -y install nfs-kernel-server

CentOS / RHEL / Fedora

Run the commands below to install NFS server packages:

sudo yum -y install nfs-utils

Step 2: Configure NFS Exports for OpenNebula

I’ve mounted external storage devices on /mnt directory. I’ll create relevant directories there:

sudo mkdir -p /mnt/opennebula/{images,system,files}

Where:

  • /mnt/opennebula/images is the image repository path
  • /mnt/opennebula/system holds disk for running virtual machines
  • /mnt/opennebula/files stores plain files and not disk images

We will edit /etc/exports and export these paths.

$ sudo vim /etc/exports
# Example configurations to allow mounts from any host
/mnt/opennebula/images *(rw,no_root_squash,no_subtree_check)
/mnt/opennebula/system *(rw,no_root_squash,no_subtree_check)
/mnt/opennebula/files  *(rw,no_root_squash,no_subtree_check)

# Example configurations to allow mounts from known/trusted networks
/mnt/opennebula/images 10.10.20.0/24(rw,no_root_squash,no_subtree_check)
/mnt/opennebula/system 10.10.20.0/24(rw,no_root_squash,no_subtree_check)
/mnt/opennebula/files  10.10.20.0/24(rw,no_root_squash,no_subtree_check)

Restart the nfs-server after updating the changes:

# Ubuntu / Debian
sudo systemctl restart nfs-server

# CentOS / RHEL
sudo systemctl enable --now rpcbind nfs-server
sudo firewall-cmd --add-service=nfs --permanent
sudo firewall-cmd --add-service={nfs3,mountd,rpc-bind} --permanent
sudo firewall-cmd --reload

Validate NFS exports:

$ sudo exportfs -rvv
exporting 10.10.20.0/24:/mnt/opennebula/files
exporting 10.10.20.0/24:/mnt/opennebula/system
exporting 10.10.20.0/24:/mnt/opennebula/images

Step 3: Mount NFS Shares on Frontend/KVM Nodes

Install NFS Client packages on the Front-end and virtualization host systems.

# CentOS / RHEL
sudo yum -y install nfs-utils

# Debian / Ubuntu
sudo apt update
sudo apt -y install nfs-common

Mounts on OpenNebula Frontend

The frontend only needs to mount the Image Datastores and not the System Datastores.

The Frontend needs to prepare the storage area for:

  • The Image Datastores, to store the images.
  • The System Datastores, will hold temporary disks and files for VMs stopped and undeployed.

Get pre-defined datastores IDs:

Login to the front-end node and mount the Image Datastore directory in /var/lib/one/datastores/ directory.

$ sudo vim /etc/fstab
10.10.20.250:/mnt/opennebula/images /var/lib/one/datastores/1 nfs defaults,soft,intr,rsize=32768,wsize=32768 0 0
10.10.20.250:/mnt/opennebula/files /var/lib/one/datastores/2 nfs defaults,soft,intr,rsize=32768,wsize=32768 0 0

Where 10.10.20.250 is the IP Address of the NFS Server.

Mount the NFS Shares using the mount command to confirm the changes in /etc/fstab are valid.

$ sudo mount -av
/                        : ignored
/boot                    : already mounted
none                     : ignored
/media/cdrom0            : ignored
mount.nfs: timeout set for Tue Mar 23 16:55:04 2021
mount.nfs: trying text-based options 'soft,intr,rsize=32768,wsize=32768,vers=4.2,addr=10.10.20.250,clientaddr=10.10.20.251'
/var/lib/one/datastores/1: successfully mounted
/var/lib/one/datastores/2: successfully mounted

Confirm the mount status with the df command:

$ df -hT /var/lib/one/datastores/1
Filesystem                          Type  Size  Used Avail Use% Mounted on
10.10.20.250:/mnt/opennebula/images nfs4  915G  1.6G  867G   1% /var/lib/one/datastores/1

$ df -hT /var/lib/one/datastores/2
Filesystem                         Type  Size  Used Avail Use% Mounted on
10.10.20.250:/mnt/opennebula/files nfs4  915G  1.6G  867G   1% /var/lib/one/datastores/2

Datastores listing in the UI after the changes.

Mounts on OpenNebula Virtualization Nodes

Login to the Nodes running the VMS and do the mounting in a similar way done in the front-end.

$ sudo vim /etc/fstab
10.10.20.250:/mnt/opennebula/system /var/lib/one/datastores/0 nfs defaults,soft,intr,rsize=32768,wsize=32768 0 0
10.10.20.250:/mnt/opennebula/images /var/lib/one/datastores/1 nfs defaults,soft,intr,rsize=32768,wsize=32768 0 0
10.10.20.250:/mnt/opennebula/files /var/lib/one/datastores/2 nfs defaults,soft,intr,rsize=32768,wsize=32768 0 0

Create mount directories:

sudo mkdir /var/lib/one/datastores/{0,1,2}
sudo chown -R oneadmin:oneadmin /var/lib/one/datastores/{0,1,2}

Run the mount command:

$ sudo mount -av
/                        : ignored
/boot                    : already mounted
none                     : ignored
mount.nfs: timeout set for Tue Mar 23 17:12:25 2021
mount.nfs: trying text-based options 'soft,intr,rsize=32768,wsize=32768,vers=4.2,addr=10.10.20.250,clientaddr=10.10.20.252'
/var/lib/one/datastores/0: successfully mounted
mount.nfs: timeout set for Tue Mar 23 17:12:25 2021
mount.nfs: trying text-based options 'soft,intr,rsize=32768,wsize=32768,vers=4.2,addr=10.10.20.250,clientaddr=10.10.20.252'
/var/lib/one/datastores/1: successfully mounted
mount.nfs: timeout set for Tue Mar 23 17:12:25 2021
mount.nfs: trying text-based options 'soft,intr,rsize=32768,wsize=32768,vers=4.2,addr=10.10.20.250,clientaddr=10.10.20.252'
/var/lib/one/datastores/2: successfully mounted

Confirm mount status:

$ df -hT | grep one
10.10.20.250:/mnt/opennebula/system nfs4      915G  3.6G  865G   1% /var/lib/one/datastores/0
10.10.20.250:/mnt/opennebula/images nfs4      915G  3.6G  865G   1% /var/lib/one/datastores/1
10.10.20.250:/mnt/opennebula/files  nfs4      915G  3.6G  865G   1% /var/lib/one/datastores/2

More guides:

Reference:

23
1.134.617,20

Cart

Quantity 19.800,00
Quantity 16.900,00
Quantity 6.500,00