LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices



Reply
 
Search this Thread
Old 06-02-2008, 07:33 PM   #1
powerpleb
LQ Newbie
 
Registered: Apr 2008
Location: Melbourne, Australia
Distribution: Arch, Ubuntu 8.04
Posts: 27

Rep: Reputation: 15
[SOLVED] PDF files not being backed up correctly by rsync. Viewers can't open them.


I have a lot of PDF documents in my ~/Documents folder and I also have rsync scheduled to do a daily backup of that folder (among others).

When I looked at the backed up files I noticed that some of their icons have an 'X' in front of them. I tried to open these files with Evince and was given this error:
Quote:
Unable to open document. Unknown MIME Type.
So I tried ePDFviewer instead and recieved this error:
Quote:
Failed to load document '/path/file.pdf'.
No error.
I tried pdfinfo and received this error:
Quote:
Error: Couldn't open file 'file.pdf'

This only happens with about half of the PDFs that have been backed up. Others work fine.

All of these documents are working fine in my home folder.

It looks to me like rsync isn't writing these files correctly.
Any idea what going on?

Last edited by powerpleb; 06-02-2008 at 09:08 PM.
 
Old 06-02-2008, 07:48 PM   #2
billymayday
Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Can you post the output of

ls -l

of the relevant directory

and also post the rsync command line you are using for backup
 
Old 06-02-2008, 07:58 PM   #3
powerpleb
LQ Newbie
 
Registered: Apr 2008
Location: Melbourne, Australia
Distribution: Arch, Ubuntu 8.04
Posts: 27

Original Poster
Rep: Reputation: 15
Thanks for the fast reply.
Code:
andrew@andrew-desktop:/media/maxtor/andrew/Documents/LIN1NLA$ ls -l
total 15976
-rw------- 1 root root    85955 2008-04-25 11:42 Assignment11.pdf
-rw-r--r-- 1 root root    15328 2008-04-27 13:00 Assignment2.odt
-rw------- 1 root root   106167 2008-04-25 11:42 Consonant_Chart1.pdf
-rw-r--r-- 1 root root    15624 2008-04-25 11:42 diphthongs.gif
-rw-r--r-- 1 root root    45963 2008-04-25 11:42 indiv_authorship.pdf
-rw------- 1 root root    59506 2008-04-25 11:42 IPA_chart_%28C%2920051.pdf
-rw------- 1 root root   490425 2008-04-25 11:42 Ladefoged_2000.pdf
-rw-r--r-- 1 root root 13662560 2008-04-25 11:42 LIN1NLAW1L1.MP3
-rw-r--r-- 1 root root    18461 2008-04-25 11:42 Monophthongs_Cox0.gif
-rw-r--r-- 1 root root   103578 2008-04-25 11:42 Phoneme_lecture_example.pdf
-rw-r--r-- 1 root root    92287 2008-04-25 11:42 Phonemics.pdf
-rw------- 1 root root    86726 2008-04-25 11:42 Readings.pdf
-rw-r--r-- 1 root root    38591 2008-04-25 11:42 Sound_of_the_World.pdf
-rw-r--r-- 1 root root   124507 2008-04-25 11:42 Speech_acquisition.pdf
-rw-r--r-- 1 root root   131868 2008-04-25 11:42 Suprasegmentals0.pdf
-rw-r--r-- 1 root root   341383 2008-04-25 11:42 Tabain_20080.pdf
-rw------- 1 root root   231467 2008-04-25 11:42 Tabain_2008.pdf
-rw------- 1 root root   108906 2008-04-25 11:42 Tutorials_Consonants%26Vowels0.pdf
-rw------- 1 root root   108906 2008-04-25 11:42 Tutorials_Consonants%26Vowels.pdf
-rw-r--r-- 1 root root    95884 2008-04-25 11:42 Tutorials_Suprasegmentals0.pdf
-rw------- 1 root root    53541 2008-04-25 11:42 UnitGuide.pdf
-rw------- 1 root root   107642 2008-04-25 11:42 Vowel_chart0.pdf
-rw------- 1 root root    96612 2008-04-25 11:42 Vowels.pdf
In this folder for example Assignment11.pdf are Constonant_Chart1.pdf don't work. But indiv_authorship.pdf is fine. Looking at it, I can see that all the pdfs that don't work are missing the two r values. What does that mean?

This is the script that performs the backup tasks. I used /etc/anacrontab to schedule it to happen daily.
Code:
#!/bin/sh
# /usr/local/bin/rsync.sh
#
# - This script backs up users Documents folders to the internal drive then backs up the internal drive to the external
# USB drive.
# 
# /home/andrew/Documents (small)
# /home/gemma/Documents (very small)
# /media/sdb5 (very large)
# 
# - must be executed by root as it mounts the external drive
# - other dirs (video, tgz, etc.) must be updated by hand
# 
echo ""
echo "BACKUP SCRIPT: Backs up contents of /dev/sdb5 to Maxtor external hard disk"
echo "-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=++=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-"
echo "[`date`] rsync backup tasks starting" >> /var/log/rsync.log
echo ""
echo "(1) Mounting the external hard disk..."
echo ""
mount -vt ext3 LABEL=maxtor /mnt/maxtor > /dev/null
chkmnt=$?
if [ $chkmnt -eq 0 ] ; then
  echo ""
  echo ""
  echo "(2) Backing up docs..."
  echo ""
  rsync -urt --progress --delete /home/andrew/Documents /media/sdb5/andrew
  rsync -urt --progress --delete /home/gemma/Documents /media/sdb5/gemma
  echo ""
  echo ""
  echo "(3) Backing up other stuff..."
  echo ""
  rsync -urt --progress --delete /media/sdb5/ /mnt/maxtor/
  echo ""
  echo ""
  echo "(4) Unmounting the external hard disk..."
  echo ""
  umount -v /mnt/maxtor
  echo ""
  ret_val=$?
  echo "[`date`] Backup was successful. Exit status $ret_val" >> /var/log/rsync.log
  echo "All done."
  echo ""
else
  echo ""
  echo ""
  echo "External hard disk did not mount or is in use. Exiting..." 
  echo "[`date`] Drive did not mount or was already mounted! Backup aborted with exit status $chkmnt" >> /var/log/rsync.log
fi
According to my log file it has been backing up every day without issue.

Last edited by powerpleb; 06-02-2008 at 08:07 PM.
 
Old 06-02-2008, 08:10 PM   #4
powerpleb
LQ Newbie
 
Registered: Apr 2008
Location: Melbourne, Australia
Distribution: Arch, Ubuntu 8.04
Posts: 27

Original Poster
Rep: Reputation: 15
Now I feel stupid.

I tried
Code:
sudo evince file.pdf
and they all work fine.
Thanks for your help
 
Old 06-02-2008, 08:11 PM   #5
billymayday
Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Yep - you've changed the owner to root and on the file you're having trouble with, only root has read access.

First, in that directory (as root) do

chmod 755 *


You probably want to change owner as well. I don't know what group your files would be, but as your user, type

touch test && ls -l test

to see what your group is (in the listing you gave above, the first "root" is the user and the second is the group"

Then

chown username:groupname *

where username and groupname come from the touch line above (I'd assume andrew:andrew or andrew:users)

Next time you use rsync, add the "a" option, it does a few things, but most importantly it preserves owners and permissions.

Code:
rsync -aurt --progress --delete /home/andrew/Documents /media/sdb5/andrew
 
  


Reply

Tags
backup, error, evince, mime, pdf, permission, rsync


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: PDF Viewers for Linux Compared LXer Syndicated Linux News 0 11-14-2007 03:50 PM
evince doesn't print PDF files correctly polemon Linux - Software 0 11-22-2005 05:16 PM
Best PDF and PostScript viewers R00ts Linux - Software 13 09-03-2004 07:14 AM
Unable to open PDF document !! majalee Linux - Software 5 08-03-2004 01:44 PM
Volume control is unable to run correctly. Unable to open audio device '/dev/mixer'. sevenreams Slackware 1 05-16-2003 08:29 PM


All times are GMT -5. The time now is 07:48 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration