Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

One-step backup and burn to CD/DVD System
There seems to be a lot of interest in The Backup Problem lately, so I thought I'd give mine away. It's a shell script that contains a list of things to backup, and produces a burned disc in one step. It also includes a NetInfo dump.

Read the rest of the hint for the script...

This must be run as root (I use sudo) and if you run it with -e, it will skip erasing the disc first. Obviously you must change the list of contents to something useful to you.

#!/bin/sh

if [ "$USER" != "root" ]; then
  echo "You must be root to use this program"
  exit 1;
fi

[ "$1"x = "-e"x ] || erase="-erase"

tgt=/tmp/stagebackup
contents=" /Users/ataraxia/Documents \
  /Users/ataraxia/Library \
  /Users/ataraxia/Pictures \
  /Users/ataraxia/.tin \
  /Users/ataraxia/.vimrc \
  /Users/ataraxia/.zshenv \
  /Users/ataraxia/.zshrc \
  /Users/ataraxia/.cvsrc \
  /Users/ataraxia/.newsrc \
  /private/etc \
  /usr/local \
  /var/root \
  /Library/Preferences \
  /Library/StartupItems "

for item in $contents; do
  ditto -v --rsrc $item $tgt$item
done

echo "Dumping NetInfo"
nidump -r / . > $tgt/netinfo.local

echo "Size of backup: `du -sh $tgt | cut -f1`"
set -o errexit
hdiutil makehybrid -o /tmp/bkup $tgt -default-volume-name "Backup `date +%m/%d`"
hdiutil burn $erase /tmp/bkup.iso
echo "Cleaning Up"
rm -rf $tgt /tmp/bkup.iso

echo "Done!"
[robg adds: Have I mentioned lately the importance of backing up your critical files? With the latest threats running around, and (at least in my case) the occasional stupid user error, backups are very important. Find a method you like, stick with it, and (very important) test your backups occasionally!]
    •    
  • Currently 3.25 / 5
  You rated: 4 / 5 (4 votes cast)
 
[16,506 views]  

One-step backup and burn to CD/DVD | 15 comments | Create New Account
Click here to return to the 'One-step backup and burn to CD/DVD' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Backup.app
Authored by: SOX on May 20, '04 12:13:18PM

For simple minded non-differential backups to burnable media like this, apple's own Backup.app is pretty fool proof and easy to use. It has the added advantage of being able to split a large backup across multiple CD/DVDs or abritrary mixtures of these. And of course no backup would complete without a simplified way of restoring which backup has. The problem with this script is that while it stores everything you can easily lose track of where everything has to go back to, test of creation dates, and obliterating subdirectories if you just do a blanket copy.



