LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   back up to NAS (https://www.linuxquestions.org/questions/linux-server-73/back-up-to-nas-777655/)

cbtshare 12-23-2009 05:49 AM

back up to NAS
 
Hey peeps, I spent all night trying to find a way to back up to NAS (ftp )from command line in linux(Redhat 4).I tried curl , but that is basically for one file transfers. I did the following for multiple files, but it didnt work
for f in /home/no/*; do curl --upload-file "$f" --ftp-pasv ftp://root:123456@44.44.44.44/backup; done

I tried mput -R but didnt work

Anyone have any ideas to do it best?

Thank you

cbtshare 12-23-2009 12:46 PM

any help or suggestion is good, i think i exhausted google.

jlinkels 12-25-2009 08:17 PM

If you provide more information about how the NAS is connected to you system, we can understand better what is possible and what not.

Right now, lacking information, I would recommend to mount the NAS on your file system, and run rsync, excluding /mnt, /proc, and sys. Much easier than ftp like solutions and you do incremental backups by default.

jlinkels

cbtshare 12-25-2009 11:25 PM

NAS , network attached storage, so its not connected to my system directly, its over the network , thats why I need to ftp in order to transfer the data.Sorry didnt state that.

jlinkels 12-26-2009 06:59 AM

NAS-es only accessible by FTP? I don't think so. For Windows machines I expect you can map drives on your Windows machines using SMB. Since many NAS-es run Linux internally usually you can mount these drives using NFS. This seems probable as FTP is also available. However if all else fails, you can install a SMB client on your machine and connect using Samba. Then the NAS has become part of you file system.

jlinkels

jlinkels 12-26-2009 08:11 AM

Double post, sorry

kellemes 12-26-2009 02:32 PM

What NAS is it? Brand, type etc..

cbtshare 12-26-2009 11:09 PM

ok @klinkels, thats a good idea I will try that, never heard of that been done before, thanks for the input.

@kellemes, its a DLINK DNS-321 .

kellemes 12-27-2009 03:58 AM

This is what jlinkels means, just mount the NAS like any other disk/partition you have on your system..

You may have to play with it a little to get it going on your system but this works for me..
This is on of my fstab-entries (/etc/fstab) for connecting to a Synology ds207+
Code:

//IP_TO_NAS/shared_folder /mnt/dir cifs user,uid=1000,rw,suid,credentials=/etc/credentials 0 0
Where /etc/credentials is a file holding login-data for the NAS...
Syntax:
Code:

username=john
password=password

You need to have "smbfs" installed.
(Don't know how to do that in RedHat)

cbtshare 12-27-2009 11:39 PM

ooo ok, didnt know that was possible, I get you now jlinkels , sry didn't before.But I cant seem to install smbfs for red hat lol, cant find it thorough google, all the info I found says its being replaced by cifs.anyone knows how to?

cbtshare 12-28-2009 02:06 AM

mount -t cifs //volume_1 /media/smbnas -o port=21,ip=799.79.49.69,username=st90

it ask for pass, but then I get mount error(22): Invalid argument

cbtshare 12-28-2009 05:58 AM

now I try :

mount -t cifs //76.73.48.66/volume_1 /media/smbnas -o port=21,ip=76.73.48.66,username=staiin,password=AAAAAAA


I get this mount error 112 = Host is down , I think I get this because I am trying to access across a different network.Not sure any help please?

jlinkels 12-28-2009 06:08 AM

First leave out the port=21. Port 21 is for FTP and that is not what you are doing here.

How do you mean the NAS is on a different network? Is it not part of your LAN? If not, ou should make sure there is a connection possible on port 445 and 137,138,139. If you are trying to access this over a public network I must discourage opening those ports though as it infers a security risk.

If the NAS is on the other side of a public network I recommend that you find out if the box does run Linux and if SSH and NFS are supported. IN that cae you can open a SSH tunnel and perform NFS connection.

In any way, NFS is to preferred over SMB and/or FTP as user permissions are handled correctly while they are not in SMB.

jlinkels

michaelk 12-28-2009 07:15 AM

The manual does not indicate that the box supports any other protocols other then FTP and CIFS. If this unit is on a different network is it also behind a firewall/router?

cbtshare 12-28-2009 05:31 PM

Quote:

Originally Posted by jlinkels (Post 3806647)
First leave out the port=21. Port 21 is for FTP and that is not what you are doing here.

How do you mean the NAS is on a different network? Is it not part of your LAN? If not, ou should make sure there is a connection possible on port 445 and 137,138,139. If you are trying to access this over a public network I must discourage opening those ports though as it infers a security risk.

If the NAS is on the other side of a public network I recommend that you find out if the box does run Linux and if SSH and NFS are supported. IN that cae you can open a SSH tunnel and perform NFS connection.

In any way, NFS is to preferred over SMB and/or FTP as user permissions are handled correctly while they are not in SMB.

jlinkels


Well the box does support NFS and SMB, it has port 21 open , so I decided to use port 21.Which other port am I to open then if not 21?

The box is in the same NOC , but on a different subnet/network.The box doesnt run SSH though only SMB and NFS.

I dont think its behind a firewall, but can ask the NOC if it is(No firewall system is in place on the NAS)


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