/etc/fstab Options for Block Volumes Using Consistent Device Paths
On Linux instances, if you want to mount automatically volumes on instance boot, you need to set some specific options in the
/etc/fstab file, or the instance may fail to launch. This applies to both iSCSI and paravirtualized attachment types. This topic covers the options to use for block volumes attached with a consistent device path enabled.
Oracle Cloud Infrastructure service supports consistent device paths for instance created from Oracle-provided Linux-based images released November 2018 and later. For more information, see Connecting to Volumes With Consistent Device Paths. With consistent device paths, you can refer to the volume using the device path you selected when you attached the volume, as the device path will remain the same when the instance is rebooted. Before using the device path though, you should confirm that the instance is configured correctly to support device paths.
To verify that the volume is attached to an instance that supports consistent device paths, connect to the instance and run the following command:
You should see the following output after running this command:
If you do not see this output and instead see the following error message:
cannot access /dev/oracleoci/oraclevd*: No such file or directory
there may be a problem with the instance configuration for device paths. For assistance with this, contact support. See Contacting Support.
Use the _netdev and nofail Options
By default, the
/etc/fstab file is processed before the initiator starts. To configure the mount process to initiate before the volumes are mounted, specify the
_netdev option on each line of the
When you create a custom image of an instance where the volumes, excluding the root volume, are listed in the
/etc/fstab file, instances will fail to launch from the custom image. Specify the
nofail option in the
/etc/fstab file to prevent this issue.
In the example scenario with three volumes, the
/etc/fstab file entries for the volumes with the
nofail options are as follows:
/dev/oracleoci/oraclevdb /mnt/vol1 xfs defaults,_netdev,nofail 0 2 /dev/oracleoci/oraclevdc /mnt/vol2 xfs defaults,_netdev,nofail 0 2 /dev/oracleoci/oraclevdd /mnt/vol3 xfs defaults,_netdev,nofail 0 2
Once you have updated the
/etc/fstab file, use the following command to mount the volumes:
bash-4.2$ sudo mount -a
Reboot the instance to that confirm the volumes are mounted properly on reboot with the following command:
bash-4.2$ sudo reboot
Troubleshooting Issues with the /etc/fstab File
If the instance fails to reboot after you update the
/etc/fstab file, you may need to undo the changes to the
/etc/fstab file. To update the file, connect to the serial console for the instance using the steps described in Instance Console Connections. Once you have access to the instance using the serial console connection, you can remove, comment out, or fix the changes you made to the