mount sshfs file system

said earlier

How to configure and mount OCFS2 file system

Configure and mount OCFS2 file system using vmware shared disk

Configure and mount OCFS2 file system using DRBD

But in many cases we don't need to use a shared file system. For example, backup, we know that local storage is not safe. Once the hard disk fails, the data and backup will be lost. Generally, it is required to save it in another place, that is, to put the backup in other places or on the host. At this time, as long as the local host can mount The directory of other hosts and read and write on it.

mount sshfs file system

Original 2023-05-25 18:30 Heplit

said earlier

How to configure and mount OCFS2 file system

Configure and mount OCFS2 file system using vmware shared disk

Configure and mount OCFS2 file system using DRBD

But in many cases we don't need to use a shared file system. For example, backup, we know that local storage is not safe. Once the hard disk fails, the data and backup will be lost. Generally, it is required to save it in another place, that is, to put the backup in other places or on the host. At this time, as long as the local host can mount The directory of other hosts and read and write on it.

In this case, NFS and CIFS can be used to share and mount to the local machine. SSHFS is an alternative to these protocols. As long as ssh can connect, you can mount a directory on the remote host to realize off-site storage.

Introduction

SSHFS (SSH Filesystem) is a file system client for mounting and interacting with directories and files on remote servers or workstations over a normal ssh connection.

This kind of client interacts with the remote file system through the SSH File Transfer Protocol (SFTP), which is a network protocol that provides file access, file transfer, and file management functions through any reliable data stream. It is designed as the Secure Shell (SSH ) protocol version 2.0 is an extension.

The current implementation of SSHFS using FUSE is a rewrite of an earlier version. The rewrite was done by Miklos Szeredi, who also wrote FUSEFS (SSH Filesystem) is a filesystem client for mounting and interacting with directories and files on remote servers or workstations over plain ssh connections.

Mount the file system using sshfs

Date: 2023-05-23

1 Test environment

almaliux 9.2: 192.168.55.156 provides ssh storage space/sshfs

oracle linux 7.9: 2 sets, mounted

Install

yum -y install http://www.rpmfind.net/linux/epel/7/x86_64/Packages/f/fuse-sshfs-2.10-1.el7.x86_64.rpm

Set mutual trust

#2台客户端都要执行
ssh-keygen -t rsa
ssh-copy-id [email protected]

mount

mkdir /local_sshfs
sshfs [email protected]:/sshfs /local_sshfs -o allow_other
df -h|grep 192.168.55.156

auto mount

#/etc/fstab 加入
sshfs#[email protected]:/sshfs /local_sshfs fuse user,_netdev,exec,reconnect,uid=0,gid=0,idmap=user,allow_other 0 0

illustrate

This mount is similar to a network share of nfs, not a shared file system. When multiple nodes mount at the same time and write to the same file, overwriting will occur

If you want to use a shared file system, such as OCFS2, GFS2, GPFS, please refer to my previous article.

Pay attention to anti-loss.

Guess you like

Origin blog.csdn.net/weixin_44496870/article/details/131657020