LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-24-2009, 05:10 AM   #1
SimonTHK
Member
 
Registered: Sep 2009
Posts: 30

Rep: Reputation: 15
Backup files in linux (terminal)


Hello

I have just installed Linux Ubuntu and are trying to learn how to use it. Im trying to use the terminal, but its quite difficult.

For now, I have to backup some of my work files continously. How can I do this in Linux? Can I do this just by using the terminal?

Thanks in advance

Last edited by SimonTHK; 10-01-2009 at 02:54 AM.
 
Old 09-24-2009, 05:24 AM   #2
slakmagik
Senior Member
 
Registered: Feb 2003
Distribution: Slackware
Posts: 4,113

Rep: Reputation: Disabled
I'm not sure what you mean by continuously, but perhaps the manual pages for cron and rsync would help? Type 'man rsync' and see about doing something like 'rsync -avz --delete-after /path/to/source/ /path/to/dest/' and, if that works well, you can schedule it as a cron job. Hope that helps.

But, yeah, you can basically do anything from the command line.

And welcome to LQ!
 
Old 09-24-2009, 05:31 AM   #3
SimonTHK
Member
 
Registered: Sep 2009
Posts: 30

Original Poster
Rep: Reputation: 15
Thanks Im happy to be here.

What I meant by continuosly was over and over again at a specific time, maybe each fifth minute.

What I really want to make, is a server on a linux system on another computer. Ishould thenbe able to connect to this server and then backup files on its harddrive. Maybe use Apache II

But for now, Ill try and learn how to do the basic synch. Ill ask as soon as I have more quistions.

Thanks
 
Old 09-24-2009, 05:37 AM   #4
slakmagik
Senior Member
 
Registered: Feb 2003
Distribution: Slackware
Posts: 4,113

