Docs
Project ServicesFAQ

Format and mount a volume

For Linux instances

Log into the instance

ssh -i <key_path/private_key_file> <user_name>@<public_IP>

Determine volume device name

Run the following command to view your available disk devices and their mount points (if applicable) that will help you determine the correct device name to use.

lsblk

Look for a device which has no partitions and / or is not mounted.

The output is similar to the following example:

NAME    MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda       8:0    0   30G  0 disk 
├─sda1    8:1    0 29.9G  0 part /
├─sda14   8:14   0    4M  0 part 
└─sda15   8:15   0  106M  0 part /boot/efi
sdb       8:16   0    4G  0 disk 
└─sdb1    8:17   0    4G  0 part /mnt
sdc       8:32   0    4G  0 disk 

Here, sdc is the disk that we want to mount, because it has no partitions and is not yet mounted.

Format the volume (first time only)

Warning: This step will destroy all existing data on the volume. Only run this command on a new volume or if you are sure you want to destroy the existing data.

Check that the volume doesn't have a file system:

sudo lsblk -f

The FSTYPE column shows the file system type for each device. If the column is empty for a specific device, it means that the device does not have a file system.

The output is similar to the following example:

NAME    FSTYPE LABEL           UUID                                 FSAVAIL FSUSE% MOUNTPOINT
sda                                                                                
├─sda1  ext4   cloudimg-rootfs 241bcc80-e836-47d2-a5e8-39ee94650601   27.3G     5% /
├─sda14                                                                            
└─sda15 vfat   UEFI            DE3B-F4E7                              98.3M     6% /boot/efi
sdb                                                                                
└─sdb1  ext4                   1c3a69f5-d236-4abe-bd07-5c12b8b2f691    3.7G     0% /mnt
sdc                                                                                            

Here, the sdc disk doesn’t have a file system.

Run the following command to create a file system on the volume:

sudo mkfs -t <filesystem type> <device name>

where <filesystem type> is any desirable file system type (e.g. ext4, xfs), <device name> is full device name (e.g. /dev/sdc).

In case you need to partitionize the volume, perform it before formatting.

Notice: If the disk size is 2 tebibytes (TiB) or larger, you must use GPT partitioning. If disk size is under 2 TiB, then you can use either MBR or GPT partitioning.

sudo parted <device name> --script mklabel gpt mkpart xfspart xfs 0% 100% sudo mkfs -t <filesystem type> <device name>

Notice: If you get an error that mkfs.xfs is not found, use the following command to install the XFS tools and then repeat the previous command:

sudo yum install xfsprogs

Mount the volume

Create a mount point for your volume:

sudo mkdir <mount point>

For example:

sudo mkdir /datadrive

Mount the volume at the newly-created mount point:

sudo mount <device name> <mount point>

For example:

sudo mount /dev/sdc /datadrive

Automatically mount an attached volume after reboot

To ensure that the drive is remounted automatically after a reboot, it must be added to the /etc/fstab file. It's also highly recommended that the UUID (Universally Unique Identifier) is used in /etc/fstab to refer to the drive rather than just the device name.

1(Optional) Create a backup of your /etc/fstab file that you can use if you accidentally destroy or delete this file while editing it.

sudo cp /etc/fstab /etc/fstab.orig
  1. Use the blkid command to find the UUID of the device. Make a note of the UUID of the device that you want to mount after reboot.
sudo blkid <device name>

For example:

sudo blkid /dev/sdc

Expected result looks like:

/dev/sdc: UUID="4f543879-5d95-48c8-a227-928b4e79b67e" TYPE="ext4"
  1. Open the /etc/fstab file using any text editor, such as nano or vim.
sudo vim /etc/fstab
  1. Add the following entry to /etc/fstab to mount the device at the specified mount point. The fields are the UUID value returned by blkid, the mount point, the file system, and the recommended file system mount options.

In the following example, we mount the device with UUID 4f543879-5d95-48c8-a227-928b4e79b67e to mount point /datadrive and we use the ext4 file system. We also use the defaults and nofail flags. We specify 0 to prevent the file system from being dumped, and we specify 2 to indicate that it is a non-root device.

UUID=4f543879-5d95-48c8-a227-928b4e79b67e  /datadrive  ext4  defaults,nofail  0  2

For Windows instances

In order to start using a volume on a Windows instance, it is necessary to format the file system as NTFS once. If the volume has already been formatted with the NTFS file system, it is enough to attach the volume to the instance.

Log into the instance

You can connect to Windows instances using Remote Desktop. Remote Desktop uses the Remote Desktop Protocol (RDP) to connect to and use your instance in the same way you use a computer sitting in front of you (local computer). It is available on most editions of Windows and is also available for Mac OS.

For Windows users:

  1. Please make sure that the RDP port (3389) is open.
  2. You can find this setting in the project networks. Select the relevant security group, that is associated with your compute instance, and make sure that an inbound rule exists that allows incoming traffic on port 3389

screenshot

  1. Note - Opening the port will open it for all the other compute instances in that security group as well. Users will need the username and SSH keys to get into those instances.
  2. Open PowerShell (Terminal) and paste the following command: mstsc /v:"<public IP" /prompt
  3. Upon the RDP prompt, you need to input the correct username and password provided in the “Credentials“ section

For MacOS users

  1. Make sure you have the Microsoft Remote Desktop Client (RDP) installed on your workstation. You can install that from the App Store if it is not already installed.
  2. Open the Microsoft Remote Desktop and click on “Add PC“
  3. Input the public IP address of your Windows compute instance in the “PC name“ input box
  4. Click on “Add User Account“ and input the username and password. You can find both in the “Credentials” section of the “Connect” tab. Click on Add.
  5. After adding the user, click on Add to add the PC.
  6. Click on “show certificate”. Then click on the checkbox “Always trust“ and then click continue

For Linux users

  1. Install an RDP client on your system. There are many open-source RDP client options available like XRDP, Remmina, Zoho Assist etc.
  2. Open the RDP application and click on “connect” or “new connection“
  3. Give a meaningful name to the connection and select RDP when asked for the connection protocol
  4. Provide the public IP address of the compute instance in the field which asks for “server”
  5. Enter the username and password, provided to you in the “Credentials” section and click on connect

Format the volume (first time only)

Basic approach:

  1. Open Server Manager, click on "File and Storage Services," and go to the "Disks" tab.
  2. Right-click anywhere on the “Disks” table, and then click on "New Volume..."
  3. Follow the provided instructions to format the volume with the NTFS file system.

Alternative approach:

  1. On the taskbar, open the Start menu, and choose Windows PowerShell.
  2. Use the provided series of Windows PowerShell commands within the opened PowerShell prompt. The script performs the following actions by default:
    1. Stops the ShellHWDetection service.
    2. Enumerates disks where the partition style is raw.
    3. Creates a new partition that spans the maximum size the disk and partition type will support.
    4. Assigns an available drive letter.
    5. Formats the file system as NTFS with the specified file system label.
    6. Starts the ShellHWDetection service again, using the script below, where <volume name> is any volume name.
Stop-Service -Name ShellHWDetection
Get-Disk | Where PartitionStyle -eq 'raw' | Initialize-Disk -PartitionStyle MBR -PassThru | New-Partition -AssignDriveLetter -UseMaximumSize | Format-Volume -FileSystem NTFS -NewFileSystemLabel "<volume name>" -Confirm:$false
Start-Service -Name ShellHWDetection
How is this guide?

Last updated on 17 Mar 2025

On this page