Need help with a tar command
Ubuntu 10.04
As part of my nightly backup script I archive my home directory with the following command Quote:
I had an sftp connection made by Nautilus to my server. Ubuntu for whatever reason places an icon on the desktop showing the connection. When I ran the script it decided to archive everything on my server - all 1.4 TB. I caught the problem when home-ken.gz was about 5 GB. I stopped the process, closed the sftp connection, rolled back the backups and tried again. This time I got a file of the expected size - about 45 MB. In the error log I did find that the tar process was trying to suck the entire contents of the server into the archive file Quote:
TIA, Ken |
See 'man tar', the "--exclude" and "--exclude-from" switches?
|
OK -exclude but what to exclude? The properties for the icon on the desktop are as follows
Quote:
Further confusing me is the fact that if I issue ls -a when my terminal pwd is the Desktop I see nothing as far as the sftp icon. What pattern do I try to exclude??? Ken |
Try something like '--exclude /home/ken/.gvfs/sftp\ for\ ken\ on\ taylor10/'?
|
I use tar like this
say I was backing up my system. Code:
tar -cvpzf /path/to/backup.tgz --exclude=/dev --exclude=/mnt --exclude=/media --exclude=/sys --exclude=/proc --exclude=lost+found / Just to add you may want to do your script like this. Code:
tar -cvpzf /quitelarge/_mirror/mirror1/home-ken.tgz --exclude=/home/ken/.gvfs/sftp\ for\ ken\ on\ taylor10/proc /home/ken |
Quote:
|
Thanks folks! I think I am on the track of a solution. There is nothing on my Desktop related to this issue
Quote:
Quote:
To make the solution generic I believe I want to -exclude /home/ken/.gvfs That should fix the problem regardless of which computer(s) I might be connected to during the backup. I will give it a try. Ken |
Well I though I was on to something :( Here is my test command
Quote:
Quote:
Quote:
Quote:
Ken |
'tar -${args}f /path/to/ball.tar --exclude /path/to/file --exclude /path/to/dir /path/to/tarsource' works for me OK.
|
Perhaps it is because .gvfs is a hidden subdirectory???
Ken |
Code:
try this assuming you have a folder quitelarge in your / direcotry. |
Thanks jmc1987, that worked (without the sudo - I own everything in my home directory tree). I have looked at several man pages for tar. None of them seem to describe any specific order or precedence for options, operators, operands etc. At least this information did not jump out at me.
I have incorporated the syntax you provided in my script. Thanks again, Ken p.s. /quitelarge is /dev/sdb1 - my 750 GB drive and /veryhuge is /dev/sdc1 my 1 TB drive. /, /home, /data and swap are on my 10k RPM Velociraptor 150 GB drive. And despite an i7-860 quad processor and 8 GB of RAM my Atom processor netbook boots Ubuntu 9.04 faster than this pig of a desktop boots 10.04. Oh well. |
Hmm no sudo. I guess you own that folder quitelarge ;)
Glad to see if it works. But the credit belongs mostly to linuxquestions.org. They've help me most with that pesky tar command. just to add you didn't need that part of the command "2>> /quitelarge/tar-error.log". I put it there just it case you wanted your errors logged. Good luck to you. |
I have found the error logging to be helpful. In fact when I first developed the script it showed me a couple of files in my home tree which I did not own. Don't remember what the were but I own them now!
I paid for /quitelarge so I guess I should own it :D The machine is a Dell XPS 8000. It came with the 750 GB drive and Windoze 7 (after a month of waiting and raising H with Dell.) I had the Velociraptor waiting - had purchased it on sale from newegg. I had been looking for an external hard drive docking gizmo (insert the drive and plug the cable into USB.) Around New Years day newegg had the dock and a WD Black Caviar 1 TB drive for something like $79. Normal price of the dock was about $35 - what a deal. So now the machine is full of storage - well actually over full. One of the drives is in a floppy drive bay. The machine is quite powerful. The only real problems I have with it are suspend (which does suspend but often does not wake up correctly - I find I am logged out) and printing some pdf files such as my statement from Citicards. The only way I can print it is to use the "genuine" Acrobat reader in a Win 7 virtual machine running under VMWare. No Linux pdf reader nor Foxit on XP will print the dang thing. Same with some pdfs I created with Xsane using my scanner. Created them in Linux, can view them in Linux but not print. Ken |
All times are GMT -5. The time now is 12:00 AM. |