How to backup Linux to FAT32 External Drives

If you use Kubuntu and you want a command line string to easily backup the entire Linux system on an external hard drive (for regular backups as well as offsite backups), without encountering recursive errors, permission problems and other headaches, try using this TAR command from Konsole:

sudo tar –one-file-system -czvf /media/DRIVENAME/BACKUPNAME.tgz /home

Then type in your admin password, and let it do the rest!

—–

What it all means:

  • sudo – gives admin access to override any permissions issues from a standard command line
  • tar – is an old unix-based backup program
  • –one-file-system – avoids recursive problems because if the backup encounters a link to another device during the backup, it won’t follow that link, but will just backup the link itself
  • -c – create
  • z – use gzip to compress the files
  • v – verbosely list all files as they are backed up (so I can see what the heck is happening)
  • f – use a filename as specified rather than the default

NOTE: If your backup is 4 gigs, but you know it should be larger, you may have a FAT32 formatted hard drive. You can remedy that by reformatting the drive to a Linux friendly format, or you can split the backup (and use the appropriate restore command) like this:

sudo tar –one-file-system -czv /home | split -b 4000m – /media/DRIVENAME/BACKUPNAME.tgz

(notice that the “f” is missing in this version. Since the file is splitting, you do not specify the file name — but let the default be used so it will segment in an orderly fashion.)

Re-constitute properly with this customized restore command:

cat /media/DRIVENAME/BACKUPNAME.tgz.* | tar -x /

(Tar doesn’t understand the split files, so they have to be reassembled first. The “cat” command does that. So “cat” takes “backup.*”, joining all those files together into one. The output file from that gets piped into “tar”, which uses that data instead of a disk file as its input, and extracts the backup files.)

I hope this helps to demystify the process of getting a bullet-proof backup of your entire Kubuntu Linux system, so you do regular backups and enjoy quick, seamless restores, should catastrophe strike.

Thanks much to my friend and Linux guru Keith Burton (for the command line help and the info on how to split the backup so I can use my pocket drive for a backup and to transport files to other OS machines) and my father (for helping me to understand the commands, review the manuals and to resolve permissions issues on the external drive).

Leave a Reply

Your email address will not be published. Required fields are marked *