advertisement

Article:
  Automated Backups with Existing Tools
Subject:   Interesting Article
Date:   2004-03-22 11:08:12
From:   duckfoo
But couldn't you save yourself some time and create a sparse disk image? A sparse disk image, if I understand correctly, can dynamically increase in size as needed, and should make your shell script easier.
Full Threads Oldest First

Showing messages 1 through 3 of 3.

  • Interesting Article
    2004-03-24 13:31:04  peterhickman [Reply | View]

    There is a simpler solution that has the image file built up as it goes.

    hdiutil create -srcfolder $SOURCE -fs HFS+ -format UDRW -volname $VOLUMENAME $IMAGENAME

    This does not create a compressed image but avoids the whole 'create a blank image' thing. It makes the script shorter and more portable, however the whole backup process actually takes longer (1 hour 6 minutes versus 52 minutes for my 10 Gb backup).

    For small amounts of data, say 10 to 40 Gb, it doesn't take too long, up to 4 and a half hours. But when the amount of data gets passed 70 Gb it becomes the difference between 6 hours and nearly 8 hours.

    Did I really just say that 40 Gb was a small amount of data?
    • Re: There is a simpler solution
      2005-06-27 11:45:54  LHaim [Reply | View]

      Hello Peter,

      Thanks for posting your script ("origial" & "simpler"). I tried them both, and failed.

      First, "simpler": here's what happened after running the script (writing out to a FW external with 85GB free space; data is 41 GB)
      prompt> backupscript_simpler
      Initializing...
      Creating...
      Copying...
      .......
      Finishing...
      hdiutil: create failed - Bad file descriptor
      prompt>
      -----
      Next "original"

      prompt> backupscript_original
      (script crashed so ran line-by-line from shell)
      prompt> /bin/sh
      sh-2.05b# SOURCE='/'
      sh-2.05b# FILEDEST='/Volumes/MAXTOR_2/Mac_backups'
      sh-2.05b# VOLUMENAME=backup_`date +%Y-%m-%d`
      sh-2.05b# IMAGENAME=$FILEDEST/$VOLUMENAME.dmg
      sh-2.05b# SIZE=`df -m $SOURCE | grep '^/'`
      sh-2.05b# SIZE=`echo $SIZE | cut -d" " -f3`
      sh-2.05b# SIZE=`dc -e "$SIZE $SIZE 20 / + n"`
      sh-2.05b# hdiutil create -quiet -megabytes $SIZE -fs HFS+ -volname $VOLUMENAME $IMAGENAME
      sh-2.05b# DEVICE=`hdiutil attach $IMAGENAME | grep $VOLUMENAME | cut -d" " -f1`
      load_hdi: IOHDIXControllerArrivalCallback: timed out waiting for IOKit to finish matching.
      hdiutil: attach failed - No such file or directory
      sh-2.05b#
      ---
      Result: no backup.

      Any comments, observations, suggestions?

      Thanks!!!
      • Re: There is a simpler solution
        2005-06-28 14:00:14  peterhickman [Reply | View]

        Not seen that one before. You could try setting SOURCE to some smaller directory such as /User/fred/Documents or whatever and running it with that.

        Also try removing the -quiet option from the hdiutil line and see if that tells us anything interesting.

        After the hdiutil create does the IMAGENAME exist? You should be able to mount it even if it is empty.