Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
If I use the console command rsync to back up my entire Home directory to an external USB drive, can I do this while I am signed on to Ubuntu in my own user name (the same name as the Home directory I am copying)? The only occasion I did this before (although not with rsync), I had all sorts of problems with files not being copied because they were in use. In the end I did it using a live DVD, but when I went to use the backups recently, had more problems because some files/folders had been changed to Root ownership.
I was just worried in case backing up my Home directory while I am signed into it, will cause some files to be "skipped over" rather than copied.
Or should I run the rsync command as Root, but still signed on as me? Or would that cause more problems?
It seems such a waste to use a backup application when rsync (it would appear) can do the job just as well - if I can get it to work!
Well, just the entire contents of my /home directory. I am aware that all the settings are stored in hidden files, and contain any preferences I've set for my software, so I would like to keep those in the event of a system failure, so when I reinstall the software I'll still have my settings and preferences. Does rsync copy everything in the folder, regardless of it being hidden?
The idea of not being able to copy a file because it is open is a Windows concept.
In Linux, if you have permission, you can copy the file even if it is open. So, using rsync while logged in is not a problem. The issue you might have is that rsync could immediately be out of sync, if you create or delete a file while rsync is running. Even this isn't a huge deal; you'll still get your backup.
The idea of not being able to copy a file because it is open is a Windows concept....
I agree. But consider the following situation:
I am making a backup of my home whilst logged in.
An email arrives. It is filed (and backed up), but the mail program's mail.index file has already been backed up.
So now there will be an application / filesystem inconsistency when the backup is restored.
I am sure you can think of many other "race" conditions.
Maybe there is a "lock" file created, because I am logged in, and a certain application is running and busy. When the backup is restored, obviously I won't be logged in as myself, the application will not be running, and the lock file should not be there: Something will fail.
So what I have is not so much a "backup" (which I'd like to have) as a "snapshot" (which I don't).
When I restore from a backup, I want to be back exactly where I was when the backup was taken. Not with a load of inconsistencies that I have to track down and correct. I require 100% reliability from my backups, and this philosophy has provided it (it's been tested more than once) so far.
Please correct me if I have misunderstood something. Maybe there's an easier way?
As I mentioned in my earlier post, if you create/delete a file when rsync is running, your backup could be immediately out of sync.
If you want a login lock file, create one. Then have your backup script check for the existence of this login lock and behave appropriately. You can put your lock file in /tmp or in /var/run...whatever floats your boat (I would use /tmp). You also could just run the who command to see who is logged in. If your ID shows as logged in to screen 0, don't run the script.
What you are suggesting really doesn't make a lot of sense in that at any time you log in and do anything, your backup will be out of date. The only way around this would be full replication, which frankly, is pretty serious strategy for backing up a few mp3's
If you are seriously worried about interim data loss, set up a cron job (or if it's a workstation perhaps an anacron jog), and rsync your home directory every 5 minutes (I do it every hour). Rsync only copies changes, so the load won't be horrible.
The biggest issue I see with a shutdown/dismount or logout, logon as root type strategy is that you'll find that you simply don't do it that often. Would you prefer to lose an email you got 5 minutes ago or everything form the lat hour/day/week?
You can re-create mail indices and the like (if you can't, change your mail client).
Last edited by billymayday; 08-22-2008 at 06:38 PM.
Well, there's certainly been an exchange of views on this thread since I logged off yesterday. For my purposes, having an "up-to-the-minute" correct backup is less important (I'll only back up once a week maximum), and if my system goes down and I am forced to use the backup, the fact that I would not have lost everything is more important than having lost a few files that I could easily retrieve from the internet again (work files I back up straight away on removable storage anyway).
What is more important to me is not to be thinking stuff is backed up when it hasn't been. For instance, last night I did re-format my backup drive as VFAT, and backed up my home directory again. I used VFAT because before, I formatted it as ext3 and it gave me so much trouble reading the directory listing and accessing the files. I'm not sure why, unless that backup had become corrupted in some way since making it. I did notice, though, that certain file naming conventions are more flexible in ext3 than VFAT, and some files were not copied across unless I renamed them first (a colon in the filename, for instance).
So ultimately I might have to reformat as ext3 and try again.
With regard to Tredegar's comment about Ctrl-Alt-F1, login as root, to get around not copying files already in use: I've never done this "console" approach - is logging in as root in this way just involve typing sudo su, then my own user password, and that will log me in as root? Ubuntu does not have "root" accounts, as you probably know. In fact, I've yet to use a distro that does: Knoppix has a "root shell" that you go into to gain root privileges, instead of the ordinary shell.