This post was finally edited by jgbrown54 at 2022-11-19 11:56
After trying numerous references on the internet for mounting network drives on Armbian and Linux, I finally found a way that works and is easy. It uses entries in fstab and mounts them using cron.
The first thing to do is to create a mount point. I added a folder to /mnt named share with the following command:
sudo mkdir /mnt/share
This is where you will access the drive after it's mounted. You can reference a folder anywhere you have access to.
I also needed to add the cifs utilities with the following command:
sudo apt install cifs-utils
Then I needed to figure out how to mount the share. I found that it would mount manually with the following command:
sudo mount -o username=<username>,password=<password>,nofail,vers=1.0 //192.168.1.115/Media_Disk1 /mnt/share
I had to add the vers=1.0 because the NAS I was accessing uses an old format for SAMBA. You can probably leave this off or try it at 1.0, 2.0, or 3.0.
That command mounted the external share //192.168.1.115/Media_Disk1 so that I could access all the files on it by accessing /mnt/share.
Since that was successful, I unmounted the drive using the following command:
sudo umount /mnt/share
Notice the spelling. That is umount not unmount.
Then I opened fstab with the following command:
sudo nano /etc/fstab
At the bottom of fstab I added the following line:
//192.168.1.116/Media_Disk1 /mnt/share cifs username=<username>,password=<password>,nofail,vers=1.0
Notice that this is basically the same as the mount command except for the cifs and the options are at the end instead of at the beginning. I saved the changes to fstab.
Entering the following command would mount all the drives in fstab:
sudo mount -a
I thought this was all I needed to do but the drive did not maount on a reboot. As it turns out, Armbian does not automount fstab during boot. So I had to set up an entry in crontab using the following command:
sudo crontab -e
Then at the bottom of the crontab add a line that reads like this:
@reboot /bin/bash -c 'sleep 10 && /bin/mount -a'
And then saved the crontab. I added the 10 second sleep just to make sure the network was up and stable before mounting the drive. You may not need this but I thought it was a good idea. So now cron will wait 10 seconds after boot and issue the /bin/mount -a.
I actually wound up adding several network locations and they all mount as long as the system they are on is running when the OPIzero is booted. This should work for other Armbiam systems as well.
|