Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to take backup from Linux to Windows?

Backup to windows

How to take backup from Linux to Windows?

by  MaheshRathi  Posted    (Edited  )
Backup from Linux to Windows using SMBmount

Here is the modified file for taking backup from linux to windows using smbmount.

1. Replace NTUsername with network id and NTPassword with network password.
2. Make the folder shared where you want to take the backup. You should give the full access to that network login ID.
3. The owner of this script should be root.
4. Be sure that, smbd and nmbd are running. If not, start them.
5. If normal user wants to run this script, then be sure that the setUID bit is set for /usr/bin/smbmnt.
6. Add proper values for DIRTOARCHIVE, MNTPOINT, and ARCHIVETO.
7. Modify the smbmount command parameters as per your requirement.

######################################################################

#!/bin/sh
#

# Script to backup the /home volume

ADMINID="NTUsername"
ADMINPASSWD="NTPassword"
DAY=`date +%Y%m%d-%H%M`
BACKFILE=<ProjectName>.source.$DAY.tgz
LOGFILE=/tmp/$DAY.backup.log
STARTTIME=`date`
DIRTOARCHIVE=<Directory path to archieve >
MNTPOINT=<Some directory having all permission >/forBackup$DAY
ARCHIVETO=$MNTPOINT/Source/Archive

# First umount and then mount.
###############################
umount $MNTPOINT
mkdir $MNTPOINT

smbmount <//Windows NT server/Folder for backup> $MNTPOINT -o username "$ADMINID/<workgroup>%$ADMINPASSWD"


# Generate the backup file
###############################
cd $ARCHIVETO

if [ `pwd` != "$ARCHIVETO" ]
then
echo "Aborting backup"
umount $MNTPOINT
rmdir $MNTPOINT
exit 2
fi

{
echo "\n\n"
date
echo "Archiving $DIRTOARCHIVE\n"
echo "The backup file is $BACKFILE\n"
echo "Logfile is $LOGFILE

"
tar -cvzf $BACKFILE $DIRTOARCHIVE

echo "End of tar process...."

} >| $LOGFILE


# Unmount
###############################
cd /
umount $MNTPOINT
rmdir $MNTPOINT


Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top