Configuring NFS storage:
In this setup we will use NFS as both Primary and Secondary storage for Cloudstack.
1. Install NFS
$sudo apt-get install nfs-kernel-server
2. Create storage directories:
$sudo mkdir -p /storage/primary $sudo mkdir -p /storage/secondary $sudo chmod -R 777 /storage
3. Create NFS export directories:
$sudo mkdir -p /export/primary $sudo mkdir -p /export/secondary $sudo chmod -R 777 /export
4. Configure exports
$sudo nano /etc/exports
Add the follwoing lines to /etc/exports
/export 192.168.2.0/24(rw,fsid=0,insecure,no_subtree_check,async) /export/primary 192.168.2.0/24(rw,nohide,insecure,no_subtree_check,async) /export/secondary 192.168.2.0/24(rw,nohide,insecure,no_subtree_check,async)
Save and close.
5. Mount storage folders at boot:
$sudo nano /etc/fstab
Add the follwoing lines to fstab:
/storage/primary /export/primary none bind 0 0 /storage/secondary /export/secondary none bind 0 0
Save and close.
If you don’t want to wait for the next reboot to mount the storage folders, run the following commands to mount them now:
$sudo mount --bind /storage/primary /export/primary $sudo mount --bind /storage/secondary /export/secondary
6. Start NFS deamon:
$sudo service nfs-kernel-server restart
7. Check the NFS mounts and exports:
$sudo showmount --exports
If all ok, the showmount command should return a list of NFS exports:
Export list for nanocloud.claspi.org: /export/secondary 192.168.2.0/24 /export/primary 192.168.2.0/24 /export 192.168.2.0/24
NFS exports are now correctly configured and are ready to use.