Mounting filesystems using fstab

Content Software for File CLI Reference

Version
4.2.x
Audience
anonymous
Part Number
MK-HCSF001-03

Using the fstab (filesystem table) enables automatic remount after reboot. It applies to stateless clients running on an OS that supports systemd, such as RHEL/CentOS 7.2 and up, Ubuntu16.04 and up, and Amazon Linux 2 LTS.

Note: Before you begin, if the mount point you want to set in the fstab is already mounted, unmount it before setting the fstab file.
  1. Remove the /etc/init.d/weka-agent file.
  2. Create a file named weka-agent.service with the following content and save it in /etc/systemd/system.
    [Unit]
    Description=WEKA Agent Service Wants=network.target network-online.target
    After=network.target network-online.target rpcbind.service Documentation=http://docs.weka.io
    Before=remote-fs-pre.target remote-fs.target
    
    [Service] Type=simple
    ExecStart=/usr/bin/weka --agent Restart=always WorkingDirectory=/ EnvironmentFile=/etc/environment
    # Increase the default a bit in order to allow many simultaneous # files to be monitored, we might need a lot of fds.
    LimitNOFILE=65535
    
    [Install]
    RequiredBy=remote-fs-pre.target remote-fs.target
    
  3. Run the following comand:
    systemctl daemon-reload; systemctl enable --now weka-agent.service
  4. Create a mount point.

    Example: mkdir-p /mnt/weka/my_fs

  5. Edit /etc/fstab file.

    fstab structure:

    <backend servers/my_fs> <mount point> <filesystem type> <mount options>
    <systemd mount options> 0	0
    

    fstab example:

    backend-0,backend-1,backend-3/my_fs /mnt/weka/my_fs wekafs num_cores=1,net=eth1,x-systemd.requires=weka-agent.service,x-systemd.mount- timeout=infinity,_netdev	0	0

    fstab structure descriptions:

    • Mount point:If the client mounts multiple clusters, specify a unique name for each client container. Example: For two client containers, set container_name=client1 and container_name=client2.
    • Filesystem type: wekafs
    • Mount options: See Additional mount options using the stateless clients feature.
    • Systemd mount options:
      x-systemd.requires=weka-agent.service,x-systemd.mount- timeout=infinity,_netdev

      Youcan set the mount-timeout basedon your preferences, such as 180 seconds. This flexibility allows you to customize the timeout according to your specific system needs.

  6. Mount the the filesystem to test the fstab setting by running the command, for example:
    mount /mnt/weka/my_fs
  7. To test the fstab implementation, reboot the server.

    Content Software for File creates the mounts for the next boot.

    The filesystem is mounted automatically after server reboot.