Home [Hosting HPC in Azure] 4.2 -- Self-Host NFS Server
Post
Cancel

[Hosting HPC in Azure] 4.2 -- Self-Host NFS Server

How to Launch a NFS Server using CycleCloud?

  1. Go to CycleCloud Wizard home page -> Select NFS and follow the instructions:

    • Check if the OS image is from the marketplace, which may have additional fees. (The default one is from the marketplace.)
    • Make sure the VM supports the image and make sure the storage is > 0.
  2. Before we launch NFS server, if we want to use xfs_quota to control individual’s quota, we need to make sure the mount option supports uquota, gquota, pquota in the NFS server:

    • Go to CycleCloud Wizard NFS page -> Click the VM Edit, in Software, Configuration text box and update cyclecloud.mounts.nfs.options:

      1
      2
      
        cyclecloud.mounts.nfs.mountpoint = /mnt/exports
        cyclecloud.mounts.nfs.options = rw, relatime, attr2, inode64, logbufs=8, logbsize=32k, uquota, gquota, pquota
      

    The NFS server template provided by CycleCloud has mount option noquota by default, and it disables xfs_quota on the NFS server. We need to update this mount option before launching the server.

  3. After launching the NFS Server using CycleCloud, we need to mount it in the cluster. Go to edit the cluster:

    • Make sure the <mount-point> folder is in the cluster.

    • Network Attached Storage, Additional Filesystem Mount:

      FormHow to
      FS TypeExternal NFS
      IP AddressInternal IP address of the NFS server
      Mount PointWhere the folder will be at in the cluster. (<mount-point>)
      Export PathHow the NFS exports the file (the CycleCloud default is /mnt/exports/data)
      Mount Options<mount options> used to mount the NFS server in the cluster

How to Set Up User Quota using xfs_quota

User Folder

1
2
3
sudo mkdir <user>
sudo chown <user>:<user> <user>
sudo chmod 750 <user>

User Quota

When enabling xfs_quota, the NFS server will do additional operations like checking if user exceeds the limit before read/write. Quota enforcement happens on the NFS server (filer node), not the client (which is the cluster). So the mount option on the client side doesn’t actually control quota enforcement.

  • Make sure the mount option has uquota,gquota,pquota in the NFS server:

    1
    
      findmnt
    
  • Find the mounting point:

    1
    
      df -Th <mount-point>
    
  • Set the limit using xfs_quota, the following sets a soft limit of 10 MB and a hard limit of 15 MB for user:

    1
    
      sudo xfs_quota -x -c 'limit bsoft=10m bhard=15m user' <mount-point>
    
  • Get the quota report:

    1
    
      sudo xfs_quota -x -c 'report -ubh' <mount-point>
    
  • Check that oversized creation of files are banned:

    • Create a output.dat with file size 2M.

      1
      
        dd if=/dev/zero of=output.dat  bs=2M  count=1
      

How to Resize Volume

  1. Go to Azure Portal -> NFS server Virtual Machine -> Disks ->Size + Performance

    To prevent data loss, azure only allows disk size to scale up.

  2. Make sure VM knows the disk is rescaled:

    1
    
     lsblk # the disk size should change after rescaling
    
  3. Grow the volume to the new size:

    1
    
     sudo xfs_growfs <mount-folder>
    
  4. Check if the volume size reflects correctly in the node:

    1
    
     df -Th <mount-folder>
    
This post is licensed under CC BY 4.0 by the author.