An OSS bucket mounted manually does not persist across Linux system restarts. To mount the bucket automatically on every startup, add an entry to /etc/fstab.
Prerequisites
Before you begin, ensure that you have:
ossfs 2.0.6 or later installed. If you are on an earlier version of ossfs 2.0, upgrade to 2.0.6 or later. See Install ossfs.
ossfs 2.0 configured. See Configure ossfs 2.0.
Add an fstab entry
Open
/etc/fstaband add the following line:bucket_name mount_point ossfs2 _netdev,nofail,x-systemd.after=networkd-dispatcher.service,conf=/root/ossfs2.conf 0 0Replace the placeholders with your actual values:
Parameter Description bucket_nameThe name of the OSS bucket to mount. mount_pointThe local directory to use as the mount point. conf=/root/ossfs2.confThe absolute path to your ossfs 2.0 configuration file. _netdev,nofail,x-systemd.after=networkd-dispatcher.serviceMount options that ensure the mount runs only after network services are ready ( _netdev,x-systemd.after=networkd-dispatcher.service) and that a mount failure does not block system startup (nofail).0 0The dump and fsck values. Set both to 0for ossfs2 file systems.NoteEach fstab entry mounts one bucket. To mount multiple buckets, add a separate entry for each one.
Run the following command to mount all ossfs2 entries in
/etc/fstab:mount -a -t ossfs2If the command completes without errors, the configuration is correct.
该文章对您有帮助吗?