2

I have been using rsnapshot to backup a computer's / for approximately a year. The destination drive has filled up unexpectedly quickly within the last week or so, and the rsync command has failed, leading to lots of _delete.22400 folders created in its root.

Owing to the somewhat unusual configuration of the machine, it transpires that several of these folders contain symlinks to places on / that I care very, very much about. If I call rm -r /path/to/rsnapshot_directory, can I be absolutely certain that I won't accidentally nuke the original file on the machine?

Here's an example of what I'm talking about:

$ ls -l /media/disk-1/_delete.27061/localhost/vnmr
lrwxrwxrwx <snip> /media/disk-1/_delete.27061/localhost/vnmr -> /home/vnmrj_4.0_A
$ ls /media/disk-1/_delete.* | wc -w
16

I'm afraid that /bin/rm -r /media/disk-1/_delete* would delete the target of these links, and not the links themselves. Should I be? (I'm tempted to pull the drive and do it on another computer!)

Landak
  • 121
  • 3
  • Run a `find` command to discover those symlinks and remove those and then you can be assured your recursive `rm` can't follow them. Or use `find` to execute `rm` , as find does have options that control if symbolic links are followed. – HBruijn Aug 12 '16 at 09:58
  • 1
    @HBrujin -- isn't this complicated by the fact that rsnapshot creates hard links? What about something like `find ./ -type l -exec unlink {} \; && rm ./`? As long as one link somewhere else on the fs exists, this...shouldn't break anything, should it? – Landak Aug 12 '16 at 15:36

0 Answers0