This article only covers additional volumes: non-boot disks and shared filesystems. You add a boot disk when you create a VM.
- Add it to the VM by using Nebius AI Cloud interfaces.
- Mount it to the VM inside the VM’s operating system.
How to add volumes to VMs
To add disks or shared filesystems to a VM:- Web console
- CLI
-
New VM
On the VM creation page (
Compute → Virtual machines → Create virtual machine), do the following:
- Click Attach disk or Attach shared filesystem.
-
Set up the volume:
- Select whether you want to add a new or existing volume. If an existing disk is already added to another VM, you cannot add it to the new VM. A filesystem can be shared by multiple VMs.
- For a new volume, set its parameters.
- Set a device ID if you are adding a disk, or a mount tag if you are attaching a filesystem. Device IDs and mount tags are used to mount volumes to VMs.
- Click the attach-volume button at the end of the window.
- If you want to manually mount the filesystem that you added to the VM, turn off the Auto mount option for the filesystem. By default, Compute automatically mounts filesystems that you add to VMs via the web console. If you add a disk, you always need to mount it manually.
-
Existing VM
-
In the sidebar, go to
Compute → Virtual machines.
- Open the page of the required VM.
-
If the VM is not in the
Stoppedstatus, click Stop VM and then confirm the action. - Switch to the Disks or Filesystems tab.
-
After the VM has the
Stoppedstatus, clickAttach disk or
Attach filesystem.
-
Set up the volume:
- Select whether you want to add a new or existing volume. If an existing disk is already added to another VM, you cannot add it to the new VM. A filesystem can be shared by multiple VMs.
- For a new volume, set its parameters.
- Set a device ID if you are adding a disk, or a mount tag if you are attaching a filesystem. Device IDs and mount tags are used to mount volumes to VMs.
- Click the attach-volume button at the end of the window.
-
In the sidebar, go to
How to mount volumes to VMs
Disks
- Add the disk to a VM.
-
If you have not saved the disk’s device ID, for example, when adding it to the VM, get it from the information about the VM:
To get the VM ID, run
nebius compute instance list. To get the disk ID, runnebius compute disk list. - Connect to the VM over SSH.
-
Switch to the
rootuser: -
Partition the device. For example, you can use
cfdisk. In the example below, we assume that you have named the devicedisk-0; for disks, all device IDs are prefixed withvirtio-:-
Run
cfdisk:Referring to a device by its name, e.g.,/dev/vdb, does not guarantee it will function properly. Use the device ID instead, e.g.,/dev/disk/by-id/virtio-disk-0. - Under Select label type, select gpt and press Enter.
- Select New (partition) and press Enter.
-
Enter the partition size and press Enter. This will create a
/dev/disk/by-id/virtio-disk-0-part1partition. -
Select Write (the partition table to the device) and press Enter, then type
yesand press Enter. - Select Quit and press Enter.
-
Run
-
Format the partition:
-
Mount the partition and configure permissions for it by using
chmod. In the example below, the partition is mounted at/mnt/disk-0, and all VM users are granted write access to it: -
If you want the partition to be mounted automatically after every VM restart, add it to
/etc/fstabby its UUID: -
Exit the
rootuser shell:
Shared filesystems
If you create a VM in the web console, you can automatically attach and mount a shared filesystem to the VM by using the Auto mount option. If you do not use it, mount the filesystem manually. To do this:- Add the shared filesystem to a VM.
-
If you have not saved the filesystem’s mount tag, for example, when adding it to the VM, get the mount tag from the information about the VM:
To get the VM ID, run
nebius compute instance list. To get the disk ID, runnebius compute filesystem list. - Connect to the VM over SSH.
-
Switch to the
rootuser: -
Mount the filesystem as a
virtiofsdevice and configure permissions for it by usingchmod. In the example below, a filesystem has the mount tagfilesystem-0and is mounted at/mnt/fs. All VM users are granted write access to it: -
If you want the filesystem to be mounted automatically after every VM restart, add it to
/etc/fstab: -
Exit the
rootuser shell: