Backup Home Directories in Linux

Posted on in Categories , , , , , , last updated November 12, 2008

Q. I would like to Backup all directories in /home to /dev/st0 tape drive. How do I use script to automate task and what commands do I need to use?

A. Use tar command to backup /home directory. The GNU version of the tar archiving utility included with all Linux distributions. Following tar command also works with Solaris/HP-UX UNIX and FreeBSD/*BSD oses.

For example tar command to backup /home should be as follows:
# tar -czf /dev/st0 /home

Where,

  1. /dev/st0 : Linux SCSI Tape device name
  2. /home : Home directory name

This will also backup hidden files and directories. Since this topic is already covered, please refer scripts and previous posts:

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin and a trainer for the Linux operating system/Unix shell scripting. He has worked with global clients and in various industries, including IT, education, defense and space research, and the nonprofit sector. Follow him on Twitter, Facebook, Google+.

4 comment

Leave a Comment