Initializing a Volume from a VM
After attaching a volume to a virtual machine (VM), you need to initialize the volume to make it available for use.
Linux VM
Before you begin: Attach the volume to your VM. For more information, see Attaching a Volume to a VM. |
(blank new volume only) Create the File System of the Volume
-
Connect to your VM. For more information, see Accessing Your VMs.
-
(optional) To get the device name of the volume you want to mount, run the following command to display the list of devices attached to the VM:
$ lsblk
Inside the VM, a device that you named xvdX or xvdXX in your OUTSCALE account is typically renamed sdY or sdYY. For more information, see About Volumes > Linux VMs.
-
(optional) To verify that the volume is blank, run the following command:
$ sudo file -s /dev/DEVICE_NAME
If the command returns
data
only, the volume does not have a file system and you need to create one.
If the command returns something else, the volume already has a file system. -
To create and format an xfs file system on the entirety of the volume, run the following command:
$ sudo mkfs -t xfs /dev/DEVICE_NAME
We do not recommend partitioning your volumes or using LVM on the OUTSCALE Cloud, as these affect volume performance. We strongly recommend using your volumes directly as is.
Mount the Volume
-
To create a directory to serve as the mounting point of the volume, run the following command:
$ sudo mkdir /MOUNT_POINT
-
To mount the volume on the mounting point, run the following command:
$ sudo mount /dev/DEVICE_NAME /MOUNT_POINT
To confirm that the mounting is successful, you can run the
df -hT
command to display the list of all volumes mounted on the VM.The volume is initialized and available for use.
(optional) Make the Mounting Permanent
|
-
Open the /etc/fstab file using the following command:
$ sudo vim /etc/fstab
-
Press i to enter insert mode, then add the following line at the end of the file:
/dev/DEVICE_NAME /MOUNT_POINT xfs defaults,nofail 0 2
The
nofail
option allows the volume to be mounted even when detached from the VM. This way, no errors will be reported if the volume cannot be found at VM boot.For more information about possible configuration options, see for example the fstab page in the official Ubuntu documentation.
-
Press Escape, then type :wq to save the file.
-
(optional) To verify that the file is valid, run the following command to re-execute it:
$ sudo mount -a
If the command returns an error message, the options in the file are not valid. You need to restore the original file and reconfigure it.
To restore the original /etc/fstab file, run the following command:
$ sudo mv /etc/fstab.orig /etc/fstab
Windows VM
Before you begin: Attach the volume to your VM. For more information, see Attaching a Volume to a VM. |
-
Connect to your VM. For more information, see Accessing a Windows VM.
-
Click the Start menu, type diskmgmt.msc, and click the program that appears.
-
In the bottom-left panel, right-click the disk corresponding to the volume you want to mount, then click Online.
-
(blank new disk only) If you are mounting the disk for the first time, do the following actions:
-
Right-click the disk, then click Initialize Disk.
-
Click OK to validate.
-
Right-click the unallocated space of the disk, then click New Simple Volume… and follow the instructions in the dialog box.
The volume is initialized and available for use.
-
Related Pages