The 'mkcephfs' script is used to create a new cluster file system. The basic syntax is
/usr/sbin/mkcephfs [-c ceph.conf] [-a|--allhosts] [--mkbtrfs] [-k admin.keyring]
The -a or --allhosts flag specifies that mkfs-related steps should be taken on _all_ hosts in the cluster. This will use ssh to set up remote hosts. If you don't want to do this, see the mkcephfs man page.
The --mkbtrfs option will create a new btrfs file system for each OSD and mount it for you. It requires that the 'btrfs devs' and 'btrfs path' (when it differs from the 'osd data' directory) are specified. NOTE THAT NO SAFETY CHECKS ARE MADE YET; be careful with the 'btrfs devs' option!
To use ext4 instead of btrfs, comment out "btrfs devs" in ceph.conf, point "osd data" to an already mounted ext4 partition and use mkcephfs without --mkbtrfs. The ext4 partition must be mounted with -o user_xattr or else mkcephfs will fail. Also using noatime,nodiratime boosts performance at no cost. When using ext4, you should disable the ext4 journal, because Ceph does its own journalling. This will boost performance.
Creating a new file system on an ext4 partition that already contains data, will invoke rm -rf to delete the data. If there is a lot of it, it might seem as if mkcephfs is hanging when it actually is not.
If for any reason you are re-creating the file system on a pre-existing cluster, recreating the journals too might save you some grief.
The -k admin.keyring option lets you specify where mkcephfs puts your master admin key file, which is necessary to administer the cluster when you have authentication enabled. Note that the various keys are generated even if authentication is disabled, so that it can be enabled later.
You will need to set up ssh keys so that the machine you are running mkcephfs on (master ) can ssh in to other nodes (slave ) as root. The usual way to do this (assuming you don't already have any keys or authorized_keys set up):
master# ssh-keygen -d
Generating public/private dsa key pair.
Enter file in which to save the key (/root/.ssh/id_dsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_dsa.
Your public key has been saved in /root/.ssh/id_dsa.pub.
Then for each other host,
# ssh-copy-id root@slave
# mkcephfs -c /etc/ceph/ceph.conf -a --mkbtrfs -k /etc/ceph/keyring.bin