- 07 May 2024
- 3 Minutes to read
- Print
- DarkLight
Mount a CephFS share to a folder in Windows
- Updated on 07 May 2024
- 3 Minutes to read
- Print
- DarkLight
To use CephFS you'll need to mount it to a directory in Windows.
You can then use that as you would any other normal folder/directory.
CephFS can be mounted to multiple servers, both Linux and Windows - simultaneously, giving you a fast and easy way to share files between servers.
This guide will show how to modify CephFS configuration files, keyring files, and how to manually mount a CephFS volume via command prompt.
Once you verify that you can mount the CephFS volume manually, you can then proceed to the next guide which covers creating a CephFS service to manage mounting the volume when Windows is restarted. There will be a link to the guide at the end of this one.
Prerequisites
- CephFS and Dokany must be installed - Installing CephFS Client Software on Windows
- Your Ceph client keyring - This would have been provided when the CephFS was purchased.
- Your Ceph path - this can be found in the MySAU portal or in the Ceph client keyring.
- Your Ceph namespace - this can be found in the MySAU portal or in the Ceph client keyring
- A folder to mount your CephFS to. In this guide we'll use C:\CephFS\
Your ceph client keyring file should look something like this:
[client.cephfs.cid-XXX-SAU-YYYYY-CF]
key = AQBF7DBj3GRpDRAALT/uQpHUcUeRb3L3VQr/nA==
caps mds = "allow rw path=cid-XXX-SAU-YYYYY-CF"
caps mon = "profile fs-client"
caps osd = "allow rw namespace=cid-XXX-SAU-YYYYY-CF"
From the above keyring we can gain the following information.
Our ceph path is cid-XXX-SAU-YYYYY-CF. You can find this on the line that starts with 'caps mds'.
Our ceph namespace is cid-XXX-SAU-YYYYY-CF. You can find this on the line that starts with 'caps osd'.
Configuration
Ceph.conf
The default location for the ceph.conf file on Windows is %ProgramData%\ceph\ceph.conf, which usually expands to C:\ProgramData\ceph\ceph.conf.
Below is a sample ceph.conf file. The most important part here is the [global] mon host section which defines where your client will connect to get to the CephFS share. You'll also notice that we're using C:/ProgramData/ceph/out/ for some output files.
[global]
log to stderr = true
; Uncomment the following in order to use the Windows Event Log
; log to syslog = true
run dir = C:/ProgramData/ceph/out
crash dir = C:/ProgramData/ceph/out
; Use the following to change the cephfs client log level
; debug client = 2
[client]
keyring = C:/ProgramData/ceph/keyring
; log file = C:/ProgramData/ceph/out/$name.$pid.log
admin socket = C:/ProgramData/ceph/out/$name.$pid.asok
; client_permissions = true
; client_mount_uid = 1000
; client_mount_gid = 1000
[global]
mon host = monitor1.softiron.servercontrol.com.au,monitor2.softiron.servercontrol.com.au,monitor3.softiron.servercontrol.com.au
Launch your CMD prompt. A quick way is by pressing WIN + R for the run dialog, then type CMD and hit enter.
Next, change directory to the ceph dir.
cd C:\ProgramData\Ceph
and now create the 'out' directory.
mkdir out
Now let's create the ceph.conf file. Copy the configuration from the code block above.
notepad ceph.conf
Paste the configuration into notepad, then save it with CTRL + S, or manually via the File menu.
Keyring File
Now we need to create the keyring file.
notepad keyring.txt
Paste in your keyring and then save it.
Now that you have your ceph.conf, keyring.txt and out folder, you're ready to create a directory and mount the volume.
Create mount directory
In this example we'll mount the CephFS share to C:\CephFS
Make the directory:
mkdir C:\CephFS
Mount the CephFS Share
You'll mount the CephFS share using the ceph-dokan.exe program. This can be found in the c:\Program Files\Ceph\bin directory.
cd "c:\Program Files\Ceph\bin"
Now to construct the mount command, get the following information handy:
Config File Path (e.g. C:\ProgramData\Ceph\ceph.conf )
Keyring Path (e.g. c:\ProgramData\Ceph\keyring.txt )
Client Name (e.g. cid-XXX-SAU-YYYYY-CF )
Namespace (e.g. cid-XXX-SAU-YYYYY-CF )
CephFS Path ( e.g. cid-XXX-SAU-YYYYY-CF )
Path to the local mount folder (e.g. C:\CephFS )
The command to mount the share is:
c:\Program Files\Ceph\bin>
c:\Program Files\Ceph\bin>ceph-dokan -l c:\CephFS -x /cid-XXX-SAU-YYYYY-CF/ -n client.cephfs.cid-XXX-SAU-YYYYY-CF --keyring c:/programdata/ceph/keyring.txt
2022-09-27T14:36:35.027AUS Eastern Standard Time 1 0 ceph-dokan: Mounted cephfs directory: /cid-XXX-SAU-YYYYY-CF/. Mountpoint: c:\CephFS
If done correctly, you'll see "Mounted Cephfs Directory" as per the above screenshot.
If there are any typos in the names, or directories, you'll see an error like this:
2022-09-27T14:46:40.542AUS Eastern Standard Time 6 -1 monclient(hunting): handle_auth_bad_method server allowed_methods [2] but i only support [2,1]
failed to fetch mon config (--no-mon-config to skip)
If you see the above error, just make sure to check all the names and paths are correct. Please note that everything is case sensitive as well, so make sure you enter everything exactly as it's provided.
Once you've confirmed that you can connect to the CephFS share properly, now you can create the service which will manage connecting to the share.
Mount the CephFS Share to a Drive Letter
See the above instructions, but instead, use the following command, assuming the drive you want to mount the CephFS to is X:\
c:\Program Files\Ceph\bin>ceph-dokan -l x -n client.cephfs.cid-XXX-SAU-YYYYY-CF -c c:\programdata\ceph\ceph.conf -k c:\programdata\ceph\keyring.txt --root-path /cid-XXX-SAU-YYYYY-CF/
See the following article to continue:
Create a CephFS service in Windows