An OSS bucket that you manually mount to a Linux system is not automatically remounted when the system restarts. To automatically mount an OSS bucket on system startup, modify the /etc/fstab file.
Prerequisites
You have installed ossfs 2.0.5 or a later version, and completed the ossfs 2.0 configuration. If you are using a version of ossfs 2.0 earlier than 2.0.5, upgrade to 2.0.5 or a later version.
Procedure
ossfs 2.0.5 and later lets you configure automatic mount on startup using the fstab file. After you complete the configuration, the specified OSS bucket is automatically mounted when the Linux system restarts.
Log on to the Linux system. Edit the /etc/fstab file to add the following automatic mount entry, and then save the file.
NoteEach automatic mount entry applies to only one bucket. To configure automatic mount for multiple buckets, add a separate mount entry for each bucket.
ossfs2#bucket_name mount_point fuse _netdev,nofail,x-systemd.after=networkd-dispatcher.service,conf=/root/ossfs2.conf 0 0The following table describes the parameters.
Parameter
Description
bucket_name
The name of the target bucket to mount. Replace this with the actual name of your OSS bucket.
mount_point
The local mount folder. Replace this with the actual path of your local mount folder.
_netdev,nofail,x-systemd.after=networkd-dispatcher.service
fstab-related parameters. These parameters ensure that the mount operation is executed only after the relevant network services are started. This prevents mount failures caused by network connectivity issues.
conf=/root/ossfs2.conf
The absolute path of the ossfs 2.0 configuration file. Replace this with the actual path of your configuration file.
0 0
The dump and fsck options for the file system. Set both to 0.
Run the
mount -a -t fusecommand to automatically mount all fuse-type entries in /etc/fstab. If the command runs without reporting any errors, the configuration is correct.