This section explains how to configure OpenStack Block
Storage to use NFS storage. You must be able to access the NFS
shares from the server that hosts the
cinder volume service.
![]() | Note |
|---|---|
The
In Ubuntu and Debian distributions, the
|
Procedure 6.1. Configure Block Storage to use an NFS storage back end
Log in as
rootto the system hosting thecindervolume service.Create a text file named
nfssharesin/etc/cinder/.Add an entry to
/etc/cinder/nfssharesfor each NFS share that thecindervolume service should use for back end storage. Each entry should be a separate line, and should use the following format:HOST:SHAREWhere:
HOSTis the IP address or host name of the NFS server.SHAREis the absolute path to an existing and accessible NFS share.
Set
/etc/cinder/nfssharesto be owned by therootuser and thecindergroup:# chown root:cinder /etc/cinder/nfsshares
Set
/etc/cinder/nfssharesto be readable by members of thecindergroup:# chmod 0640 /etc/cinder/nfsshares
Configure the
cindervolume service to use the/etc/cinder/nfssharesfile created earlier. To do so, open the/etc/cinder/cinder.confconfiguration file and set thenfs_shares_configconfiguration key to/etc/cinder/nfsshares.On distributions that include openstack-config, you can configure this by running the following command instead:
# openstack-config --set /etc/cinder/cinder.conf \ DEFAULT nfs_shares_config /etc/cinder/nfsshares
The following distributions include openstack-config:
CentOS
Fedora
openSUSE
Red Hat Enterprise Linux
SUSE Linux Enterprise
Optionally, provide any additional NFS mount options required in your environment in the
nfs_mount_optionsconfiguration key of/etc/cinder/cinder.conf. If your NFS shares do not require any additional mount options (or if you are unsure), skip this step.On distributions that include openstack-config, you can configure this by running the following command instead:
# openstack-config --set /etc/cinder/cinder.conf \ DEFAULT nfs_mount_options
OPTIONSReplace
OPTIONSwith the mount options to be used when accessing NFS shares. See the manual page for NFS for more information on available mount options (man nfs).Configure the
cindervolume service to use the correct volume driver, namelycinder.volume.drivers.nfs.NfsDriver. To do so, open the/etc/cinder/cinder.confconfiguration file and set thevolume_driverconfiguration key tocinder.volume.drivers.nfs.NfsDriver.On distributions that include openstack-config, you can configure this by running the following command instead:
# openstack-config --set /etc/cinder/cinder.conf \ DEFAULT volume_driver cinder.volume.drivers.nfs.NfsDriver
You can now restart the service to apply the configuration.
To restart the
cindervolume service on CentOS, Fedora, openSUSE, Red Hat Enterprise Linux, or SUSE Linux Enterprise, run:# service openstack-cinder-volume restart
To restart the
cindervolume service on Ubuntu or Debian, run:# service cinder-volume restart
![]() | Note |
|---|---|
The
Setting
However, should you choose to set
On distributions that include openstack-config, you can configure this by running the following command instead: # openstack-config --set /etc/cinder/cinder.conf \ DEFAULT nfs_sparsed_volumes false |
![]() | Important |
|---|---|
If a client host has SELinux enabled, the
# setsebool -P virt_use_nfs on This command also makes the Boolean persistent across reboots. Run this command on all client hosts that require access to NFS volumes on an instance. This includes all Compute nodes. |

![[Note]](../common/images/admon/note.png)
![[Important]](../common/images/admon/important.png)
