Backing Up Windows Network Share Using Bacula

Posted by blogadmin on January 28, 2013

Windows network shares are visible only to the user who have mounted it. To backup this partition, it has to be mounted using bacula user. Following is the procedure

1. Create a client configuration file as below. Our network share is mapped to drive X:

FileSet {
  Name = "Win Set"
  Enable VSS = no
  Include {
    Options {
      signature = MD5
      compression = GZIP2
    }
    File = "X:/"
  }
  Exclude {
   # File = 
  }
}

2. Job definition, Notice the ClientRunBeforeJob. This script will run before starting backup. We are going to add that batch script on windows client latter.

Job {
  Name = "Win"
  Client = win-fd
  JobDefs = "DefaultJob"
  FileSet = "Win Set"
  Write Bootstrap = "/var/spool/bacula/win.bsr"
  ClientRunBeforeJob = "C:/net-use.cmd"
  Enabled = yes
}

3. Save below content in script net-use.cmd. Copy it in C: where bacula client can access it. Change the IP, workgroup to your domainname and username password accordingly.

net use /delete X: 
net use X: \192.168.0.206DATAFOLDER /user:workgroupusername password

4. Run the backup and check the logs. It should show you the status of the commands ran through batch script. My script was failing as one of the user had already mounted this partition to Z:, hence I have changed the drive letter to X:.

28-Jan 11:17 server-dir JobId 1804: Start Backup JobId 1804, Job=win.2013-01-27_20.05.00_16
28-Jan 11:17 server-dir JobId 1804: Using Device "Storage1"
28-Jan 11:17 win-fd JobId 1804: shell command: run ClientRunBeforeJob "C:/net-use.cmd"
28-Jan 11:17 win-fd JobId 1804: ClientRunBeforeJob:
28-Jan 11:17 win-fd JobId 1804: ClientRunBeforeJob: C:WINDOWSsystem32>net use /delete X:
28-Jan 11:17 win-fd JobId 1804: ClientRunBeforeJob: X: was deleted successfully.
28-Jan 11:17 win-fd JobId 1804: ClientRunBeforeJob:
28-Jan 11:17 win-fd JobId 1804: ClientRunBeforeJob:
28-Jan 11:17 win-fd JobId 1804: ClientRunBeforeJob: C:WINDOWSsystem32>net use X: \192.168.0.206DATAFOLDER /user:workgroupusername password
28-Jan 11:17 win-fd JobId 1804: ClientRunBeforeJob: The command completed successfully.
28-Jan 11:17 win-fd JobId 1804: ClientRunBeforeJob

 

 

 

 

 

 

 

Share Button

Filed under System Administration

Tagged , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>