BackupPC-users

Re: [BackupPC-users] Deleting certain files not working

2012-05-23 18:30:18
Subject: Re: [BackupPC-users] Deleting certain files not working
From: "Jeffrey J. Kosowsky" <backuppc AT kosowsky DOT org>
To: "General list for user discussion, questions and support" <backuppc-users AT lists.sourceforge DOT net>
Date: Wed, 23 May 2012 18:28:48 -0400
See below for comments...
RYAN M. vAN GINNEKEN wrote at about 15:45:40 -0600 on Wednesday, May 23, 2012:
 > I'm bumping this thread again as it seems deleting must be
 possible???? but i keep getting this error for these file 

Well, I am the author of that script
 > 
 > $ /etc/backuppc/BackupPC_deleteFile.pl -h mx1.computerking.ca -r -n - -d 4 
 > f%2fusr%2flocal%2fbackups%2fzimbra 
 > Error: Can't delete root share directory: f%2fusr%2flocal%2fbackups%2fzimbra

As the error message states, the program disallows removing any (root)
share directory and as the comment in the code states that is done
because frankly it seemed a bit dangerous to allow and I assumed that
removing an entire share was a rare case.

The idea being that 'shares' are in general rarely changed and are
part of the basic, typically static config file. My assumption was
that the typical use case is when a user wants to delete a specific
file/folder that was inadvertently backed up rather than going back
and deleting an entire share that had been intentionally and
permanently included for backup.

That being said, I think the program would still probably work if the
above error message (and perl 'die') were deleted but I haven't tested
it to make sure there are no gotcha edge cases.


 > backuppc@venus:~/pc$ /etc/backuppc/BackupPC_deleteFile.pl -h 
 > mx1.computerking.ca -r -n - -d 4 
 > f%2fusr%2flocal%2fbackups%2fzimbra/fsessions 
 > [mx1.computerking.ca][][0 1][] 
 > ANTE[mx1.computerking.ca]: 
 > BAKS[mx1.computerking.ca]: 0 1 
 > POST[mx1.computerking.ca]: 
 > [mx1.computerking.ca][0] f%2fusr%2flocal%2fbackups%2fzimbra/fsessions: 
 > Directory contains hard link: 
 > /ffull-20120421.070005.402/faccounts/f9de/f086/f9de08691-ab2f-406e-a105-56c35c702928/fldap_latest.xml
 >  ... ABORTING... 

Files that are hard links or folders that contain hard links cannot be
safely deleted if there are other hard links to the file outside the
directory being deleted due to the way that BackupPC represents hard
links in the pc tree. In particular, in order to delete a hard link,
you would need to in a sense find all the other files representing
that same hard link due to the way that hard links are captured in the
pc tree. This would require searching through all the attrib files in
the backup itself and in preceding backups in the hierarchy which
could truly take a *long* time...

So this is not a bug so much of as a limitation based on how BackupPC
represents hard-links.

If you had read the usage instructions (-u), you would see that there
are 3 options:
   -H <action>   Treatment of hard links contained in deletion tree:
                    0|abort  abort with error=2 if hard links in tree [default]
                    1|skip   Skip hard links or directories containing them
                    2|force  delete anyway (BE WARNED: this may affect backup
                             integrity if hard linked to files outside
                                                         tree)

