LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 06-12-2013, 06:53 PM   #16
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora/Pop!_OS
Posts: 2,983

Rep: Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551

here is a check list for you.

On the Laptop:
1. ensure the external HDD never goes to sleep (can wind down in RPMs, but not disconnect from laptop.
2. configure sshd.conf to allow for keys for authentication.
3. Optional: setup and configure NFS to share the external HDD via your LAN.

On the RPi:
1. create rsa key to what ever level of encryption you wish, i personally use 4096.
1a. cd ~/.ssh
1b. ssh-keygen -t rsa -b 4096
1c. follow directions on screen, DO NOT PUT IN A PASSPHRASE as this will be for unattended authentication.
2. create script to rsync XYZ data to your laptop (by doing this there is zero reason to have a mount point or use sshfs)
3. after the rsync is complete, you can rm -rf the data on the local SSD to ensure you do not run out of space.

that is unless you wish to store the data on the external HDD instead of the SSD on the RPi. If that is the case, then NFS is the best way to go and skip sshfs completely. if you are worried about the data being intercepted for security reasons establish the connection via ssh exactly as i described above with the same rsa key we just created and use that to mount the point local. It is what sshfs does so you could use sshfs for that exact situation.
 
Old 06-17-2013, 08:53 AM   #17
mspear20
LQ Newbie
 
Registered: Apr 2013
Posts: 20

Original Poster
Rep: Reputation: Disabled
Hey guys,

I really do appreciate all the help.

Little update:
I currently am using sshfs to have my RPi connect to the other computer. I have forgone the external HD, and am just having it go to the laptops.
I created the script to have it create a new folder and copy the files into the folder that was created every 15 mins using a cron job. It has been working great!
Im not too worried about security, so I basically have set the sshfs connection and left the laptop and RPi sit. Its been going strong for about 6 days now.

Now my next question for you all is this:
When using NFS, If as soon as a file is created on the Pi (new video clip) it will show up on the laptop correct? But if were to shut off the Pi or disconnect, will the files still be on the laptop?
Basically when a file is being created on the Pi, will it also be written directly on the laptop at the same time? Or is it like sshfs where it just shows it in the folder but I still have to have a script to copy the files over?

Sorry, I can't really describe what Im trying to get at. Hopefully you get see where Im going.

Any info helps

Thanks,
Mike
 
Old 06-17-2013, 09:02 AM   #18
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
whether you use sshfs/nfs/samba/http/ftp/... if the server is no longer available then the files it is serving will also be unavailable.
 
1 members found this post helpful.
Old 06-17-2013, 09:24 AM   #19
mspear20
LQ Newbie
 
Registered: Apr 2013
Posts: 20

Original Poster
Rep: Reputation: Disabled
Thanks for the replay,

Ok see this is part of the "hard to explain" part. I totally understand that if the two get disconnected, no files will be avaiable from each other. (In my case from the Pi) Let me try this.

1. Pi and laptop are connected through NFS
2. file is created on Pi
3. Through NFS, file is written to the HD and accessible on the laptop (without the use of any scripts)
4. Take the pi offline
5. On the laptop, Navigate to the NFS folder and see the video file.

Step number 4 is what Im trying to ask. Hope this helps

Thanks as always,
Mike
 
Old 06-17-2013, 09:33 AM   #20
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
Quote:
Originally Posted by mspear20 View Post
...
1. Pi and laptop are connected through NFS (assuming the laptop is the server and the pi is the client)
2. file is created on Pi
3. Through NFS, file is written to the HD and accessible on the laptop (without the use of any scripts)
4. Take the pi offline
5. On the laptop, Navigate to the NFS folder and see the video file.

Step number 4 is what Im trying to ask. Hope this helps

Thanks as always,
Mike
at this point it wouldnt matter if you no longer have an internet connection since the files now reside on the laptop harddrive (you could even disconnect and take the laptop to alaska and still have access to your files as long as you are no longer trying to download from your pi <@).
 
Old 06-17-2013, 09:43 AM   #21
mspear20
LQ Newbie
 
Registered: Apr 2013
Posts: 20

Original Poster
Rep: Reputation: Disabled
Awesome!

So let me get this straight:
If I set up the laptop as the NFS server and mount a directory to the Pi, then all I have to do is basically have the video files that are created on the pi, go into the mounted directory. Then this way, it will be written on the latops HD. The files wont even touch the Pis SD card at this point. Correct?

Then a simple script could be written on the laptop to move files around to desired folders.

Yes?

Thanks,
Mike
 
Old 06-17-2013, 11:40 AM   #22
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora/Pop!_OS
Posts: 2,983

Rep: Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551
Quote:
Originally Posted by mspear20 View Post

Now my next question for you all is this:
When using NFS, If as soon as a file is created on the Pi (new video clip) it will show up on the laptop correct? But if were to shut off the Pi or disconnect, will the files still be on the laptop?
Basically when a file is being created on the Pi, will it also be written directly on the laptop at the same time? Or is it like sshfs where it just shows it in the folder but I still have to have a script to copy the files over?

Sorry, I can't really describe what Im trying to get at. Hopefully you get see where Im going.

Any info helps

Thanks,
Mike
a file share is a file share. if the file has been moved from the RPi to your storage end then it will be on the storage end. if not then it will remain on the RPi.

an other big advantage to using NFS v. sshfs is that you can then configure autofs to automatically mount/umount the share point as you perform the transfer.

if there is zero connection, there is no file transfer. the connection MUST be there in order to share the file across the network. this does not change regardless of the OSs involved.
 
Old 06-17-2013, 11:45 AM   #23
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora/Pop!_OS
Posts: 2,983

Rep: Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551
Quote:
Originally Posted by mspear20 View Post
Awesome!

So let me get this straight:
If I set up the laptop as the NFS server and mount a directory to the Pi, then all I have to do is basically have the video files that are created on the pi, go into the mounted directory. Then this way, it will be written on the latops HD. The files wont even touch the Pis SD card at this point. Correct?

Then a simple script could be written on the laptop to move files around to desired folders.

Yes?

Thanks,
Mike
yes you could do that, but keep in mind the write speed of your network v. local to the SSD. if the files are large enough you run the risk of corruption due to the MUCH SLOWER connection speed of the network. Sorry there is not a cost effective home use network that is going to be able to read/write as fast as your RPi can read/write locally to your connected SSD card.

can it be done in the commercial world yes. there are fiber solutions that allow for enough bandwidth for that type of application, but they do not come cheap.

your process of writing to the SSD, then using rsync or scp to move the data to some form of external storage is ideal for you. you will find rsync is lighter on the RPi then scp/cp and will not lock the RPi so that it will continue to perform its primary job during the copy.
 
Old 06-17-2013, 12:04 PM   #24
mspear20
LQ Newbie
 
Registered: Apr 2013
Posts: 20

Original Poster
Rep: Reputation: Disabled
Hmmm ok. I was afriad that the speed might be a problem.

Well last week I ordered another RPi that I was going to use for something else, but now I think Ill grab one of my other laptops, throw Ubuntu on it and try NFS with it and see how it works. Thanks for all the advice guys!

I probably will be back with more questions or comments

Thanks again,
Mike
 
Old 06-17-2013, 04:54 PM   #25
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora/Pop!_OS
Posts: 2,983

Rep: Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551
you might want to look into CentOS instead of Ubuntu for your NFS server. specifically for privacy. Canonical will take your personal data and sell it to the likes of Facebook, E-Bay, Amazon, etc.... CentOS does not. Also CentOS is a true server class OS while Ubuntu is neither a desktop nor a server OS. it is a wanabe Linux fake environment.

or if you are just not comfortable with the RedHat way of doing things, then use pure Debian as your server. it will be 100x more stable and secure, not to mention zero built in mal/spyware like Ubuntu.
 
Old 06-17-2013, 05:14 PM   #26
escolom
Member
 
Registered: Apr 2012
Location: San Francisco, cA
Distribution: Ubunto 12.04/Debian 7
Posts: 57

Rep: Reputation: Disabled
my two cents

I found samba to be flakey between ubunto and windows xp, windows pro. I am not sure why. but since you
are going Linux to Linux.. just share the folder where you have your usb drive mounted. if the rasb pi is connected wirelessly
to the same router it should see the folder. on rasb pi nataulis, add a bookmark for that folder.

you should be okay and then you can write a simple .sh script to copy your files and schedule it with crontab -e
I wish I new the syntax in bash to add a date to folder name. anyone?
 
Old 06-18-2013, 08:36 AM   #27
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
^ man date
 
Old 06-18-2013, 03:45 PM   #28
mspear20
LQ Newbie
 
Registered: Apr 2013
Posts: 20

Original Poster
Rep: Reputation: Disabled
Thanks guys,

Like I said I have everything working already with sshfs. Im just looking for a way to make it a little more efficient. Ill work on the suggestions and let you all know if I need anything.

Thanks again,
Mike
 
Old 06-28-2013, 08:28 PM   #29
mspear20
LQ Newbie
 
Registered: Apr 2013
Posts: 20

Original Poster
Rep: Reputation: Disabled
Alright guys, Im back...

Heres whats going on:
I have debian 6.06 installed on my other laptop. For testing I have my RPi connected via ethernet cable to my laptop.
My Laptop, which is the server, has an address of 192.168.1.1/24 and the Pi has 192.168.1.3
I installed nfs on both my Pi and laptop.

On the laptop (/etc/exports)
Code:
/motion_back 192.168.1.1/24(rw,sync,no_root_squash,no_subtree_check)
/motion_counter 192.168.1.1/24(rw, sync,no_root_squash,no_subtree_check)
On the Pi(fstab)
Code:
192.168.1.1:/motion_counter /motion_counter nfs auto,noatime,nolock,bg,nfsvers=3,intr,tcp,actime=1800 0 0
For the sake of testing I do not have the /motion_back in the fstab file yet.

Now after restarting the server/Pi services (exports, nfs server, etc) I go to mount manually on the Pi with the command
Code:
mount 192.168.1.1:/motion_counter /motion_counter
And I get the following errors

Code:
mount.nfs: rcp.statd is not running but is required for remote locking.
mount.nfs: Either use '-o nolock' to keep locks local, or start statd.
mount.nfs: an incorrect mount option was specified
I cannot find this statd anywhere nor do I know how to start it.

Thats what I got at the moment. If you need more info please let me know.

Thanks again,
Mike
 
Old 06-29-2013, 09:53 AM   #30
mspear20
LQ Newbie
 
Registered: Apr 2013
Posts: 20

Original Poster
Rep: Reputation: Disabled
Bit of an update. I was playing around with it some more. The service portmap wasnt started on the Pi. So I started the service rpcbind, which I guess has taken place of portmap on the Pi. Now when I go to mount, I get the server denied access. What do I need to do to allow access?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Arch Linux on Raspberry Pi Running XFCE LXer Syndicated Linux News 0 01-15-2013 10:30 AM
Running startup script fails because network share isn't ready (Perforce on Debian) tstein Linux - Software 1 05-21-2012 06:57 PM
Bash script for listing FTP usage as the file name of a file created in each share jojothedogboy Programming 1 12-05-2008 03:35 PM
script to upload backup file to smb share c_mitulescu Linux - Networking 1 03-15-2007 11:34 AM
Running a script file johnlb Linux - Newbie 2 02-19-2003 02:17 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 11:08 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration