# Create a tenant sharing

> Create NFS or CIFS network shares at the tenant or project level for use in virtual machines.

:::info

USB storage devices are blocked by default. If accessing USB devices is needed, please set the tuning option `cubesys.probeusb` to `true` using `CLI > tuning > configure` after logging in as admin.

:::

## Create a share server and share its volumes with others VM on the same network {#create-a-share-server-and-share-its-volumes-with-others-vm-on-the-same-network}

### Pre-task {#pre-task}

- Upload [manila-service-image_yoga](https://s3.bigstack.co/downloads/app-image/yoga/manila-service-image_yoga.qcow2) to `/mnt/cephfs/glance`
- import with cli `import_fs`

```bash
  cc1> image import_fs
  1: usb
  2: local
  Enter index: 2
  1: manila-service-image-yoga.qcow2
  Enter index: 1
  Importing...
  [16:54:04] Converting image to RAW format ...
      (100.00/100%)
  [16:54:07] Creating image manila-service-image ...
  [=============================>] 100%
  669320d1-7b8e-4a7e-85a0-79e5ea54abe6
  [16:54:57] Finished creating image manila-service-image
  Importing  complete. It is safe to remove the local image file.
```

### Create Share Networks {#create-share-networks}

1. Navigate to `Project > File Share > Share Networks` > `+ Create Share Network`.

   ![/assets/manila/tenant_share_1.png](/assets/manila/tenant_share_1.png)

2. Name the SHARE NETWORK, select desired Network and Subnets for sharing. Click `OK` to proceed.

   ![/assets/manila/tenant_share_2.png](/assets/manila/tenant_share_2.png)

3. Verify Share Network by checking dashboard.

   ![/assets/manila/tenant_share_3.png](/assets/manila/tenant_share_3.png)

### Create a Share - tenant share type {#create-a-share---tenant-share-type}

1. Navigate to `Project > File Share > Shares` > `+ Create Share`.

   ![/assets/manila/tenant_share_4.png](/assets/manila/tenant_share_4.png)

2. For this creation, fill in the following fields:
   - **Available Zone:** Specify Available Zone of Volume to create in. Choose Not Select unless clearly knowing which to assign.
     _*Available Zone is not required and set to none by default*_

   - **\*Name** : Input desired name of the Share.

   - **\*Share Protocol:** Supported Share Protocol types listed below
     - **NFS**
     - **CIFS**

   - **\*Capacity (GiB):** Set capacity of the share volume (GiB, minimum 1).

   - **\*Share Type:** Choose tenant_share_type.

   - **\*Share Network:** Choose the Share Network created above.

     After filling all fields above, click `Confirm` to apply Share creation.

     _Demonstration below will use NFS as Share Protocol_

     ![/assets/manila/tenant_share_5.png](/assets/manila/tenant_share_5.png)

3. During share creation, share status will display `Creating`. The share status will change to `Availble` once creation is completed.

   ![/assets/manila/tenant_share_6.png](/assets/manila/tenant_share_6.png)
   ![/assets/manila/tenant_share_7.png](/assets/manila/tenant_share_7.png)

### Create Rules {#create-rules}

1. Choose the share created above, hover over `More`, then click `Manage Access Rule` from the drop-down menu.

   ![/assets/manila/tenant_share_8.png](/assets/manila/tenant_share_8.png)

2. Click `Add Access Rule`.

   ![/assets/manila/tenant_share_9.png](/assets/manila/tenant_share_9.png)

3. For this creation, fill in the following fields:
   - **\*Access Type** : Supported Share Protocol types listed below
     - IP: Authenticates through IP address.
     - Cert : Authenticates instances through TLS certificate.
     - User : Authenticates by a specified user or group name.
     - Cephx : Authenticates through Ceph system.

   - **\*Access Level** : Select either `Read and write` or `Read only`.

   - **\*Access To:** Attribute must fill in according to Access Type chose above:
     - IP : A valid format is XX.XX.XX.XX or XX.XX.XX.XX/XX. For example 0.0.0.0/0.
     - Cert : A valid value is any string up to 64 characters long in the common name (CN) of the certificate.
     - User : An alphanumeric string that can contain some special characters and is from 4 to 32 characters long.
     - Cephx : Specify the Ceph auth ID that needs to be authenticated and authorized for share access by the Ceph back end. A valid value must be non-empty, consist of ASCII printable characters, and not contain periods.

   After filling all fields above, click `Confirm` to apply user creation.

   _Demonstration below will use IP as Access Type_

   ![/assets/manila/tenant_share_10.png](/assets/manila/tenant_share_10.png)

4. During rule apply, share status will display `Applying`. The share status will change to `Active` once apply is completed.

   ![/assets/manila/tenant_share_11.png](/assets/manila/tenant_share_11.png)
   ![/assets/manila/tenant_share_12.png](/assets/manila/tenant_share_12.png)

### Get the shared link {#get-the-shared-link}

1. Click `Base Info` after rules are `Active`.

   ![/assets/manila/tenant_share_13.png](/assets/manila/tenant_share_13.png)

2. Copy `Path` from `Export Locations` attribute. This is the shared link recognized by instances.

   ![/assets/manila/tenant_share_14.png](/assets/manila/tenant_share_14.png)

### Mounting Share Space to VM {#mounting-share-space-to-vm}

1. Connect to the instances that need access to the file share and create a folder for mounting.

```bash
ubuntu@demo-ubuntu:~$ mkdir nfs-share
ubuntu@demo-ubuntu:~$ ls
nfs-share
```

2. Mount share server to the folder created.

```bash
ubuntu@demo-ubuntu:~$ sudo mount -t nfs 172.16.1.106:/shares/share-b0d091ca-9ef4-4c1a-8317-7c39266bfc5d nfs-share/
```

3. Verify mounting by `df -h`

```bash
ubuntu@demo-ubuntu:~$ df -h
Filesystem                                                       Size  Used Avail Use% Mounted on
tmpfs                                                            392M  1.1M  391M   1% /run
/dev/vda1                                                         96G  1.9G   94G   2% /
tmpfs                                                            2.0G     0  2.0G   0% /dev/shm
tmpfs                                                            5.0M     0  5.0M   0% /run/lock
/dev/vda16                                                       881M   61M  758M   8% /boot
/dev/vda15                                                       105M  6.1M   99M   6% /boot/efi
/dev/vdb                                                          20G   24K   19G   1% /mnt/disk20g
tmpfs                                                            392M   12K  392M   1% /run/user/1000
172.16.1.106:/shares/share-b0d091ca-9ef4-4c1a-8317-7c39266bfc5d  9.8G  128K  9.3G   1% /home/ubuntu/nfs-share
```

4. Verify accessibility by creating a file.

```bash
ubuntu@demo-ubuntu:~$ ls nfs-share/
lost+found
ubuntu@demo-ubuntu:~$ touch nfs-share/bigstack.co.txt
ubuntu@demo-ubuntu:~$ ls nfs-share/
bigstack.co.txt  lost+found
```
