Warning
This content has been generated by machine translation. The translations are automated and have not undergone human review or validation.
3.6.5 Mount Block Volume
According to the OCI document, if there are two or more volume other than root volume, if the device name is mounted with the device name, the device name and the actual device may be different.As of January 10, 2019, the CONSISTENT Device Path function was released to ensure the response of the device after the server reversion and the actual device.In the unsupported images and instances, the mount ** method is used based on the UUID of ** volume as before.
- Consistent Device Paths for Block Volumes
- Services: Block Volume
- Release Date: Jan. 10, 2019
- When you attach a block volume to an instance you can now optionally select a device path that will remain consistent between instance reboots. See Connecting to Volumes With Consistent Device Paths for more information.
- 지원 대상
- Instance made of Oracle-Provided Platform Image -Linux -based image -The image and details since November 2018 [Image Release Notes] (https://docs.oracle.com/en-us/iaas/images/) -Instance created after January 11, 2019
Mounting with Device Path
-
You can check the Device Path (/Dev/Oracleoci/OracleVDB) of the Block Volume that was previously Attached in the OCI console.
-
Connect the compute instance with ssh and check the device path.
[opc@examplelinuxinstance ~]$ ls -la /dev/oracleoci/ total 0 drwxr-xr-x. 2 root root 140 Jan 10 07:25 . drwxr-xr-x. 20 root root 3200 Jan 10 07:25 .. lrwxrwxrwx. 1 root root 6 Jan 10 05:41 oraclevda -> ../sda lrwxrwxrwx. 1 root root 7 Jan 10 05:41 oraclevda1 -> ../sda1 lrwxrwxrwx. 1 root root 7 Jan 10 05:41 oraclevda2 -> ../sda2 lrwxrwxrwx. 1 root root 7 Jan 10 05:41 oraclevda3 -> ../sda3 lrwxrwxrwx. 1 root root 6 Jan 10 07:35 oraclevdb -> ../sdb
-
Create a directory to mount
sudo mkdir /mnt/vol1
-
/etc/fstab update
sudo vi /etc/fstab
Add the following contents based on the device path you confirmed by performing the command.According to the recommendations of the OCI document, the _netdev,nofail option must be added to reduce the impact of the failure of the mounted volume when the instance is restarted.
-
Use the _netdev and nofail Options
sudo vi /etc/fstab
-
Update example
Add a line of mount information at the bottom of the existing content.
# # /etc/fstab # Created by anaconda on Wed Dec 1 01:55:42 2021 ... ## https://docs.us-phoenix-1.oraclecloud.com/Content/Block/Tasks/connectingtoavolume.htm /dev/oracleoci/oraclevdb /mnt/vol1 xfs defaults,_netdev,nofail 0 2
-
-
Mount
sudo mount -a
-
Mount result
You can see that /dev/sdb is mounted on /mnt/vol1.
[opc@examplelinuxinstance ~]$ sudo mount -a [opc@examplelinuxinstance ~]$ df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 310M 0 310M 0% /dev tmpfs 341M 0 341M 0% /dev/shm tmpfs 341M 5.1M 336M 2% /run tmpfs 341M 0 341M 0% /sys/fs/cgroup /dev/sda3 39G 3.1G 36G 8% / /dev/sda1 200M 7.5M 193M 4% /boot/efi tmpfs 69M 0 69M 0% /run/user/0 tmpfs 69M 0 69M 0% /run/user/1000 tmpfs 69M 0 69M 0% /run/user/994 /dev/sdb 50G 33M 50G 1% /mnt/vol1
-
-
Restart the instance
Since it is added to /etc/fstab, it is automatically mounted even when the instance restarts. Check if it mounts without any problems as shown below. Even after restarting, you can see that it is mounted as /mnt/vol1.
[opc@examplelinuxinstance ~]$ sudo reboot Connection to 146.56.171.40 closed by remote host. Connection to 146.56.171.40 closed. ubuntu@NOTEBOOK-WORK:~/.ssh$ ssh -i privateKey opc@146.56.171.xx Last login: Mon Jan 10 08:26:13 2022 from 223.62.21.xx [opc@examplelinuxinstance ~]$ df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 310M 0 310M 0% /dev tmpfs 341M 0 341M 0% /dev/shm tmpfs 341M 5.0M 336M 2% /run tmpfs 341M 0 341M 0% /sys/fs/cgroup /dev/sda3 39G 3.1G 36G 8% / /dev/sda1 200M 7.5M 193M 4% /boot/efi /dev/sdb 50G 33M 50G 1% /mnt/vol1 tmpfs 69M 0 69M 0% /run/user/0 tmpfs 69M 0 69M 0% /run/user/1000
Mount with UUID
According to the OCI document, if there are more than one volume other than the root volume, the order in which the device name and the actual device correspond to each other may be different after the server restarts if the device name is mounted. So to be precise, I mount it based on the UUID of the Volume.
Please refer to the document below for related information.
- Connecting to a Volume > Traditional fstab Options
As an individual, this article was written with my personal time. There may be errors in the content of the article, and the opinions in the article are personal opinions.