Oracle Cloud Infrastructure Documentation

fstab Options for Block Volumes Using Consistent Device Paths

On Linux instances, if you want to automatically mount volumes on instance boot, you need to set some specific options in the /etc/fstab file, or the instance may fail to launch.

Note

These steps are for block volumes that are attached with consistent device paths enabled. If the block volume does not have consistent device paths enabled, use the legacy etc/fstab options instead.

Prerequisites

Before using a consistent device path, you should confirm that the instance supports consistent device paths and is correctly configured.

To verify that the volume is attached to a supported instance, connect to the instance and run the following command:

ll /dev/oracleoci/oraclevd*

The output will look similar to the following:

lrwxrwxrwx. 1 root root 6 Feb  7 21:02 /dev/oracleoci/oraclevda -> ../sda
lrwxrwxrwx. 1 root root 7 Feb 7 21:02 /dev/oracleoci/oraclevda1 -> ../sda1
lrwxrwxrwx. 1 root root 7 Feb 7 21:02 /dev/oracleoci/oraclevda2 -> ../sda2
lrwxrwxrwx. 1 root root 7 Feb 7 21:02 /dev/oracleoci/oraclevda3 -> ../sda3

If you don't 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.

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 /etc/fstab file.

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. To prevent this issue, specify the nofail option in the /etc/fstab file.

In the example scenario with three volumes, the /etc/fstab file entries for the volumes with the _netdev and 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

After 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 confirm that 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, first connect to the serial console for the instance. When you have access to the instance using the serial console connection, you can remove, comment out, or fix the changes that you made to the /etc/fstab file.