Just as an editorial comment, it boggles my mind that anyone would use
a low level program like this that destructively removes files from a
backup tree without having CAREFULLY read the 'usage'
documentation. Programs like this are powerful and if used wrong can
obediently remove entire directory trees from all your backups. In
fact, it is for reasons like this that I purposely chose to disallow
removing shares so that someone wouldn't inadvertently do so. More
generally, why would you not want to take the time to understand what
this program does?

 > See below if you think you might be able to help with my other deleting of 
 > file problems 
 > 
 > 
 > ----- Original Message -----
 > 
 > From: "RYAN M. vAN GINNEKEN" <ryan AT computerking DOT ca> 
 > To: "General list for user discussion, questions and support" 
 > <backuppc-users AT lists.sourceforge DOT net> 
 > Sent: Saturday, 21 April, 2012 1:44:16 PM 
 > Subject: Re: [BackupPC-users] Deleting certain files not working 
 > 
 > 
 > Hello anyoneon this list got tthis script working 
 > 
 > ----- Original Message -----
 > 
 > From: "RYAN M. vAN GINNEKEN" <ryan AT computerking DOT ca> 
 > To: backuppc-users AT lists.sourceforge DOT net 
 > Sent: Thursday, 19 April, 2012 4:37:33 PM 
 > Subject: [BackupPC-users] Deleting certain files not working 
 > 
 > 
 > Hello all i am having some problems deleting files from my backups using the 
 > instructions found here 
 > http://sourceforge.net/apps/mediawiki/backuppc/index.php?title=BackupPC_DeleteFile
 >  
 > 
 > I have gotten the script installed and working for some dirctories like this 
 > one 
 > 
 > backuppc@venus:~$ /var/lib/backuppc/BackupPC_deleteFile.pl -h 
 > t420s-1.solar.lan -r -n - -d 4 /f%2fcygdrive%2fc/fIntel 
 > [t420s-1.solar.lan][][8 11 12 13 14 15 16][] 
 > ANTE[t420s-1.solar.lan]: 
 > BAKS[t420s-1.solar.lan]: 8 11 12 13 14 15 16 
 > POST[t420s-1.solar.lan]: 
 > LOOKING AT: [t420s-1.solar.lan] [][8 11 12 13 14 15 16][] 
 > f%2fcygdrive%2fc/fIntel 
 > BAKS[8](0) t420s-1.solar.lan/8/f%2fcygdrive%2fc/fIntel [X][-][-] 
 > BAKS[11](1) t420s-1.solar.lan/11/f%2fcygdrive%2fc/fIntel [X][-][-] 
 > BAKS[12](1) t420s-1.solar.lan/12/f%2fcygdrive%2fc/fIntel [X][-][-] 
 > BAKS[13](1) t420s-1.solar.lan/13/f%2fcygdrive%2fc/fIntel [X][-][-] 
 > BAKS[14](1) t420s-1.solar.lan/14/f%2fcygdrive%2fc/fIntel [X][-][-] 
 > BAKS[15](3) t420s-1.solar.lan/15/f%2fcygdrive%2fc/fIntel [X][-][-] 
 > BAKS[16](3) t420s-1.solar.lan/16/f%2fcygdrive%2fc/fIntel [D][5][C] 
 > [16] Adding to delete list: t420s-1.solar.lan/16/f%2fcygdrive%2fc/fIntel 
 > [16] Clear attrib file entry: t420s-1.solar.lan/16/f%2fcygdrive%2fc/fIntel 
 > 
 > **BACKUP: [t420s-1.solar.lan][8](0) 
 > **BACKUP: [t420s-1.solar.lan][11](1) 
 > **BACKUP: [t420s-1.solar.lan][12](1) 
 > **BACKUP: [t420s-1.solar.lan][13](1) 
 > **BACKUP: [t420s-1.solar.lan][14](1) 
 > **BACKUP: [t420s-1.solar.lan][15](3) 
 > **BACKUP: [t420s-1.solar.lan][16](3) 
 > [t420s-1.solar.lan][16]f%2fcygdrive%2fc/fIntel [D14][C] 
 > t420s-1.solar.lan/16/f%2fcygdrive%2fc/fIntel/fLogs/fIntelChipset.log 
 > t420s-1.solar.lan/16/f%2fcygdrive%2fc/fIntel/fLogs/attrib 
 > t420s-1.solar.lan/16/f%2fcygdrive%2fc/fIntel/fLogs/fIntelControlCenter.log 
 > t420s-1.solar.lan/16/f%2fcygdrive%2fc/fIntel/fLogs/fIntelAMT.log 
 > t420s-1.solar.lan/16/f%2fcygdrive%2fc/fIntel/fLogs/fIntelGFX.log 
 > t420s-1.solar.lan/16/f%2fcygdrive%2fc/fIntel/fLogs/fIntelGFXCoin.bak 
 > rmdir fLogs 
 > t420s-1.solar.lan/16/f%2fcygdrive%2fc/fIntel/attrib 
 > t420s-1.solar.lan/16/f%2fcygdrive%2fc/fIntel/fExtremeGraphics/attrib 
 > rmdir fResource 
 > t420s-1.solar.lan/16/f%2fcygdrive%2fc/fIntel/fExtremeGraphics/fCUI/attrib 
 > rmdir fCUI 
 > rmdir fExtremeGraphics 
 > [t420s-1.solar.lan][16]f%2fcygdrive%2fc/attrib [-][W] 
 > 
 > Files/directories deleted: 1(14) Files/directories copied: 0 
 > Delete attrib set: 0 Attributes cleared: 1 
 > Empty attrib files deleted: 0 Errors: 0 
 > 
 > However i have not had any luck with some other dirctories like below not 
 > sure what i am doing wrong please help. 
 > 
 > 1. This one has hard links not sure what do do here maybe the -H option as i 
 > do not thing i need the metadatstore either 
 > 
 > $/var/lib/backuppc/BackupPC_deleteFile.pl -h t420s-1.solar.lan -r -n - -d 4 
 > /f%2fcygdrive%2fc/fProgramData 
 > [t420s-1.solar.lan][][8 11 12 13 14 15 16][] 
 > ANTE[t420s-1.solar.lan]: 
 > BAKS[t420s-1.solar.lan]: 8 11 12 13 14 15 16 
 > POST[t420s-1.solar.lan]: 
 > [t420s-1.solar.lan][16] f%2fcygdrive%2fc/fProgramData: Directory contains 
 > hard link: 
 > /fMicrosoft/fWindows/fDeviceMetadataStore/fen-US/f63921eef-8415-4368-9201-f0df4af5778f.devicemetadata-ms
 >  ... ABORTING... 
 

