No, mount works on many other types of devices and virtual filing systems. It can also mount anywhere within the filing system hierarchy, but it never creates any directories. The place where you mount something has to be an existing directory, which is then overlaid by whatever you are mounting.
Yeah, I was thinking about the initial partition mount. IIRC the directories in the root partition are created from /etc/fstab during the initial mount, because for sure they aren't set up by partition formatting, but I may have misremembered how fstab processing works.
Apart from that my other mounts, e.g. for backups, were scripted years ago and have not been looked at since ... the brain gets rusty.
On Thu, 17 May 2018 19:57:50 +0100, RobH declaimed the following:
You are logged into the NAS... That is not the machine you need to do the mount on.
CCTV is a LOCAL DIRECTORY ON THE NAS...
You have to create a directory on the RPI which you use "mount" on in order to link the NAS directory onto the RPI directory (the names do not have to be the same).
--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/
Traceback (most recent call last) File "intruder_recmotion.py", line 37, in shutil.copyfile(RAMname, NASname) File "/usr/lib/python 2.7/shutil.py", line 83, in copyfile with open(dst, 'wb') as fdst: IOError: [Errno 2] No such file or directory: '/192.168.0.22/mnt/CCTV/PiZero/2018-16-16_11.25.36.h264'
I have checked the path to the PiZero folder or dataset on my FreeNAS box and it is correct.
I am not doing the mount on my NAS box, only on the Pi Zero.
And I am not sure if you saw my reply to you after you supplied the new python code for me to use, but I am getting this when I run the said script.
After I created the the said folders on the Pi Zero ie /mnt/CCTV/PiZero I then ran the python script for the sensor detection and camera , and it returned :
Traceback (most recent call last) File "intruder_recmotion.py", line 37, in shutil.copyfile(RAMname, NASname) File "/usr/lib/python 2.7/shutil.py", line 83, in copyfile with open(dst, 'wb') as fdst: IOError: [Errno 2] No such file or directory: '/192.168.0.22/mnt/CCTV/PiZero/2018-16-16_11.25.36.h264'
I have checked the path to the PiZero folder or dataset on my FreeNAS box and it is correct.
You're not storing the result of join. This should be something like:
for f in os.listdir(src_dir): f = os.path.join(src_dir, f)
For me, as I am only a newbie wit both Linux and more so python, I am not sure where I would actually include a similar statement or line of code in the python code you did for me.
Ok I have removed the //192.168.0.22 and is now //mnt/CCTV/PiZero.
The python script runs without error, BUT it does not record any file from detected motion.At least, I cannot find any files in //mnt/CCTV/PiZero on the PI Zero, nor on my NAS box.
On Fri, 18 May 2018 12:47:24 +0100, RobH declaimed the following:
Remove the extra / -- the local machine file system root is just one /
It doesn't go "in" the directory...
The "mount" command takes the NAS path (this is the one that has the IP#) and maps it to the local directory path (the one without an IP#) by which you will access it. They don't have to be the same names. It just requires the local directory path to exist first.
mount ... //NAS/mnt/CCTV/PiZero /mnt/CCTV/PiZero
maps the local PiZero directory to the NAS PiZero directory -- but leaves the parent CCTV directory as a local:
cd /mnt/CCTV is still on the RPI cd /mnt/CCTV/PiZero is really on the NAS
but if you did
mount ... //NAS/mnt/CCTV /mnt/CCTV
and the NAS has the full path to a PiZero directory then
cd /mnt/CCTV will be on the NAS, and cd /mnt/CCTV/PiZero will also be on the NAS
"mount" sets the "root" for the remote file system -- you can go /down/ deeper in the directory structure, but can not go above the remote root (attempts will put you back in the local RPI file system)
--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/
Thanks for the clarification there, much appreciated.
On the PiZero I did mount //NAS/mnt/CCTV/PiZero /mntCCTV/PiZero and it returned: Password for root@N/NAS/mnt/CCTV/PiZero. So I used the PiZero password as I didn't know what else to use.
And then it returned: mount error(115): operation now in progress. Refer to mount.cifs(8) manual page
Also I did mount //NAS/CCTV /mnt/CCTV, and this also returned the same as above
On Fri, 18 May 2018 16:53:18 +0100, RobH declaimed the following:
Why are you trying to put the /script/ there?
Remember -- I don't have a real NAS, so I'm using a variation of "mount" to redirect part of the file system itself to a mount point.
pi@raspberrypi:~$ ls Desktop Downloads oldconffiles Public Templates Documents Music Pictures python_games Videos pi@raspberrypi:~$ ls Public
Nothing in the "Public" directory... so create a directory tree within it... This is supposed to be the NAS directory tree (what you would find if you logged into the NAS itself).
Just some old stuff in /media... Create the "mount point" directory -- this is the location on the RPI where you will mount the NAS -- note that the path name does not have be a duplicate of the one on the NAS itself
pi@raspberrypi:~$ sudo mkdir /media/FakeNASmnt
"mount" the "NAS" onto the mount point I created. "--bind" is an option that allows for source to be a file system rather than a block/network device (this is all on one line). Also note that I mounted a higher level, not the bottom-most directory.
pi@raspberrypi:~$ sudo mount --bind /home/pi/Public/myFakeNAS/ /media/FakeNASmnt/
Show the contents of the /media/FakeNASmnt directory -- note how the subdirectory I'd created in Public/myFakeNAS is there...
pi@raspberrypi:~$ ls -R /media/FakeNASmnt/ /media/FakeNASmnt/: aSubDir
/media/FakeNASmnt/aSubDir:
Create a file in the "NAS" mount point subdirectory
pi@raspberrypi:~$ vim /media/FakeNASmnt/aSubDir/aNewFile.txt pi@raspberrypi:~$
Show the file in the mount point
pi@raspberrypi:~$ ls -R /media/FakeNASmnt/ /media/FakeNASmnt/: aSubDir
/media/FakeNASmnt/aSubDir: aNewFile.txt
Copy the file up one level (which is still the faked NAS)
On Fri, 18 May 2018 18:07:11 +0100, RobH declaimed the following:
Since you tend to be typing everything in these posts rather than cut&pasting directly from the RPI console window it is difficult to tell what may or may not be a typo...
It wants the password for the root account on the NAS... As it said: root@N/NAS/mnt/CCTV/PiZero
formatting link
You need to pass username and password options to the mount command (especially if the NAS login is not the same as the R-PI user).
You probably also need to "umount" these to clean up partial operations.
--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/
where the *script* resides does not matter. I said *in* your script ON THE PI, save to *local directory* This is - of course - about the file you wanh't on then NAS - the picture.
so - save the *picture* (which you do *in your script*) to the local directory.
ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here.
All logos and trade names are the property of their respective owners.