incomplete back-ups - Setup

This is a discussion on incomplete back-ups - Setup ; dear all i've been creating back-ups of our files every night through cron jobs and my script for this is like this: 0 21 * * 1 sudo cp -r /home /db/home_bu/mon 0 21 * * 2 sudo cp -r ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: incomplete back-ups

  1. incomplete back-ups

    dear all

    i've been creating back-ups of our files every night through cron jobs
    and my script
    for this is like this:

    0 21 * * 1 sudo cp -r /home /db/home_bu/mon
    0 21 * * 2 sudo cp -r /home /db/home_bu/tue
    0 21 * * 3 sudo cp -r /home /db/home_bu/wed
    0 21 * * 4 sudo cp -r /home /db/home_bu/thu
    0 21 * * 5 sudo cp -r /home /db/home_bu/fri
    0 21 * * 6 sudo cp -r /home /db/home_bu/sat
    0 21 * * 0 sudo cp -r /home /db/home_bu/sun

    For several months, the scripts are working fine...however due to some
    hardware failure
    we created a new server only last week on another linux machine which
    we configured same as the old machine.

    The only differrence is that we upgraded from Ubuntu 5.04 (the Hoary
    hedgehog) to 5.10 (Breezy
    Badger)...

    On this i transferred my cron scripts and have done a series of
    testing where i found no
    problem at all..

    But when i checked yesterday, my back-ups whch is located on another
    harddrive and is mounted as /db,
    contains nothing but the administrator and ITdept folders only, and
    the rest, has not been backed-up.
    Thinking that my backup harddisk maybe full that is why its not doing
    its back-ups completely, so i created
    a shell script whch i named homebu_(day).sh, and i put the following
    scripts:

    rm -rf /db/home_bu/mon/
    mkdir /db/home_bu/mon/
    cd /
    sudo cp -r /home /db/home_bu/mon

    ...deleting first the existing back-up and creating a new one..

    ...and added to my crontab like this:
    0 21 * * 1 /home/scripts/homebu_mon.sh
    0 21 * * 2 /home/scripts/homebu_tue.sh
    0 21 * * 3 /home/scripts/homebu_wed.sh
    0 21 * * 4 /home/scripts/homebu_thu.sh
    0 21 * * 5 /home/scripts/homebu_fri.sh
    0 21 * * 6 /home/scripts/homebu_sat.sh
    0 21 * * 0 /home/scripts/homebu_sun.sh


    I tested again and, it works. But again when i checked it this
    morning, the back up file has again the
    administrator and ITdept folders only..i don't understand this..
    when i run the df command, it returns:

    Filesystem 1K-blocks Used
    Available Use% Mounted on
    /dev/mapper/Ubuntu-root 75175056 20823028 50533328
    30% /
    tmpfs 254248 0
    254248 0% /dev/shm
    tmpfs 254248 12588
    241660 5% /lib/modules/2.6.12-9-386/volatile
    /dev/hda1 233335 11596
    209291 6% /boot
    /dev/hdc1 76920416 76920052
    0 100% /db


    my back up drive is 100% used, is this the reason? if it is then i
    guess my approach to
    solving it is not good at all.

    Hope there could be someone who could explain further and help me
    address
    this problem...

    thanks,
    grace


  2. Re: incomplete back-ups

    grace :
    >
    > i've been creating back-ups of our files every night through cron jobs
    > and my script
    > for this is like this:
    >
    > 0 21 * * 1 sudo cp -r /home /db/home_bu/mon
    > 0 21 * * 2 sudo cp -r /home /db/home_bu/tue
    > ...
    >
    > For several months, the scripts are working fine...however due to
    > [snip]
    > The only differrence is that we upgraded from Ubuntu 5.04 (the
    > Hoary hedgehog) to 5.10 (Breezy Badger)...
    >
    > On this i transferred my cron scripts and have done a series of
    > testing where i found no problem at all..
    >
    > But when i checked yesterday, my back-ups whch is located on
    > another harddrive and is mounted as /db, contains nothing but the
    > administrator and ITdept folders only, and the rest, has not been
    > backed-up. Thinking that my backup harddisk maybe full that is why
    > [snip]
    >
    > rm -rf /db/home_bu/mon/
    > mkdir /db/home_bu/mon/
    > cd /
    > sudo cp -r /home /db/home_bu/mon


    All that blew away was the one day. What's in tue, wed, thu, ...? It
    could be they're the ones that're filling (or mostly filling) /db.

    > ..deleting first the existing back-up and creating a new one..
    >
    > ..and added to my crontab like this:
    > 0 21 * * 1 /home/scripts/homebu_mon.sh
    > 0 21 * * 2 /home/scripts/homebu_tue.sh
    > ...


    If this is /etc/crontab, you're missing the field which says who to
    run the script as:

    0 21 * * 1 root /home/scripts/homebu_mon.sh
    ....................^^^^

    > I tested again and, it works. But again when i checked it this
    > morning, the back up file has again the administrator and ITdept


    Possible side-effect. If there's not enough space, it'll fail. As
    well, if cron (or perhaps user "nobody"?) has no rights to look into
    /home dirs which don't belong to it, it'll fail.

    > folders only..i don't understand this.. when i run the df command,
    > it returns:
    >
    > Filesystem 1K-blocks Used Available Use% Mounted on
    > /dev/mapper/Ubuntu-root 75175056 20823028 50533328 30% /
    > [snip]
    > /dev/hdc1 76920416 76920052 0 100% /db
    >
    > my back up drive is 100% used, is this the reason? if it is then i


    Do that again after making space for your backups. Then run your
    backup.

    > guess my approach to solving it is not good at all.


    It's a little simplistic, but simple's good. It's got some kinks to
    work out, is all. You might consider using a real archiver which can
    do compression. That'll save you quite a bit of space. Eg.:

    tar cvf /db/home_bu/20070619_home.tgz /home \
    > /db/home_bu/20070619_home.log


    or (my personal preference):

    find /home -depth -mount -print0 | \
    afio -z -Z bzip2 -v -T 3k \
    -o /db/home_bu/20070619_home.afio \
    -L /db/home_bu/20070619_home.log

    That last one uses bzip2 compression, and doesn't compress anything
    less than 3 Kb (for performance). It's also smart enought to
    recognize file types that are already compressed, so not bother trying
    to compress them again.

    Keep banging your head on that wall. It'll fall over eventually. :-)


    --
    Any technology distinguishable from magic is insufficiently advanced.
    (*) http://www.spots.ab.ca/~keeling Linux Counter #80292
    - - http://www.faqs.org/rfcs/rfc1855.html Please, don't Cc: me.

  3. Re: incomplete back-ups

    grace :
    >
    > i've been creating back-ups of our files every night through cron jobs
    > and my script
    > for this is like this:
    >
    > 0 21 * * 1 sudo cp -r /home /db/home_bu/mon


    Further to my other reply, you might want to use instead:

    cp -rp ...

    so the resultant copies will have the same ownerships, protections,
    and timestamps as the originals. This is very important should you
    ever get into doing incremental backups (another way to minimize the
    size of the resultant backup archive).


    --
    Any technology distinguishable from magic is insufficiently advanced.
    (*) http://www.spots.ab.ca/~keeling Linux Counter #80292
    - - http://www.faqs.org/rfcs/rfc1855.html Please, don't Cc: me.

  4. Re: incomplete back-ups

    s. keeling :
    >
    > It's a little simplistic, but simple's good. It's got some kinks to
    > work out, is all. You might consider using a real archiver which can
    > do compression. That'll save you quite a bit of space. Eg.:
    >
    > tar cvf /db/home_bu/20070619_home.tgz /home \


    Sorry.

    tar czvf ...

    "z" is gzip compression. Drat.



    --
    Any technology distinguishable from magic is insufficiently advanced.
    (*) http://www.spots.ab.ca/~keeling Linux Counter #80292
    - - http://www.faqs.org/rfcs/rfc1855.html Please, don't Cc: me.

+ Reply to Thread