mirror of
https://github.com/acedanger/shell.git
synced 2025-12-06 02:20:11 -08:00
4.1 KiB
4.1 KiB
NAS Mount Setup Guide for Fedora 42
Quick Setup Instructions
Your NAS IP: 192.168.68.51
Mount Point: /mnt/share/media
Prerequisites (Already Installed)
cifs-utils- for SMB/CIFS mountingnfs-utils- for NFS mounting
Option 1: Automated Setup (Recommended)
Run the interactive setup script:
./setup-nas-mount.sh
This script will:
- Test both SMB and NFS connectivity
- Guide you through the setup process
- Create persistent mount configuration
- Set up systemd mount units for reliable boot mounting
Option 2: Manual SMB/CIFS Setup
-
Test SMB shares first:
# List available shares (you'll need NAS credentials) smbclient -L 192.168.68.51 -U your_username -
Create credentials file (if using authentication):
sudo tee /etc/nas-credentials << EOF username=your_nas_username password=your_nas_password domain=WORKGROUP EOF sudo chmod 600 /etc/nas-credentials -
Test mount:
# With credentials sudo mount -t cifs //192.168.68.51/share_name /mnt/share/media -o credentials=/etc/nas-credentials,uid=$(id -u),gid=$(id -g),iocharset=utf8 # Or for guest access sudo mount -t cifs //192.168.68.51/share_name /mnt/share/media -o guest,uid=$(id -u),gid=$(id -g),iocharset=utf8 -
Add to /etc/fstab for persistence:
# Backup fstab first sudo cp /etc/fstab /etc/fstab.backup # Add entry (with credentials) echo "//192.168.68.51/share_name /mnt/share/media cifs credentials=/etc/nas-credentials,uid=$(id -u),gid=$(id -g),iocharset=utf8,noauto,user 0 0" | sudo tee -a /etc/fstab # Or for guest access echo "//192.168.68.51/share_name /mnt/share/media cifs guest,uid=$(id -u),gid=$(id -g),iocharset=utf8,noauto,user 0 0" | sudo tee -a /etc/fstab
Option 3: Manual NFS Setup
-
Check available NFS exports:
showmount -e 192.168.68.51 -
Test mount:
sudo mount -t nfs 192.168.68.51:/path/to/export /mnt/share/media -o rw,hard,intr -
Add to /etc/fstab:
echo "192.168.68.51:/path/to/export /mnt/share/media nfs rw,hard,intr,rsize=8192,wsize=8192,timeo=14,noauto,user 0 0" | sudo tee -a /etc/fstab
Systemd Mount Unit (For Reliable Boot Mounting)
Create /etc/systemd/system/mnt-share-media.mount:
[Unit]
Description=Mount NAS Media Share
After=network-online.target
Wants=network-online.target
[Mount]
What=//192.168.68.51/share_name
Where=/mnt/share/media
Type=cifs
Options=credentials=/etc/nas-credentials,uid=1000,gid=1000,iocharset=utf8
[Install]
WantedBy=multi-user.target
Enable it:
sudo systemctl daemon-reload
sudo systemctl enable mnt-share-media.mount
sudo systemctl start mnt-share-media.mount
Common Commands
- Mount manually:
sudo mount /mnt/share/media - Unmount:
sudo umount /mnt/share/media - Check mount status:
df -h /mnt/share/media - Test systemd mount:
sudo systemctl start mnt-share-media.mount
Troubleshooting
-
Check connectivity:
ping 192.168.68.51 -
Test SMB connection:
nc -zv 192.168.68.51 445 -
Test NFS connection:
nc -zv 192.168.68.51 2049 -
Check mount logs:
journalctl -u mnt-share-media.mount -
Verify fstab syntax:
sudo mount -a
Security Notes
- Credentials file should have 600 permissions (readable only by root)
- Consider using NFS over SMB for better performance on Linux
- Use
noautoin fstab to prevent boot delays if NAS is unavailable - The
useroption allows regular users to mount/unmount
Integration with Your Backup Scripts
Your backup-media.sh script already references /mnt/share/media/backups, so once the NAS is mounted, your backups will automatically work with the NAS storage.
Make sure your backup script has proper error handling for when the NAS is not mounted:
# Add this check to your backup scripts
if ! mountpoint -q /mnt/share/media; then
log_error "NAS not mounted at /mnt/share/media"
exit 1
fi