If you want to create a full backup, sudo tar cjvf fullbackup.tar.bz2 /
will create a bzip2 compressed tarball (the j option) of the entire system.
To perform an incremental backup, you must locate all the files that have been changed since the last backup. For simplicity, assume that you do incremental backups on a daily basis. To locate the files, use the find command:
sudo find / -newer name of last backup file ! -a type f print
When run alone, find will generate a list of files systemwide and print it to the screen. The ! -a -type eliminates everything but regular files from the list; otherwise, the entire directory would be sent to tar even if the contents was not all changed.
Pipe the output of our find command to tar as follows:
sudo find / -newer name of last backup file ! type d -print |\ tar czT - backup_file_name_or_device_name
Here, the t - option gets the filenames from a buffer (where the - is the shorthand name for the buffer).
The tar command can back up to a raw device (one with no file system) as well as a formatted partition. For example, sudo tar cvzf /dev/hdd /boot /etc /home backs up those directories to device /dev/hdd (not /dev/hdal, but to the unformatted device itself).
The tar command can also back up over multiple floppy disks:
sudo tar czvMf /dev/fd0 /home will back up the contents of /home and spread the file out over multiple floppies, prompting you with this message:
Prepare volume #2 for '/dev/fd0' and hit return:
Was this article helpful?