Tar backup of debian server

Am reading this doc Full Hard-Drive Backup with Linux Tar
on backup.

why do we need the dot at the end ?

tar -cvpf /backups/fullbackup.tar --directory=/ --exclude=proc
 --exclude=sys --exclude=dev/pts --exclude=backups .

The item at the end says what to back up. The dot refers to the current directory. It could be a full path so somewhere if that suits better, however that will mean that the files can only be restored to the named location. Using a relative path name to where you are (or just a dot) means that you can restore files to the same place relative to where you are when you do the restore.

As an alternate to copying, you could do something like this:-

cd /home/RBATTE1
tar -cvf /backup/my_stuff .

cd /home/SECADM
tar -xvpf /backup/my_stuff

if you just did this:-

tar -cvf /backup/my_stuff /home/RBATTE1

.... then a restore would always write to /home/RBATTE1 which may be undesirable.

It's a bit of a crude description, but I hope you get the idea.

Robin

so a TAR also stores about location metadata ?

The tar output file also stores the file names (and permissions) you give it so it knows how to restore them, just as Winzip and other tools do. If you give it a name starting with /, then that forms the name when you restore.

I do wonder what the purpose of this is. Are you planning to use it for recovering if a disk/server/site is lost? The problem you may have is getting something running so that you can execute the restore and if it's dissimilar hardware it still may not work.

What is the requirement for this backup, i.e. what are you planning to restore to?

Kind regards,
Robin

1 Like

I was asking the question only for my knowledge only..i like to dig deep and investigate.
I usually use tar to backup my Debian Lenny server..but that day I was surprised to see the syntax with the dot..I thought it was a typing error. I tried omitting the dot...it gives an error.

The following is the command I use for backup:

tar -cvpf /BACKUP/backup-PROD.tar / --exclude=/proc --exclude=/lost+found --exclude=/mnt --exclude=/sys --exclude=/dev --exclude=/BACKUP --exclude=/media 

The restore was done on a PC, I boot with a live CD, wipe everything on the /
, then UNTAR everything there.

For the PC to successfully boot:

  1. MBR/GRUB must be properly configured
  2. udev > persistent rules - must remove the MAC addresses
  3. in /boot/grub directory necessary changes needs to be done if you are changing from a raid 1 to a non-raid configuration.

The restore was a good experience for me and worked without any issues

1 Like

Also, since you passed --directory=/ , the dot refers to all subdirs within that directory, except those you excluded.

hth

1 Like

in your reply you mean to say "except those you excluded" .. right ?

I always avoided to use the word "but" to mean an exception..I think others might get confused as well.. that's why I replied on your post :slight_smile:

1 Like

Dear coolatt,

Thanks for the update and the really useful procedure and list of updates that are required (I've split the line up so it shows clearly here) I'm not sure if it is officially supported or what complications you might hit with dissimilar hardware, but if it gives people a starting point to clone with then that's really useful. There are also commercial products available which can do this, but I have no ideas on the costs or your budget.
The two I know of are Adaptable System Recovery and Christie Clone Manager

As for citations, I have used ASR myself. It's good and a DR solution that you can bare-metal recover from (or clone). My company has use CCM elsewhere for transferring in servers from another company. It might need the live server available to clone elsewhere as opposed to the backup/restore that ASR gives you. I am less familiar with it.

I hope that these help, but in any case thanks for your input. :b:

Robin