Skip to main content

Mounting a Volume to a Virtual Machine

The following video demonstration shows you how to successfully mount a volume to your virtual machine in Hyperstack. For detailed step-by-step instructions, including the necessary commands, please refer to the complete instructions below.

Prerequisites

Verify your VM is running

  • On the My Virtual Machines page in Hyperstack, ensure the VM is displaying an ACTIVE status. It may take some time for all services to initialize after the VM is deployed. If there is a connection error, retry after a few minutes.

Ensure your volume is attached to the VM in Hyperstack

  • To confirm that your volume is attached to the VM, navigate to the VM's details page, select the Volumes tab, and verify that the volume's status is listed as ATTACHED. If no volume is attached, click Attach Volume, choose the appropriate volume, and then click Attach.
    • If you need to create a volume, follow this guide to learn how.

Mounting the volume and creating a file system

  1. Connect to VM via SSH

    To access your virtual machine via SSH, execute the following command in a terminal (such as Terminal, PowerShell, etc.):

    ssh -i [path_to_ssh_key] [os_username]@[vm_ip_address]
    • '[path_to_ssh_key]' is replaced with the path to the SSH key that was generated in the Create SSH key step.
    • '[os_username]' is replaced with the username of the operating system running on your virtual machine.
      • For Windows, the username is Administrator
      • For Ubuntu, the username is ubuntu
      • For Centos, the username is centos
      • For Debian, the username is debian
      • For Fedora, the username is fedora
    • '[vm_ip_address]' is replaced with the IP address of your virtual machine, which you can find on the My Virtual Machines page under the PUBLIC IP column.

    For a complete guide on connecting to your VM via SSH, click here.

  2. Reformat the volume

    Execute the command below to format your volume, replacing [file-system-format] with your desired file system type:

    sudo mkfs.[file-system-format] /dev/vdb

    Depending on your needs, you can format your volume with one of several file systems. The most common ones are ext4, xfs, and ntfs:

    • ext4: A robust, journaling file system that is very common in Linux distributions.
    • xfs: Suitable for large file systems and large files, often used in data centers and servers.
    • ntfs: Best if the drive will be used with Windows systems, as it supports large files and has journaling capabilities.

    For example:

    sudo mkfs.ext4 /dev/vdb
  3. Create the mount point directory

    To create a directory for mounting the file system, execute the command below, replacing [volume name] with the name of your volume as listed in Hyperstack. To find the volume name, navigate to the Virtual Machines section, select the VM to which the volume is attached, and then click on the Volumes tab to see the volume's name displayed.

    sudo mkdir -p /mnt/[volume name]
  4. Mount the volume

    Now mount the volume to the directory you just created:

    sudo mount /dev/vdb /mnt/[volume name]
  5. Verify the mount

    Confirm that the volume is mounted correctly using one of the following commands:

    mount | grep "[volume name]"

    This checks the current mount list for your volume name, ensuring it is mounted.

    or

    lsblk -o NAME,SIZE,FSTYPE,MOUNTPOINT,LABEL | grep "[volume name]"

    This provides a detailed list of block devices, including the name, size, file system type, mount point, and label, filtered by your volume name.


Back to top