Rep: Reputation: Disabled
Okay, a cron line for that might be something like '*/5 * * * * COMMAND_HERE'. (Keep in mind that some crons have restrictive environments, so you may need to give the explicit full path to the command and so on. And rsync is just the thing for you. Good luck!
 
Old 09-24-2009, 05:42 AM   #5
SimonTHK
Member
 
Registered: Sep 2009
Posts: 30

Original Poster
Rep: Reputation: 15
I tried to find manual for rsync, there was no such manual

I have tried and look for a sync tool in package manager,and what I can find is "syrep", which Ill might isntall.

On google I found this guide: http://everythinglinux.org/rsync/
The guide seems very usefull and ill use timeto read and learn later, thought Im very tired now and its hard for me to do much more than "the easy stuff"

This is written in the guide:

Rsync is a wonderful little utility that's amazingly easy to set up on your machines. Rather than have a scripted FTP session, or some other form of file transfer script -- rsync copies only the diffs of files that have actually changed, compressed and through ssh if you want to for security

and that is EXACTLY what I want Ill ask more later
 
Old 09-24-2009, 06:10 AM   #6
lutusp
Member
 
Registered: Sep 2009
Distribution: Fedora
Posts: 835

Rep: Reputation: 102Reputation: 102
Quote:
Originally Posted by SimonTHK View Post
I tried to find manual for rsync, there was no such manual
Code:
$ man rsync
If the above doesn't display the man page for rsync, it's because you haven't installed rsync.
 
Old 09-24-2009, 07:36 PM   #7
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 7.7 (?), Centos 8.1
Posts: 17,860

Rep: Reputation: 2596Reputation: 2596Reputation: 2596Reputation: 2596Reputation: 2596Reputation: 2596Reputation: 2596Reputation: 2596Reputation: 2596Reputation: 2596Reputation: 2596
Incidentally, as you are new to the cli (cmd line), here's some good tutorials/guides;
http://rute.2038bug.com/index.html.gz
http://tldp.org/LDP/Bash-Beginners-G...tml/index.html
 
Old 09-24-2009, 09:08 PM   #8
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,194

Rep: Reputation: 1040Reputation: 1040Reputation: 1040Reputation: 1040Reputation: 1040Reputation: 1040Reputation: 1040Reputation: 1040
Debian does not install rsync by default.
Use:
#apt-get update
#apt-get install rsync
(as root)

rsync is definitely the best candidate for what you want to achieve.

jlinkels
 
Old 09-25-2009, 03:54 AM   #9
SimonTHK
Member
 
Registered: Sep 2009
Posts: 30

Original Poster
Rep: Reputation: 15
thank you very much, fantastic help
 
Old 09-25-2009, 04:34 AM   #10
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 680Reputation: 680Reputation: 680Reputation: 680Reputation: 680Reputation: 680
You might be interested in the "fileschanged" command that comes with the `fam' package.
It requires a running fam service but the information could be useful. Especially given the frequency you are backing up. Why look for new files in directories where there are no new directories. Also, some downloads may take longer than 5 minutes. You probably don't want to back up a very large file that is still being written.

I find using tar with the -g option to be useful for performing incremental backups over ssh. You can pipe the tar output into a tar command on the other side, performing replication. Insert a `tee command' and you can simultaneously provide replication and save a tar backup.

Another option you could try would be to have tar or cpio running in the background, with the list of files to backup/replicate come from the output of fileschanged. This would be an ongoing process rather than a periodic job. This may be what you have in mind for continuous.

tar -C sourcedir -<options> -cf - <(fileschanged arguments) | ssh user@hostname tar -xf -

I haven't used fileschanged before, and or used an ongoing list in the tar filelist. It may need work or not work, or maybe you need to use cpio instead.

Last edited by jschiwal; 09-25-2009 at 04:37 AM.
 
Old 10-01-2009, 02:31 AM   #11
SimonTHK
Member
 
Registered: Sep 2009
Posts: 30

Original Poster
Rep: Reputation: 15
hmm I tried ALOT now, tried to follow alot of the different guides on the net. What I didnt knew was the difference between all the linux systems that exist. Mine is Ubuntu 9.04 and now I am trying to make it work by using --help and the
"man" commands. I am new to Linux and this might be abit too difficult I dont know really.

Anywho I have installed rsync on Ubuntu and now trying to run some of the commands. I tried the "rsync -e" which shouldmakeme able to choose what remote shell I want to use. Though whatever command I write like "rsync -e" "rsync -t" or whatver, it comes upwith "rsync error: syntax or usage error" am I not writing the command correctly?

Also I read that daemon is a server but remote shell is also a server. I dont know what I should prefer and if I should make a daemon server. I cant find any information on how to run the daemon......etc

short sentence: I dont get this at all, I am completely lost and thats even though I have used hours to go through guides and read and stuff. Am I doing something completely wrong?


Let me explain abit where I get lost, this is an example from the "rsync --help" menu:

rsync -t *.c foo:src/

This would transfer all files matching the pattern *.c from the current directory to the directory src on the machine foo. If any of the files
already exist on the remote system then the rsync remote-update protocol is used to update the file by sending only the differences. See the tech
report for details.


What I have got for now is that *.c is the end of filenames I want to copy. foo is my machine and src would be the source where to get the file. But how do I actually write this? Like: rsync -t *.c simonthk: ?????

This command should then transfer my files from current directory (which one is my current?) to the directory src on the machine foo (src directory?)

I must say that I am quite lost, but I will use atleast 2 more hours today on this.
 
Old 10-01-2009, 03:06 AM   #12
SimonTHK
Member
 
Registered: Sep 2009
Posts: 30

Original Poster
Rep: Reputation: 15
ok Im getting abit further now, but how do I write a source? Like a specific folder? its not like windows: c/windows/imlost/systems32

rsync [OPTION...] [USER@]HOST::SRC... [DEST]

this I would have wanted to write like:

rsync --daemon simonthk@192.168.142.85::/aaaaaaaargh

"aaaaaargh being a folder"
 
Old 10-01-2009, 03:11 AM   #13
SimonTHK
Member
 
Registered: Sep 2009
Posts: 30

Original Poster
Rep: Reputation: 15
I also read that I need either daemon server og remote shell on 1 of the computers, the rest can be clients. But how do I start a daemon server?
 
Old 10-01-2009, 03:45 AM   #14
SimonTHK
Member
 
Registered: Sep 2009
Posts: 30

Original Poster
Rep: Reputation: 15
instead of all these quistions, I have decided to read tutorials instead. You can answear my quistions if ya want to, but for now Ill try to learn moreof the basics first.
 
Old 10-01-2009, 04:13 AM   #15
lutusp
Member
 
Registered: Sep 2009
Distribution: Fedora
Posts: 835

Rep: Reputation: 102Reputation: 102
Quote:
Originally Posted by SimonTHK View Post
Thanks Im happy to be here.

What I meant by continuosly was over and over again at a specific time, maybe each fifth minute.

What I really want to make, is a server on a linux system on another computer. Ishould thenbe able to connect to this server and then backup files on its harddrive. Maybe use Apache II

But for now, Ill try and learn how to do the basic synch. Ill ask as soon as I have more quistions.

Thanks
You really, really do not want to do this. really.

If you back up every five minutes, you will be scanning your filesystem almost continuously, you will eventually have overlapping backup jobs (once there are enough files), and you will be backing up opened, incomplete files, files of no possible use, and those incomplete files will replace older, complete files on the backup device. This will create a situation worse than not backing up.

Another risk in this scheme is that you will have a system or network failure or power outage while the backup is going on, and the backup device will become corrupted and unusable. This danger is made worse by the frequency of backups.

If everything goes perfectly and none of the above happens, you will still see system slowdowns because of the burden imposed by constant backing up.

Please -- learn a bit more about computers before considering this scheme. Back up once a day, in the wee hours, only after the system detects an absence of activity.
 
1 members found this post helpful.
  


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
What are all files should be taken backup in a linux server Karthi_India Linux - Newbie 3 04-14-2007 01:59 PM
backup linux files to NT server paraiso Linux - Software 4 06-23-2006 02:11 AM
can I backup linux files??<linuxnewb learnlinux Linux - Newbie 2 08-29-2004 09:51 PM
How To Remote Backup Files From Another Linux Computer? knight2k Linux - Software 2 08-17-2004 03:50 AM
Uncompressing MS-Backup files in Linux Mathieu Linux - Enterprise 0 08-02-2004 03:57 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:25 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