Create a CephFS service in Windows
  • 28 Sep 2022
  • 2 Minutes to read
  • Dark
    Light

Create a CephFS service in Windows

  • Dark
    Light

Article summary

The ceph-dokan.exe application mounts a CephFS share temporarily, but to make it persist after a reboot you'll need to create a CephFS service in Windows, otherwise the CephFS share will become unmounted when you close the CMD prompt that is running ceph-dokan.exe.

There are many ways to create a service for CephFS in Windows, but we've found the simplest and most reliable way is to use a third party application called "NSSM - the Non-Sucking Service Manager"


First, download NSSM from here:

https://nssm.cc/download

For Windows 10, Server 2016 and newer we recommend the latest build which can be found here: https://nssm.cc/builds


Once downloaded, open the ZIP and extract the relevant binary to your folder of choice. In this example we'll use 7-zip and extract the binary to C:\NSSM\





Now via CMD prompt, navigate to C:\NSSM\win64, and run the binary like so:

# nssm install [<servicename>]

e.g.

C:\NSSM\win64> .\nssm.exe install CephFSMountService


This will launch the NSSM service manager GUI.


We just need to fill out a few fields. First, select the path to ceph-dokan.exe.



Now, under arguments, we'll add the arguments from the CMD prompt that we used when testing the connection in the last guide.

You can see we just use everything that was after the 'ceph-dokan.exe' part in our mount command ( from the previous guide here Mount a CephFS share to a folder in Windows ).

-l c:\CephFS -x /cid-XXX-SAU-YYYYY-CF/ -n client.cephfs.cid-XXX-SAU-YYYYY-CF --keyring c:/programdata/ceph/keyring.txt


Now click on the Details tab and fill out the fields.


You can change the startup type here as well. We recommend Delayed Start.

There are some other custom options you can play with, such as dependencies, and hooks, but these settings are all optional.

Now simply click 'Install Service'.


Now that you've created the service, make sure you start it and test it out.

Open the "Services" application by pressing WIN + R then typing services.msc, then hit enter.



Find the service using the name you specified during creation:



Right-Click the service, and then click 'Start'. It should change to 'Running'.


You can tell that the CephFS share has mounted correctly by the small arrow on the share folder, and a value under the 'Size' column.


If you stop the service and try to access the folder, you'll see an error:


However, with the service started correctly, the folder will open and you'll see any files that you have already stored on the CephFS share. If it's a new share, the folder will be empty and you can start using it straight away!


Here you can see I've mounted the same folder onto a Linux server, and the file we created on windows is available straight away to the Linux server.

root@linux:/cid-XXX-SAU-YYYYY-CF# ls -laht
total 0
drwxr-xr-x  2 root root    0 Sep 27 15:17  .
-rwxr-xr-x  1 root root    0 Sep 27 15:17 'My File On CephFS.txt'
drwxr-xr-x 10 root root 615G Sep 26 16:00  ..


If you need to set up CephFS on a Linux server as well, please see the following guide: Setting up your CephFS share on Linux



Was this article helpful?

What's Next
Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.
ESC

Eddy AI, facilitating knowledge discovery through conversational intelligence