[R] [Rd] R CMD build wiped my computer

Marc Schwartz marc_schwartz at me.com
Wed Jul 28 15:04:29 CEST 2010


Jarrod,

Noting your exchange with Martin, Martin brings up a point that certainly I missed, which is that somehow the tilde ('~') character got into the chain of events. As Martin noted, on Linuxen/Unixen (including OSX), the tilde, when used in the context of file name globbing, refers to your home directory. Thus, a command such as:

  ls ~

will list the files in your home directory. Similarly:

  rm ~

will remove the files there as well. If the -rf argument is added, then the deletion becomes recursive through that directory tree, which appears to be the case here.

I am unclear, as Martin appears to be, as to the steps that caused this to happen. That may yet be related in some fashion to Duncan's hypothesis. 

That being said, the use of the tilde character as a suffix to denote that a file is a backup version, is not limited to Fedora or Linux, for that matter. It is quite common for many text editors (eg. Emacs) to use this. As a result, it is also common for many applications to ignore files that have a tilde suffix. 

Based upon your follow up posts to the original thread, it would seem that you do not have any backups. The default ext3 file system that is used on modern Linuxen, by design, makes it a bit more difficult to recover deleted files. This is due to the unlinking of file metadata at the file system data structure level, as opposed to simply marking the file as deleted in the directory structures, as happens on Windows.

There is a utility called ext3undel (http://projects.izzysoft.de/trac/ext3undel), which is a wrapper of sorts to other undelete utilities such as PhotoRec and foremost. I have not used it/them, so cannot speak from personal experience. Thus it would be a good idea to engage in some reviews of the documentation and perhaps other online resources before proceeding. The other consideration is the Catch-22 of not copying anything new to your existing HD, for fear of overwriting the lost files with new data. So you would need to consider an approach of downloading these utilities via another computer and then running them on the computer in question from other media, such as a CD/DVD or USB HD. 

A more expensive option would be to use a professional data recovery service, where you would have to consider the cost of recovery versus your lost time. One option would be Kroll OnTrack UK (http://www.ontrackdatarecovery.co.uk/). I happen to live about a quarter mile from their world HQ here in a suburb of Minneapolis. I have not used them myself, but others that I know have, with good success. Again, this comes at a potentially substantial monetary cost.

The key is that if you have any hope to recover the deleted files, you not copy anything new onto the hard drive in the mean time. Doing so will decrease the possibility of file recovery to near 0.

As Duncan noted, there is great empathy with your situation. We have all gone through this at one time or another. In my case, it was perhaps 20+ years ago, but as a result, I am quite anal retentive about having backups, which I have done for some time on my systems, hourly.

HTH,

Marc Schwartz


On Jul 28, 2010, at 5:55 AM, Jarrod Hadfield wrote:

> Hi Martin,
> 
> I think this is the most likely reason given that the name in the DESCRIPTION file does NOT have a version number. Even so, it is very easy to misname a file and then delete it/change its name (as I've done here) and I hope current versions of R would not cause this problem. Perhaps Fedora should not use ~ as its back up file suffixes?
> 
> Cheers,
> 
> Jarrod
> 
> 
> On 28 Jul 2010, at 11:41, Martin Maechler wrote:
> 
>>>>>>> Jarrod Hadfield <j.hadfield at ed.ac.uk>
>>>>>>>   on Tue, 27 Jul 2010 21:37:09 +0100 writes:
>> 
>>> Hi, I ran R (version 2.9.0) CMD build under root in
>>> Fedora (9). When it tried to remove "junk files" it
>>> removed EVERYTHING in my local account! (See below).
>> 
>>> Can anyone tell me what happened,
>> 
>> the culprit may lay here:
>>>> * removing junk files
>>>> unlink MCMCglmm_2.05/R/   residuals.MCMCglmm.R
>>>> ~
>> 
>> where it seems that someone (you?) have added a newline
>> in the filname, so instead of
>> 'residuals.MCMCglmm.R~'
>> you got
>> 
>> 'residuals.MCMCglmm.R
>> ~'
>> 
>> and the unlink / rm  command interpreted '~' as your home
>> directory.
>> 
>> But I can hardly believe it.
>> This seems explanation seems a bit doubtful to me.. ...
>> 
>>> and even more importantly if I can I restore what was lost.
>> 
>> well, you just get it from the backup. You do daily backups, do
>> you?
>> 
>> Regards,
>> Martin Maechler, ETH Zurich
>>



More information about the R-help mailing list