This topic explains how to access an on-premises file gateway from a Linux client.
Prerequisites
You must have an existing NFS share. For more information, see Install an NFS client.
Background
-
To access an on-premises file gateway from a Linux client, you must mount its NFS share to a local directory. This process maps the NFS share to your client, letting you treat it as a local directory.
-
In a Linux operating system, you can mount an NFS file system manually or automatically. To ensure the mount persists after a client restart, we recommend that you configure an automatic mount after a successful manual mount.
Manually mount an NFS share
-
Log on to your local Linux client.
-
Mount the share to a local directory on the client.
NoteCommand parameters:
-
192.168.0.0:/shares: The mount target for the Cloud Storage Gateway, which consists of the gateway's IP address and the share name. You can find the mount target on the share page of your target gateway in the Cloud Storage Gateway console. -
local-directory: An existing local directory on the client where you have read and write permissions.
-
To mount the share using the NFSv4 protocol, run the following command:
sudo mount -t nfs -o vers=4.0,nolock,proto=tcp,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport 192.168.0.0:/shares local-directory -
To mount the share using the NFSv3 protocol, perform the following steps:
-
Run the following command to obtain the mount target.
showmount -e <gateway-ip-address> -
Run the following command to mount the share. The example assumes the mount target is
192.168.0.0:/shares.sudo mount -t nfs -o vers=3,nolock,proto=tcp,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport 192.168.0.0:/shares local-directory
-
-
-
Run the
df -hcommand to check the mount result.If the output is similar to the following, the mount is successful.
NoteAfter a successful mount, the displayed capacity is 256 TB. This value represents the maximum size of the gateway's virtual file system and does not reflect the actual storage capacity of the underlying OSS bucket, which is virtually unlimited.
[root@centos7cb ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/vda1 99G 1.6G 92G 2% / devtmpfs 24G 0 24G 0% /dev tmpfs 24G 0 24G 0% /dev/shm tmpfs 24G 424K 24G 1% /run tmpfs 24G 0 24G 0% /sys/fs/cgroup tmpfs 4.8G 0 4.8G 0% /run/user/0 xxx:/nfs2 256T 0 256T 0% /mnt/nfs172cent7.4 [root@centos7cb ~]# -
Access the share.
Once mounted, you can treat the share as a local directory. Your access is determined by your read and write permissions.
NoteA share is synchronized with its associated OSS bucket. Operations performed on a share are synchronized to the objects in the associated bucket.
Automatically mount an NFS share
To ensure the NFS mount persists after a client restart, configure an automatic mount by adding it to the /etc/fstab (recommended) or /etc/rc.local file.
Before you configure an automatic mount, make sure the manual mount is successful to prevent client startup failures.
-
Add the mount configuration.
-
Method 1 (Recommended): Open the
/etc/fstabconfiguration file and add the mount configuration.NoteIf you are configuring an automatic mount on a CentOS 6.x system, you must first perform the following steps:
-
Run the
chkconfig netfs oncommand to enable netfs to start on boot. -
Open the
/etc/netconfigconfiguration file and comment out the inet6-related content.
-
To mount the file system using the NFSv4 protocol, add the following configuration:
192.168.0.0:/shares local-directory nfs vers=4.0 defaults 0 0 -
To mount the file system using the NFSv3 protocol, add the following configuration:
192.168.0.0:/shares local-directory nfs vers=3.0 defaults 0 0
NoteCommand parameters:
-
192.168.0.0:/shares: The mount target for the Cloud Storage Gateway, which consists of the gateway's IP address and the share name. You can find the mount target on the share page of your target gateway in the Cloud Storage Gateway console. -
local-directory: An existing local directory on the client where you have read and write permissions.
-
-
Method 2: Open the
/etc/rc.localconfiguration file and add the mount configuration.NoteBefore you configure the
/etc/rc.localfile, make sure the user has execute permissions on the/etc/rc.localand/etc/rc.d/rc.localfiles. For example, on CentOS 7.x systems, users do not have execute permissions by default.-
To mount the file system using the NFSv4 protocol, add the following mount command:
sudo mount -t nfs -o vers=4.0,nolock,proto=tcp,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport 192.168.0.0:/shares local-directory -
To mount the file system using the NFSv3 protocol, add the following mount command:
sudo mount -t nfs -o vers=3,nolock,proto=tcp,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport 192.168.0.0:/shares local-directory
NoteCommand parameters:
-
192.168.0.0:/shares: The mount target for the Cloud Storage Gateway, which consists of the gateway's IP address and the share name. You can find the mount target on the share page of your target gateway in the Cloud Storage Gateway console. -
local-directory: An existing local directory on the client where you have read and write permissions.
-
To mount the file system using the NFS v4 protocol, run the following command:
sudo mount -t nfs -o vers=4.0,nolock,proto=tcp,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport 192.168.0.0:/shares local-directory -
To mount the file system using the NFS v3 protocol, run the following command:
sudo mount -t nfs -o vers=3,nolock,proto=tcp,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport 192.168.0.0:/shares local-directory
-
-
-
Run the
rebootcommand to restart the client. -
Run the
df -hcommand to check the mount result.