Backup of files using NFS a faster way


Login or Register to Reply

 
Thread Tools Search this Thread
# 1  
Old 02-27-2016
Backup of files using NFS a faster way

Hi All!

i am trying to copy files from a SCO Openserver 5.0.6 to a NAS Server using NFS. I have a cron job that takes 1.5 hours to run and most of the data is static. I would like to find a faster way. In the event I needed to running manually or avoid an issue with taking down the servers due to thunderstorms. Below is a copy of the shell script.

Any help will be much appreciated.


Code:
# ********************************************************************
# *
# * Script Name : sysbck
# *
# * Description : Performs system backup to a remote NSF share
# *
# *********************************************************************
# *   Copyright 2015-20xx by Trolley Computers
# *********************************************************************
#!/bin/sh
# *********************************************************************
# *	V A R I A B L E S
# *********************************************************************

# *********************************************************************
# *	F U N C T I O N S
# *********************************************************************

# *********************************************************************
# *	E R R O R   H A N D L I N G
# *********************************************************************

# *********************************************************************
# *	M A I N   S C R I P T
# *********************************************************************

    echo ==============================
    date
    echo ==============================
#
# Mount Remote NSF Share
#
    echo ""
    echo "Mount Remote NSF Share"
    echo ""

    /etc/mount /mnt/pmsroot
    sleep 3

    echo ""
    echo ""
    df -v

#
# Remove Specific Directories
#
    echo ""
    echo "Remove Specific Directories"
    echo ""

    cd /mnt/pmsroot

    rm -fr /mnt/pmsroot/bin
    rm -fr /mnt/pmsroot/ecs
    rm -fr /mnt/pmsroot/angrist
    rm -fr /mnt/pmsroot/fercho
    rm -fr /mnt/pmsroot/huppert
    rm -fr /mnt/pmsroot/nena
    rm -fr /mnt/pmsroot/sc60
    rm -fr /mnt/pmsroot/trolley

    echo ""
    lc
#
# Backup Files
#
    echo ""
    echo "Backup Files..."
    echo ""

    cp -Rp /u2/* /mnt/pmsroot/.

    echo ""
    lc
#
# Un-Mount Remote NSF Share
#
    cd
    echo ""
    echo "Un-Mount Remote NSF Share"
    echo ""

    /etc/umount /mnt/pmsroot

    echo ==============================
    date
    echo ==============================

# *********************************************************************
# *	E X I T   S C R I P T
# *********************************************************************


Last edited by Scrutinizer; 02-29-2016 at 02:57 PM.. Reason: NSF-> NFS
# 2  
Old 02-28-2016
Well the only way to speed up the process is not to copy entire hierarchy every time a script is ran.

Have you considered using rsync , since the data is static it will only copy changes every time it is ran ?
Using rsync the script will probably be couple of lines long.

How big is the directory (size and number of files) and how much bandwidth do you have ?

Perhaps you could also speed up the process with various mount options for NFS or setting atime off for the source mountpoint, but one can only guess.

Other approach is to have a checksum table of all files (source and destination) in perhaps sqlite3 database or a plain text file which you will ran you script against so it only copies the changes.
This will require a bit more effort tho unlike couple of rsync lines Smilie

Hope that helps
Regards
Peasant.
# 4  
Old 02-28-2016
Also, the script posted in post #1 appears to be using a single NAS backup volume (defined in /etc/fstab). IMO an approach like this should only be used if there are multiple backup NAS volumes, either taken from the host itself or from the NAS volume.

Otherwise this would not be a secure way of doing it, since it first wipes the old backup before making a new one, so if anything happens during that backup you end up with nothing..
# 5  
Old 02-28-2016
I did not find rsync on the Skunkware website for OSR5. I did download, compile and install version 3.1.2 from the website for Rsync. I am going to need to learn how to use it.

I did notice on my NAS device, there is a service called rsync.

Yes, I need to have a better backup, where I am not messing with previous days backup. I was trying to get something quick and dirty done. I now need to work on something more secure and beneficial to me.

Thanks for all the suggestions and comments.
# 6  
Old 02-28-2016
Just a minor observation. This:
Quote:
Originally Posted by trolley
Code:
# ********************************************************************
# *
# * Script Name : sysbck
# *
# * Description : Performs system backup to a remote NSF share
# *
# *********************************************************************
# *   Copyright 2015-20xx by Trolley Computers
# *********************************************************************
#!/bin/sh

won't work because "#! /some/shell" is only supported in the first line, nowhere else.

I hope this helps.

bakunin
# 7  
Old 02-29-2016
I started playing around with rsync and it has promise. Much faster than the way I am doing it. I post the final shell script when done.
Login or Register to Reply

|
Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
Need help for faster file read and grep in big files reldb UNIX for Advanced & Expert Users 3 06-09-2018 05:45 AM
How to backup a directory (sub-directories/files) files from one server on to other ? System Admin 77 AIX 5 09-11-2015 04:25 PM
GTAR - new ways to faster backup - help required Bharath_79 AIX 8 06-10-2014 10:32 AM
GTAR - new ways for faster backup - help required Bharath_79 AIX 2 05-22-2014 03:17 AM
Faster command to remove headers for files in a directory alexcol Shell Programming and Scripting 5 11-13-2012 09:17 PM
Faster Line by Line String/Date Comparison of 2 Files agentgrecko Shell Programming and Scripting 4 07-10-2012 04:43 AM
rsync backup mode(--backup) Are there any options to remove backup folders on successful deployment? MVEERA Shell Programming and Scripting 0 11-23-2011 12:27 PM
Running rename command on large files and make it faster shoaibjameel123 Shell Programming and Scripting 6 08-23-2011 03:55 PM
NFS files after reboot thecobra151 AIX 1 07-11-2011 08:16 AM
NFS mounted files Harleyrci Solaris 12 10-08-2010 03:25 PM
NFS Files system and df command dashok.83 UNIX for Advanced & Expert Users 1 04-25-2010 02:07 AM
remove .nfs and .swp files northwest Shell Programming and Scripting 1 09-25-2009 12:29 AM
backup to NFS mount Redhat-Solaris Stin UNIX for Dummies Questions & Answers 9 05-15-2008 06:17 AM
Faster Concatenation of files tkbharani UNIX for Advanced & Expert Users 1 06-26-2007 11:45 AM
Backup system to NFS Appliance device sirhisss UNIX for Dummies Questions & Answers 10 09-03-2003 12:24 PM