---
title: "Create a cloud server with an emulated USB drive"
sidebar_label: "Create a server with a USB drive"
sidebar_position: 6
description: "How to create a cloud server with an emulated USB drive"
---

import Tabs from '@theme/Tabs'
import TabItem from '@theme/TabItem'
import {TabItemLabel} from '@selectel/docux/components'
import Formbricks from '@theme/MDXComponents/Formbricks'
import CopyIcon from '@selectel/docux/icons/copy'

# Create a cloud server with an emulated USB drive

:::info

You cannot connect a USB drive directly to a cloud server. To connect a USB drive, create a cloud server with a disk emulated as a USB drive.

:::

Connecting a USB drive may be required to import various files to a cloud server. For example, for importing and using cryptographic information protection tools (CIPFs). To connect a USB drive, create a cloud server with a disk emulated as a USB drive.

1. [Prepare the file](#prepare-file).

2. [Create a USB drive image with the file](#create-image).

3. [Configure OpenStack CLI](#configure-openstack-cli).

4. [Upload the image](#upload-image).

5. [Create a flavor](#create-flavor).

6. [Create a cloud server](#create-cloud-server).

### 1. Prepare the file \{#prepare-file}

Prepare the file that you need to import to the cloud server. The preparation process depends on the type of file being imported.

### 2. Create a USB drive image with the file \{#create-image}

<Tabs queryString="create-image-of-usb-with-file">
  <TabItem value="linux" default>
    <TabItemLabel>
      Linux
    </TabItemLabel>

    1. Open the CLI.

    2. Create a USB drive image with the [prepared file](#prepare-file).

       ```bash
       dd if=<disk_name> of=<image_name>.iso bs=4M
       ```

       Specify:

       * `<disk_name>` — the name of the disk containing the prepared file — the source disk;
       * `<image_name>` — the name of the image created from the source disk.
  </TabItem>

  <TabItem value="windows" default>
    <TabItemLabel>
      Windows
    </TabItemLabel>

    1. Install the [EASEUS Disk Copy](https://www.easeus.com/backup-utility/easeus-todo-clone.html) utility.

    2. In the **Disk Mode** section, select the disk containing the [prepared file](#prepare-file) — the source disk.

    3. Click **Next**.

    4. Select the disk where the image will be saved — the target disk.

    5. Click **Next**.

    6. Check the structure of the source and target disks. You can manage the structures using the menu options:

       * Autofit the disk — applies default changes to the target disk structure to make it work faster;
       * Copy as the source — replicates the source disk structure on the target disk;
       * Edit disk layout — allows you to manually change the size or partition structure on the target disk.

    7. Optional: if the target disk is an SSD, check the **Check the option if the target is SSD** box. This will allow you to use the maximum performance of the SSD.

    8. Make sure you have selected the correct source and target disks. Copying will delete all data on the target disk.

    9. Click **Continue**.

    10. Click **Proceed**.

    11. When copying is complete, check the target disk structure.
  </TabItem>
</Tabs>

### 3. Configure OpenStack CLI \{#configure-openstack-cli}

Use the [Configure OpenStack CLI via OS](/cloud-servers/tools/openstack-cli/configure-openstack-cli.mdx#configure-openstack-in-os) or [Configure OpenStack CLI in a Docker container](/cloud-servers/tools/openstack-cli/configure-openstack-cli.mdx#configure-openstack-in-docker-container) instruction.

### 4. Upload the image \{#upload-image}

Use the [Upload an image from a file](/cloud-servers/images/create-image.mdx#upload-image-from-file) instruction.

### 5. Create a flavor \{#create-flavor}

The flavor will be available only for the project and pool you authenticated with to work with OpenStack API while [configuring the OpenStack CLI](#configure-openstack-cli) in step 3.

1. [Open the OpenStack CLI](/cloud-servers/tools/openstack-cli/).

2. Create a flavor:

   ```bash
   openstack flavor create \
       --private \
       --vcpus <vcpu> \
       --ram <ram_size> \
       --disk <disk_size> \
       <flavor_name>
   ```

   Specify:

   * `<vcpu>` — number of vCPUs;
   * `<ram_size>` — RAM size in MB;
   * optional: `<disk_size>` — local disk size in GB. To create a flavor with a network volume, the value must be zero;
   * `<flavor_name>` — flavor name. It must be unique and must not match the names of previously deleted flavors. You can view the list of existing flavors using the `openstack flavor list` command.

   <details>
     <summary>Example of a configured flavor</summary>

     A flavor with 2 vCPUs, 2 GB RAM, and a local disk size of 80 GB

     ```bash
     openstack flavor create \
         --private\
         --vcpus 2\
         --ram 2048\
         --disk 80\
         new_flavor
     ```
   </details>

### 6. Create a cloud server \{#create-cloud-server}

1. [Open the OpenStack CLI](/cloud-servers/tools/openstack-cli/).

2. Create a cloud server:

   ```bash
       openstack server create \
           --image <image> \
           --flavor <flavor> \
           --availability-zone <pool_segment> \
           --nic net-id=<net_uuid> \
           --security-group <security_group> \
           --block-device source_type=image,uuid=<uploaded_image>,destination_type=volume,disk_bus=usb,device_type=disk,volume_size=<size> \
           <server_name>
   ```

   Specify:

   * `<image>` — to create a server from a ready-made or custom image. The `<image>` parameter is the image ID or name. The image must be in the same pool as the server. You can view the list of images using `openstack image list`;
   * `<flavor>` — flavor ID or name. Flavors correspond to cloud server configurations and determine the number of vCPUs, RAM, and the local disk size. You can use fixed configuration flavors or create your own. For example, `1015` — the ID for creating a server with a fixed configuration from the Standard line with 4 vCPUs and 16 GB RAM in pool ru-9. You can view the list of flavors using the `openstack flavor list` command or in the [List of fixed configuration flavors across all pools](/cloud-servers/create/configurations.mdx#server-flavors-full-list) table;
   * `<pool_segment>` — [pool segment](/infrastructure/locations.mdx#pool), in which the cloud server will be created, for example `ru-9a`. The list of available pool segments can be viewed in the [Product Availability by Location](/infrastructure/product-availability-by-location.mdx) instructions;
   * `<net_uuid>` — ID of the private or public network to which the server will be connected. You can view the list of networks using the `openstack network list` command;
   * `<security_group>` — security group ID or name. To create a server with a security group, [traffic filtering (port security](/cloud-servers/cloud-networks/about-networks.mdx#traffic-filtering-port-security)) must be enabled in the network. You can view the list of groups using the `openstack security group list` command;
   * `<uploaded_image>` — ID of the uploaded disk image with a [prepared file](#prepare-file). You can find it in the [Control Panel](https://my.selectel.ru/vpc/default/images): in the top menu, click **Products** → **Cloud Servers** → **Images** → in the image card, in the UUID row, click <CopyIcon /> ;
   * `<size>` — disk size in GB. The minimum disk size must be equal to the source disk size. Consider [network volume limits](/cloud-servers/volumes/about-network-volumes.mdx#network-volume-limits) on the maximum size;
   * optional: `--property x_cloud_smt_enabled=false` — disable [Hyper-Threading (SMT](/cloud-servers/about/dedicated-cores.mdx#hyper-threading)). If this parameter is not specified, Hyper-Threading (SMT) will be enabled by default. Can only be used with flavors that support [dedicated cores](/cloud-servers/about/dedicated-cores.mdx). The list of flavors can be viewed in the [List of fixed configuration flavors in all pools](/cloud-servers/create/configurations.mdx#server-flavors-full-list) table;
   * optional: `--property x_cloud_numa_nodes=1` — resource allocation on a single NUMA node. Can only be used with flavors that support [dedicated cores](/cloud-servers/about/dedicated-cores.mdx). The list of flavors can be viewed in the [List of fixed configuration flavors in all pools](/cloud-servers/create/configurations.mdx#server-flavors-full-list) table;
   * `<server_name>` — server name.

<Formbricks />