This case was explained as above and as in the error
message... directories containing hard links can't be deleted by
default. See the -H option in the usage message to override...

 > 2. This one will not detect or be removed, the $RECYCLE.BIN folder which i 
 > know exists by listing it here 
 > 
 > ls -l /var/lib/backuppc/pc/t420s-1.solar.lan/16/f%2fcygdrive%2fc/ 
 > total 460 
 > -rw-r--r-- 2 backuppc backuppc 281 Apr 19 16:12 attrib 
 > drwxr-x--- 5 backuppc backuppc 4096 Apr 19 13:43 f$RECYCLE.BIN 
 > drwxr-x--- 3 backuppc backuppc 4096 Apr 19 13:44 fNVIDIA 
 > ...snip... 
 > 
 > backuppc@venus:~$ /var/lib/backuppc/BackupPC_deleteFile.pl -h 
 > t420s-1.solar.lan -r -n - -d 4 /f%2fcygdrive%2fc/f$RECYLCE.BIN 
 > [t420s-1.solar.lan][][8 11 12 13 14 15 16][] 
 > ANTE[t420s-1.solar.lan]: 
 > BAKS[t420s-1.solar.lan]: 8 11 12 13 14 15 16 
 > POST[t420s-1.solar.lan]: 
 > LOOKING AT: [t420s-1.solar.lan] [][8 11 12 13 14 15 16][] **NO DELETIONS ON 
 > THIS HOST** 
 > 
 > 
 > Files/directories deleted: 0(0) Files/directories copied: 0 
 > Delete attrib set: 0 Attributes cleared: 0 
 > Empty attrib files deleted: 0 Errors: 0 

This is due to a bone-headed mis-use of your *nix shell. Since you
didn't put /f%2fcygdrive%2fc/f$RECYLCE.BIN in single quotes, your
typical *nix shell will see $RECYCLE as a shell variable, presumably
set to '' (blank string), so *nix passes the following string to the
BackupPC_deleteFile routine:
                f%2fcygdrive%2fc/f.BIN
Presumably, that file doesn't exist, hence your problem...
Instead, try:
                 'f%2fcygdrive%2fc/f$RECYLCE.BIN'


Was there a ".3"?

 > 4. Lastly not sure how to get the right syntax if the folder contains 
 > brackets 
 > 
 > backuppc@venus:~$ /var/lib/backuppc/BackupPC_deleteFile.pl -h 
 > t420s-1.solar.lan -r -n - -d 4 /f%2fcygdrive%2fc/f$Program Files (x86) 
 > bash: syntax error near unexpected token `(' 
 > backuppc@venus:~$ /var/lib/backuppc/BackupPC_deleteFile.pl -h 
 > t420s-1.solar.lan -r -n - -d 4 /f%2fcygdrive%2fc/f$ProgramData 
 > [t420s-1.solar.lan][][8 11 12 13 14 15 16][] 
 > ANTE[t420s-1.solar.lan]: 
 > BAKS[t420s-1.solar.lan]: 8 11 12 13 14 15 16 
 > POST[t420s-1.solar.lan]: 
 > LOOKING AT: [t420s-1.solar.lan] [][8 11 12 13 14 15 16][] **NO DELETIONS ON 
 > THIS HOST** 
 > 
 > 
 > Files/directories deleted: 0(0) Files/directories copied: 0 
 > Delete attrib set: 0 Attributes cleared: 0 
 > Empty attrib files deleted: 0 Errors: 0 
 > backuppc@venus:~$ 
 > 
 
Again, this is a question really about *nix shell and has nothing to
do with my routine. In addition to the variable interpolation problem
here with "$ProgramData" you also have the issue of white space and
the parentheses. Again, use single quotes:
 '/f%2fcygdrive%2fc/f$Program Files (x86)'

Again, editorially, I would suggest that if you don't understand such
minimal basics of the *nix shell, you should be very careful about
using programs such as mine that have the potential to erase your
precious backup data.

At a minimum *always* run with the '-t' (trial run) flag first... in
fact, I always do that and I am the guy who wrote the program and
should presumably know it best...

BTW, I'm sorry I didn't reply to the original email -- I must have
missed it somehow.

But seriously, you really need to spend some time understanding the
basics of the *nix shell -- not only will it protect you but it will
help you doing the very basic things you need to do to run any program
from the command line...

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
BackupPC-users mailing list
BackupPC-users AT lists.sourceforge DOT net
List:    https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki:    http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/

<Prev in Thread] Current Thread [Next in Thread>