[ Reply to This | # ]
One-step backup and burn to CD/DVD
Authored by: webgodjj on May 20, '04 12:33:10PM

Sounds good... however, where do you get backup.app? I looked around on my system and don't see it (panther). Is it on apple's site or on the cd?



[ Reply to This | # ]
One-step backup and burn to CD/DVD
Authored by: ezthrust on May 20, '04 01:05:34PM
It is available for download from the .Mac website. But it is only useful if you have a .Mac account or if you have a WebDAV account somewhere.

Or, if you follow these directions.
http://www.drijf.net/dototto/

[ Reply to This | # ]

One-step backup and burn to CD/DVD
Authored by: neuralstatic on May 20, '04 12:43:25PM

that's iTools only i believe. so it will cost you 80$ per year or whatever it is.

not sure if it will go to cd's -- they advertise it as backing up to your iDisk



[ Reply to This | # ]
One-step backup and burn to CD/DVD
Authored by: dafuser on May 20, '04 01:23:07PM

Backup is free with your .Mac account, and it will allow backups to CD or DVD



[ Reply to This | # ]
One-step backup and burn to CD/DVD
Authored by: cclifton on May 20, '04 01:23:09PM

Backup will make backups to iDisk on .mac, to CDs (spanning backups across multiple CDs), and to other harddrives. My only gripe with Backup is that it is incredibly slow at times. I suspect this is because it is accessing .mac to verify membership status.

I use Backup to do daily backups of some important info to my iDisk. I use scripts triggered by cron, like others have posted in the past, to do weekly backups to a second internal harddrive. My daily and weekly backups require no user intervention at all.

Once a month I use Backup to burn CDs of my most recent weekly backups. The CDs go to a safe deposit box at the bank.

---
Curt

[ Reply to This | # ]

One-step backup and burn to CD/DVD
Authored by: stevetech on May 20, '04 01:22:34PM

Actually "Backup" is available to .Mac users only...



[ Reply to This | # ]
One-step backup and burn to CD/DVD
Authored by: qwerty denzel on Nov 28, '04 06:10:53PM

You can get it for free if you sign up for the trial as well but not with all of the features of backing up.



[ Reply to This | # ]
Disk Utility
Authored by: ubrgeek on May 20, '04 07:59:19PM

Why not use Restore, which is a part of Disk Utility? You can "Restore" to an external drive (don't know about a CD/DVD) and it actually becomes bootable.



[ Reply to This | # ]
One-step backup and burn to CD/DVD
Authored by: bluehz on May 21, '04 02:33:53PM

Has anyone been able to get this to burn additional sessions on to a CD/CD-RW? Whenever I try it without the erase option attempting to burn a 2nd session... I always get:

Media is not writable

But I can take it all over to Disk Utility and burn additional sessions quite easily so I know the disk is not closed.



[ Reply to This | # ]
One-step backup and burn to CD/DVD
Authored by: P3Consulting on May 24, '04 04:52:33AM

You could improve a little bit by automatizing saving of any invisibles files in your home directory, making you bullet proof to further installs (.ssh, .gnupg, etc).
This little snippet save every invisible files/folders in your home folder (except .DS_Store and .Trash... - make change to/add grep filters to fit your needs)
[code]
#!/bin/sh

# between [] in below grep command are only <SPACE> and <TAB>
# the two grep -v "^... are there to avoid archiving of $HOME/. and $HOME/..
{
ls $HOME/.* | grep "/Users" | grep -v "Trash" | grep -v "DS_Store" | awk -F: '{ print $1 ; }' | grep -v "^[ ]*$HOME/.[ ]*$" | grep -v "^[ ]*$HOME/..[ ]*$"
} > /tmp/invisibles 2> /dev/null

#use archive tool of yout choice (tar, hfstar, gnutar, ...)
tar -zcf PUT_YOUR_ARCHIVE_FILE_NAME_HERE.tar.gz -T /tmp/invisibles
[/code]



[ Reply to This | # ]
One-step backup and burn to CD/DVD
Authored by: eagle on May 24, '04 01:45:25PM
That could be further simplified:

tar -czf PUT_YOUR_ARCHIVE_FILE_NAME_HERE.tar.gz `ls -d ~/.??* | grep -v Trash | grep -v DS_Store`

But both this one and yours would prepend /Users/username to the file listing, which may be undesirable. If that is not desired, the following might be better:

#!/bin/sh
chdir ~
tar -czf PUT_YOUR_ARCHIVE_FILE_NAME_HERE.tar.gz `ls -d .??* | grep -v Trash | grep -v DS_Store`


[ Reply to This | # ]

preserving resource forks
Authored by: sjk on May 25, '04 07:05:03PM

Not a great solution if you want to preserve resource forks and/or Finder comments. It's pretty likely that at least one file in ~/Library/Preferences has a resource fork and removing it (by restoring from a tar archive) might cause an application to fail or misbehave.



[ Reply to This | # ]
preserving resource forks
Authored by: P3Consulting on May 26, '04 03:23:26AM

to preserve resource forks, you could use hfstar... (available at http://www.metaobject.com/downloads/macos-x/)



[ Reply to This | # ]
preserving resource forks
Authored by: sjk on May 26, '04 10:44:36AM
Or hfspax. I had trouble with it and/or hfstar not handling >2GB archive files but that was a couple years ago and I don't recall the details.

[ Reply to This | # ]