Archiving a Linux Moodle Backup to a Windows Server - Another Way PDF Print E-mail
User Rating: / 0
PoorBest 
Written by Ken Task   
Tuesday, 17 May 2011 19:16
AddThis Social Bookmark Button

Takeaway:  How to use mount to archive Linux flavored Moodle tar backups to a Windows Server 2008 share.

One of the more challenging task is to get Linux flavored boxen to talk Windows in a Windows Server centric environment.  The situation: network has a Windows 2008 Server that it uses for archiving/backup purposes. ISD prefers not to have the Linux server join the Windows Domain (which actually makes the Linux Moodle more secure from attacks via the inside).  Windows Server is running backupexec but we're not using any backupexec client on the Linux server.  Archiving a Linux tar ball backup of the Moodle server web root + data directories to a Windows share can be done in multiple ways (smbclient to name a traditional method).  Add one more method … a simple cp command to a Windows Server mount point.

The Servers:

Moodle Server: Ubuntu 9.10 with Moodle 1.9.x

(for CentOS specific please see: http://wiki.centos.org/TipsAndTricks/WindowsShares )

Windows Server: OS=[Windows Server 2008 R2 Enterprise 7601 Service Pack 1] Server=[Windows Server 2008 R2 Enterprise 6.1]

Backups on the Moodle server are created via a tar command which places the resulting tar file in /data/backups/

Command is:

tar -cvf /data/backup/webroot-$(date +%Y%m%d%-H%M%S).tar /var/www/html/ /data/*data [ENTER]

(can be put into a simple executable by root user only 'backup' script located in /usr/local/bin/)

Setup the mount …
On the Linux server:
Create a directory for the mount. In this example:

mkdir /data/backup/winserver [ENTER]


On the Windows server:
create a shared folder called 'backup' and grant user 'backup' with password of 'backup' access rights to read and write.

On the Linux server:
Mount the Windows server share using /data/backup/winserver as the mount point:

smbmount //10.xxx.x.xxx/backup /data/backup/winserver -o username=backup,password=backup [ENTER]


where: 10.xxx.x.xxx is the private IP address of the Windows Server 2008
(can be put into a simple executable by root user only 'mountwinserver' script located in /usr/local/bin/)

To copy desired files to the mounted share:
(this example uses single file name of the most recent backup tar ball, but could use wildcard 'splat' to copy ALL files that end with extension .tar to the mount point and is issued while in the /data/backup/ directory)

Located in /data/backup

cp webroot-20110517180656.tar ./winserver/ [ENTER]


Using the 'splat':

cp *.tar ./winserver


To actually watch the copy take place, issue the following from /data/backup/

watch -d "ls -l ./winserver/webroot-20110517180656.tar"


Screen will show something like the following:

Every 2.0s: ls -l ./winserver/webroot-20110517180656.tar                 Tue May 17 19:11:43 2011

-rwxr-xr-x 1 root root 22169640960 2011-05-17 19:09 ./winserver/webroot-20110517180656.tar

And the size of the file will refresh every 2 seconds.  Increase in the number indicates the copy is working.
Use [CTRL][C] to exit the watch command.
Last Updated on Wednesday, 18 May 2011 06:24
 
 
Total Views: 343