systemd ile)Bu rehber, Windows'taki bir paylaşımı (CIFS/SMB) Linux sunucuda otomatik olarak mount etmek için systemd servisi oluşturmayı ve yapılandırmayı anlatır.
Öncelikle /etc/fstab dosyasına aşağıdaki satırı ekleyin (yol ve IP'yi kendinize göre düzenleyin):
//192.168.1.8/Paylasim /mnt/paylasim cifs credentials=/root/.smbcredentials,iocharset=utf8,file_mode=0777,dir_mode=0777,vers=3.0,nofail,x-systemd.automount,x-systemd.device-timeout=10 0 0
/etc/systemd/system/mount-paylasim.service dosyasını oluşturun ve içine şunu yazın:
[Unit]
Description=Mount Windows Share
After=network-online.target
Wants=network-online.target
[Service]
Type=oneshot
ExecStart=/bin/mount -a
RemainAfterExit=true
[Install]
WantedBy=multi-user.target
Servisi etkinleştirin:
sudo systemctl enable mount-paylasim.service
İlk defa manuel olarak başlatmak için:
sudo systemctl start mount-paylasim.service
Servisin çalışıp çalışmadığını görmek için:
systemctl status mount-paylasim.service
Mount işleminin gerçekleşip gerçekleşmediğini görmek için:
mount | grep cifs
Sunucuyu yeniden başlattıktan sonra kontrol et:
sudo reboot
Yeniden başladıktan sonra:
systemctl status mount-paylasim.service
mount | grep cifs
Detaylı logları görmek için:
journalctl -u mount-paylasim.service
host is down hatası alınabilir.x-systemd.automount paylaşımı erişilmeye çalışıldığında otomatik mount eder.nofail boot işlemini engellemeden devam edilmesini sağlar.