Some computer FAQ mostly Linux/Mac

Make tar backup
I take no responsibility if instructions below do not work on your Linux box, they do on mine (Xubuntu)


Make tar backup in this case (Copy Mail directory to a USB stick OR a full backup)
Copy Mail directory to a USB stick

JUST mail

tar cvzpf /media/sda1/home-user.tar.gz /home/username/Mail



COMPLETE USER DATA

tar cvzpf /media/sda1/home-user.tar.gz /home/username



c = create a new archive
v = verbosely list files processed
z= filter the archive through gzip
p=preserve-permissions
f=use archive file or device ARCHIVE
--------------------------------------------------------------------------------------------
TO DO A FULL BACKUP

EMPTY trash first!

REPLACE FILENAME.TGZ throughout the next commands with DATE OF
BACKUP, eg 20090408.tgz or whatever name you require.

tar cvpzf /media/backups/filename.tgz --exclude=/proc --exclude=/lost+found --exclude=/filename.tgz --exclude=/mnt --exclude=/sys --exclude=/media  /



This line below VIEWS the compressed file and sends the filenames to
GREP which looks for what I want in this case mysql and including the
data files!

tar -ztvf /Volumes/filename.tgz | grep "var/lib/mysql" | more



--------------------------------------------------------------------------------------------
WARNING!! This will overwrite every single file on your partition with
the ones contained in the backup archive!!!!!!


Restoring the above backup procedure:-

cd /
sudo  tar xvpfz filename.tgz -C /



To complete the restore just recreate the directories that you excluded
in the above backup command using the exclude flags:-

cd /
mkdir proc
mkdir lost+found
mkdir mnt
mkdir media
mkdir sys



If you want to restore just one file:-

tar -zxvpf filename.tgz /etc/fstab


--------------------------------------------------------------------------------------------

Some of the information provided above was cleaned from:-

http://www.linuxhaxor.net/2008/11/20/complete-backup-and-restore-using-tar-command/


Remembering commands and how to use them to do what you want to do ....