7.3. Preparing and Adding File-based Storage
7.3.1. Preparing NFS Storage
Summary
These steps must be taken to prepare an NFS file share on a server running Red Hat Enterprise Linux 6 for use with Red Hat Enterprise Virtualization.
Procedure 7.1. Preparing NFS Storage
Install nfs-utils
NFS functionality is provided by the nfs-utils package. Before file shares can be created, check that the package is installed by querying the RPM database for the system:$
rpm -qi nfs-utilsIf the nfs-utils package is installed then the package information will be displayed. If no output is displayed then the package is not currently installed. Install it usingyumwhile logged in as therootuser:#
yum install nfs-utilsConfigure Boot Scripts
To ensure that NFS shares are always available when the system is operational both thenfsandrpcbindservices must start at boot time. Use thechkconfigcommand while logged in asrootto modify the boot scripts.#
chkconfig --add rpcbind#chkconfig --add nfs#chkconfig rpcbind on#chkconfig nfs onOnce the boot script configuration has been done, start the services for the first time.#
service rpcbind start#service nfs startCreate Directory
Create the directory you wish to share using NFS.#
mkdir /exports/isoReplace /exports/iso with the name, and path of the directory you wish to use.Export Directory
To be accessible over the network using NFS the directory must be exported. NFS exports are controlled using the/etc/exportsconfiguration file. Each export path appears on a separate line followed by a tab character and any additional NFS options. Exports to be attached to the Red Hat Enterprise Virtualization Manager must have the read, and write, options set.To grant read, and write access to/exports/isousing NFS for example you add the following line to the/etc/exportsfile./exports/iso *(rw)
Again, replace /exports/iso with the name, and path of the directory you wish to use.Reload NFS Configuration
For the changes to the/etc/exportsfile to take effect the service must be told to reload the configuration. To force the service to reload the configuration run the following command asroot:#
service nfs reloadSet Permissions
The NFS export directory must be configured for read write access and must be owned by vdsm:kvm. If these users do not exist on your external NFS server use the following command, assuming that/exports/isois the directory to be used as an NFS share.#
chown -R 36:36 /exports/isoThe permissions on the directory must be set to allow read and write access to both the owner and the group. The owner should also have execute access to the directory. The permissions are set using thechmodcommand. The following command arguments set the required permissions on the/exports/isodirectory.#
chmod 0755 /exports/iso
Result
The NFS file share has been created, and is ready to be attached by the Red Hat Enterprise Virtualization Manager.