SIMULATION -
/data Directory is shared from the server1.example.com server. Mount the shared directory that:
SIMULATION -
/data Directory is shared from the server1.example.com server. Mount the shared directory that:
To mount a shared directory from server1.example.com permanently and ensure it survives reboots, you can use autofs. Here’s how to do it: 1. vi /etc/auto.master Add the following line: /mnt /etc/auto.misc --timeout=50 2. vi /etc/auto.misc Add the following line for the data mount: data -rw,soft,intr server1.example.com:/data 3. Restart the autofs service and enable it to start on boot: service autofs restart chkconfig autofs on This configuration will ensure that the shared directory from server1.example.com is automatically mounted when accessed and unmounted after 50 seconds of inactivity. The /etc/auto.master is the master configuration file for autofs service, and it reads the mount points as defined in /etc/auto.master when the service starts.
In RHEL8 and because de request is not with autofs, we can proceed in this way: # mount server1.example.com server:/data /mnt
One rule for the exam is that all changes we are making should survive reboot. Which is why autofs would be a good option.
yum -y install nfs-utils showmount -e server1 mkdir -p /mnt/data sudo mount -t nfs server1.example.com:/data /mnt/data echo 'server1.example.com:/data /mnt/data nfs defaults 0 0' >> /etc/fstab
mount server1.example.com:/data /mnt
Is it should install cif-utils,or nfs-utils?
At server1: # yum install -y nfs-utils # systemctl enable --now nfs-server # echo “/data server2(rw)” >> /etc/exports # exportfs -av At server2: #mount -o rw,sync server1.example.com:/data /mnt #df -h /mnt
Server1 assume /data already share from server1.example.com, otherwise #echo '/data *(rw)' >> /etc/exports #exportfs -a Server2 #systemctl enable --now nfs-server #mkdir /mnt/shared #mount -t nfs server1.example.com:/data mnt/shared