0

Linux newbie here. I got a fresh template of Ubuntu 13.04 installed on my VPS and made a full system backup using TAR:

sudo tar -cvpjf backup.tar.bz2 --exclude=/backup.tar.bz2 --exclude=/dev/* --exclude=/proc/* --exclude=/sys/* --exclude=/mnt/* --exclude=/tmp/* --exclude=/lost+found/* --exclude=/media/* /

Now that some things messed up, I would like to restore the archive AND remove 'everything else' that was created/changed later on (like restore point in Win).

Is this actually possible with Linux?

Thank you!

1 Answer 1

0

I suspect what you need to do would work like this.

  • Stop unneeded running services
  • Extract the tar to a temporary location
  • Use rsync with the -delete option and proper excludes tosync from temporary location where you extracted your backup to the root of the filesystem.
  • Reboot, since you will probably have running programs with deleted/replaced files still open.

How can I see which services are running and which are essential?

Since you effectively want to wipe everything out, the only services that are essential are the services you need to remotely access the system, and access any file systems. This probably includes SSH, and maybe other services. To see what is running, just use ps, top, pstree, or other tools like that.

And which exclusions do you consider as 'proper'?

It all depends on what you backed up, and what filesystems you want to over-write.

Obviously there would be no value over-writing any of the temporary filesystems like /tmp, /var/tmp, and so on. Basically that means you exclude anything mounted tmpfs these days.

You also would seriously make your system unhappy if you tried to sync over-write the /proc, or /sys filesystems.

So my definition of 'proper' is all the filesystems you have setup on your host. Since there is so much flexibility, you will need to figure out the right setup for your own system.

Could you give an example on how to use rsync with -delete option?

Not really, it would be something like rsync --dry-run --delete -av /source/ /destination/.

I don't deal with VPSs much and I always have local control, and when I need to restore a system to an earlier state, I always boot off a livecd/pxe, which makes restoring a lot easier. Reverting to an earlier state from within a running system will take more exclusions. I don't know what you need for your system, you are probably best of building a test environment and playing around with it.

1
  • 1
    OK, a bunch of questions (: How can I see which services are running and which are essential? Could you give an example on how to use rsync with -delete option? And which exclusions do you consider as 'proper'? Thanks!
    – nancy23
    Aug 6, 2013 at 1:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .