[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

mount an external usb hdd and share it through samba



Dear all,

 

I have an external usb hdd. I would like to automount it on boot and share it through samba.

 

1) So I put it in the fstab. It automounts correctly on boot, no problem:

UUID=XXX /usb-hdd ext4 defaults,nofail 0 0

 

2) I then share the directory “/usb-hdd” through samba (in smb.conf) after it was mounted. No problem again:

[usb-hdd]

comment = raid5-usb

path = /usb-hdd

read _only_ = No

valid users = michaelm

 

3) however, if the machine restarts, automounts works but the samba share always fails. I can easily fix it by:

systemctl restart smbd

 

Since automount works, and samba will work well if I restart it, my guess is that on boot, samba (smbd service) starts before /usb-hdd is mounted. To make it working,
I need make sure the fstab mounting happens before samba starts. Can anyone tell me how to do it? Or, any better solution for auto mount and share a usb HDD?

 

Thank you very much.

Micahel Morgan

 


Reply to: