You can only attach a volume to one instances at a time.
Web Interface
Click the drop-down menu on the right hand side (in Actions
column) and select MANAGE ATTACHMENTS
Select the right instance and press ATTACH VOLUME
Note the path in the Attached To
column of the volume
1. | Click the drop-down menu on the right hand side (in Actions column) and select MANAGE ATTACHMENTS |
2. | Select the right instance and press ATTACH VOLUME |
3. | Note the path in the Attached To column of the volume |
Command-Line
Get the Server ID
(Instances) and Volume ID
(Volume) using command
Run
Accessing the volume
- Log-in to the attached instance using SSH
(Optional only for new volume) Format the volume (we use ext4 here and assume the attach point is
/dev/vdb
) (Formatting will wipe your data):sudo mkfs.ext4 /dev/vdb
Use
lsblk
to confirm the device path (usually typedisk
). The value shown in OpenStack can be inaccurate.$ lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT loop0 7:0 0 73.1M 1 loop /snap/lxd/21902 loop1 7:1 0 55.4M 1 loop /snap/core18/2128 loop3 7:3 0 72.6M 1 loop /snap/lxd/21750 loop4 7:4 0 61.9M 1 loop /snap/core20/1169 loop5 7:5 0 32.5M 1 loop /snap/snapd/13640 loop7 7:7 0 42.2M 1 loop /snap/snapd/14066 loop8 7:8 0 55.5M 1 loop /snap/core18/2253 loop9 7:9 0 61.9M 1 loop /snap/core20/1242 sr0 11:0 1 470K 0 rom /mnt/context vda 252:0 0 20G 0 disk ├─vda1 252:1 0 19.9G 0 part / ├─vda14 252:14 0 4M 0 part └─vda15 252:15 0 106M 0 part /boot/efi vdc 252:32 0 3G 0 disk
Mount the volume (we use the folder
/mnt/test-volume
as example)sudo mkdir /mnt/test-volume
Add this mount point to /etc/fstab, so it will be mounted automatically on startup
sudo vim /etc/fstab
Add/edit the following line:
/dev/vdb /mnt/test-volume ext4 defaults 0 0
You still need to manually mount it now
sudo mount /mnt/test-volume
- (Optional)You may also want to change the permission of the directory using
chmod
to enable read/write withoutsudo
chmod