[PLUG] A dumb move, so how do I avoid it in the future?

Dale Snell ddsnell at frontier.com
Sun Jan 8 01:44:32 UTC 2012


On Sat, 7 Jan 2012 15:11:50 -0800
website reader <website.reader3 at gmail.com> wrote:

> Okay, I admit that I don't understand symbolic links for files.

A symbolic link is essentially a file that contains the pathname
of another file.  The OS sees the pointer in the link file and
proceeds to act on the target.  The advantage to symbolic links is
that they work between filesystems, which regular hard links
cannot do.  (A hard link is simply a directory entry, so it can't
cross filesystem boundaries.)


> Here's what I did, I backed up all the files on my Ubuntu Lucid linux
> to a backup drive using the commands
> 
> rsync -av /folder /backupfolder  or cp -ruvp /folder /backupfolder
> 
> This seems to work quite well, with the exception of the /dev and
> /proc and /sys folders contents which I guess I don't really care
> about anyways.
> 
> Here's what happened yesterday.
> 
> I erased the files in the /home/me folder on the backup drive, in
> preparation to do a "fresh" clean copy onto the backup.
> 
> Since I had previously backed up all the folders from / (root) I
> decided to get a fresh copy of those folders also to my backup drive,
> so I started erasing the file folders on the backup drive starting
> with the /bin folder.
> 
> Eventually I erased the files in the /lib area on the backup drive.
> Okay, no apparent problems.
> 
> Then I erased the files in the /lib32 area on the backup drive and
> then the /lib64 area, which was a link pointing back to the /lib area.
> 
> Suddenly I lost my /sbin and /bin commands.  The whole system became
> inoperable and I couldn't do anything at all.  I had to do a manual
> reset to reboot, which failed, of course.

This sounds like a typo somewhere.  The ../backupfolder/lib64 link
to ../backupfolder/lib should not have affected your working
system.  I've done that same sort of thing, it's all too easy.


> I had to rebuild the Ubuntu 10.04 Lucid from scratch and restore all
> my files and programs again, which became a 7 hour ordeal.  Needless
> to say, this was a painful experience.

You have my sympathies.  I've had similar experiences.  There's a
reason I do backups every week.  :-)


> Apparently removing the link files on my backup actually removed the
> system files and the link files on the backup, leaving nothing on
> either drive. (which is exactly an anti-backup)

Removing a symbolic link will have no effect on the target of said
link.  Something else went wrong here.


> Should I have booted from a CD disk, to safely scrub the files on the
> backup drive, then copy from the hard drives to the backup?  Both file
> systems would be off line, so it would appear that this might be the
> way to go.

That shouldn't be necessary, if you've got things set up
correctly.  You need to do that sort of thing for disaster
recovery, but not for regular backups.


> Should I be using something different than the "cp -ruvp" and "rsync
> -av" commands to do backups?

Maybe try "cp --archive", to make sure that all the file
ownerships and permissions are saved.  That said, I would
recommend using dedicated backup software, such as Dirvish
(<http://www.dirvish.org/>), to do your backups.  There is a
package for Ubuntu, I believe.

Dirvish runs from the command line, and uses rsync to copy the
files.  The advantage of Dirvish is that it uses hard links to
essentially "fake" a full backup every time it's run.  Rsync
copies only those files that have changed since the prior backup,
and builds hard links to the rest.  This saves time and space --
especially space.  The downside to Dirvish is that it's not the
simplest software to set up.  You have to read the man pages very
thoroughly.  There are articles on Keith L.'s Dirvish website that
are very helpful.  There is also a Dirvish mailing list that can
be quite helpful.  I run Dirvish myself, to make weekly backups of
all two of my systems.  Call me a very satisfied customer.


> Finally, I won't mind if you say that this was not one of my
> brightest moves.

Heh.  I know how you feel, trust me.  I've been there.

Anyway, I hope this helps.

--Dale

--
The Dilettante's Version of the Three Laws of Thermodynamics:
One:  You Can't Win.
Two:  You Can't Even Break Even.
Three:  You Cannot Get Out of the Game.



More information about the PLUG mailing list