backup the root volume 

Newsgroups: comp.unix.admin,comp.os.linux.misc
Date: 31 Oct 2001

chris albert wrote:

> > What are the tools to backup/clone the root volume?
>
> 'tar' and 'dump' are classic utilities for this.
> 'amanda' is another open source utility you might consider.
> Take some time to read 'man tar' and you'll see just how powerful
> it is. You might also consider getting a cd-writer.

Tar is NOT a backup tool; it is an archive and distribution tool. Use a backup tool to do backups. Tar sets the atime of the files it reads, therefore you'll never be able to detect unused files. Older versions of tar also do not support stopping at filesystem boundaries.

Dump is the best, but several folks already recommended it. Thus I will suggest the second best, cpio.

> > My other concerns are the files under directories /var, /dev, and
> > /proc, etc. Should they be included in the backup for the OS
> > restore? I know they are not normal files, but I don't know how
> > backup tools like tar/cpio can record those "abnormal".

First, /proc is a separate filesystem so it is not an issue if you run cpio on one filesystem. Second, cpio understands file types other than regular files, it's a backup tool after all. Third, because cpio runs within the filesystem, it can be used to backup any type of filesystem. Chuckle, wanna make a backup of a floppy in FAT16 format or a CD-ROM in HSFS with Rockridge extensions? cpio's your tool.

cd /
find . -xdev -depth -print | cpio -oa | dd of=/dev/tape obs=16k ...

Extract with dd if=/dev/tape obs=16k | cpio -idum, inspect with cpio -itv, etc.

Dump keeps atime, mtime and ctime intact by working with the raw device driectly, that requires intimate knowledge of the filesystem. Thus there must be a different version of dump for each type of filesystem, or support for several must be compiled in.

Cpio works through the filesystem, as does tar, but it knows how to save the inode of a file before opening it, and how to restore the indoe after finishing. That has an advantage: if the mtime changes during backup, cpio knows. There is a bug in this: the ctime gets changed when the inode gets restored. It's a smaller price than tar's use of atime, butit does make cpio incompatible with dump and with commercial backup software. Everything but cpio uses the most recent of mtime and ctime.

backup the root volume 

-xdev  Don't descend directories on other filesystems.
-o, --create
       Run in copy-out mode.
-a, --reset-access-time
       Reset the access times of files after reading them, so that it
       does not look like they have just been read.

backup the root volume 

> Tar is NOT a backup tool; it is an archive and distribution tool.

tar with —preserve-atime exhibits similar behavior to cpio. This is, e.g., how amanda calls tar.

Joshua Baker-LePain

backup the root volume 

In RH62, tar: unrecognized option `—preserve-atime' but has —atime-preserve.

nice tar --one-file-system --atime-preserve -cf /dos/drv_b1/RH62.tgz /