xorrisofs: ExIncBackup
6.5 Incremental backup of a few directory trees
===============================================
This changes the directory trees /open_source_project and /personal_mail
in the ISO image so that they become exact copies of their disk
counterparts. ISO file objects get created, deleted or get their
attributes adjusted accordingly.
ACL, xattr, hard links and MD5 checksums will be recorded. It is
expected that inode numbers in the disk filesystem are persistent over
cycles of mounting and booting. Files with names matching *.o or *.swp
get excluded explicitly.
To be used several times on the same medium, whenever an update of
the two disk trees to the medium is desired. Begin with a blank medium
and update it until he run fails gracefully due to lack of remaining
space on the old one.
Do not let xorriso -as cdrecord load the medium, but rather do this
manually or by a program that reads from /dev/sr0.
$ dd if=/dev/sr0 count=1 >/dev/null 2>&1
$ msinfo=$(xorriso -as cdrecord dev=/dev/sr0 -msinfo)
$ load_opts=
$ test -n "$msinfo" && load_opts="-M /dev/sr0 -C $msinfo"
$ xorrisofs $load_opts -o - --for_backup -m '*.o' -m '*.swp' \
-V PROJ_MAIL_"$(date '+%Y_%m_%d_%H%M%S')" -graft-points \
-old-root / \
/projects=/home/thomas/projects \
/personal_mail=/home/thomas/personal_mail \
| xorriso -as cdrecord dev=/dev/sr0 -v -multi -waiti -eject -
This makes sense if the full backup leaves substantial remaining
capacity on media and if the expected changes are much smaller than the
full backup.
*Better do not use your youngest backup for -old-root*. Have at
least two media which you use alternatingly. So only older backups get
endangered by the new write operation, while the newest backup is stored
safely on a different medium.
Always have a blank medium ready to perform a full backup in case the
update attempt fails due to insufficient remaining capacity. This
failure will not spoil the old medium, of course.
If inode numbers on disk are not persistent, then use option
--old-root-no-ino . In this case an update run will compare recorded
MD5 sums against the current file content on hard disk.
With *mount* option *-o "sbsector="* on GNU/Linux or *-s* on FreeBSD
or NetBSD it is possible to access the session trees which represent the
older backup versions. With CD media, GNU/Linux mount accepts session
numbers directly by its option "session=".
Multi-session media and most overwriteable media written by xorriso can
tell the sbsectors of their sessions by xorriso option -toc:
$ xorriso -dev /dev/sr0 -toc
xorriso can print the matching mount command for a session number:
$ xorriso -mount_cmd /dev/sr0 session 12 /mnt
or for a volume id that matches a search expression:
$ xorriso -mount_cmd /dev/sr0 volid '*2008_12_05*' /mnt
Both yield on standard output something like:
mount -t iso9660 -o nodev,noexec,nosuid,ro,sbsector=1460256 '/dev/sr0'
'/mnt'
The superuser may let xorriso execute the mount command directly:
# osirrox -mount /dev/sr0 "volid" '*2008_12_05*' /mnt