A team wants a shared directory mounted on 10 app servers. How do you set up NFS?
BeginnerScenarioStorage, disks and filesystems
Answer
Situation read → NFS server export plus client mounts.
What I'd do →
- Server:
sudo dnf install -y nfs-utils # or apt install nfs-kernel-server
sudo mkdir -p /exports/shared
echo '/exports/shared 10.0.1.0/24(rw,sync,root_squash)' | sudo tee -a /etc/exports
sudo systemctl enable --now nfs-server
sudo exportfs -rav
- Open firewall for NFSv4 (TCP 2049).
- Clients:
10.0.1.10:/exports/shared /mnt/shared nfs4 defaults,_netdev,nofail 0 0in fstab, thenmount -a.
Why → root_squash maps client root to nobody, so root on a client can't own the share. _netdev waits for the network at boot.
Interview tip → Say UIDs must match across clients (or use NFSv4 idmapping) otherwise ownership looks wrong.
More on Storage, disks and filesystems
You get paged at 3 AM: the root filesystem on a production server is at 98% and climbing. Walk through your response.BeginnerA new 200 GB EBS volume is attached to an EC2 instance. How do you make it usable and persistent across reboots?BeginnerThe `/var` LVM logical volume is nearly full and there is free space in the volume group. How do you grow it online?BeginnerThe volume group has no free space. You've been given a new disk. How do you add it to grow `/var`?IntermediateA cloud VM's root disk was enlarged from 30 GB to 80 GB in the console, but `df` still shows 30 GB. What do you do?BeginnerYou need to move a busy MySQL data directory from the root disk to a new, faster volume. Plan it.Intermediate