Pages

Saturday, February 4, 2012

Using a Sun StorEdge D240 as bacula storage

Yesterday I got a Sun StorEdge D240. Completely with cables, SCSI card etc. The D240 has two 36GB harddisks, a DDS4 tape drive and a DVD-ROM. Perfect to use it in my bacula server.
After installing the SCSI card and connecting the D240 I booted my Solaris 10 X86 machine and installed all devices (I'm using the Split Bus configuration). To install the necassery devices run the devfsadm command and use the iostat command to check the devices:

# devfsadm -Cv
...
# iostat -En
...
c4t0d0           Soft Errors: 0 Hard Errors: 0 Transport Errors: 0
Vendor: FUJITSU  Product: MAP3367N SUN36G  Revision: 0401 Serial No: 0408N08UF7
Size: 36.42GB <36420074496 bytes>
Media Error: 0 Device Not Ready: 0 No Device: 0 Recoverable: 0
Illegal Request: 0 Predictive Failure Analysis: 0
c5t0d0           Soft Errors: 0 Hard Errors: 0 Transport Errors: 0
Vendor: FUJITSU  Product: MAP3367N SUN36G  Revision: 0401 Serial No: 0408N08MYW
Size: 36.42GB <36420074496 bytes>
Media Error: 0 Device Not Ready: 0 No Device: 0 Recoverable: 0
Illegal Request: 0 Predictive Failure Analysis: 0
c5t6d0           Soft Errors: 0 Hard Errors: 0 Transport Errors: 0
Vendor: TOSHIBA  Product: DVD-ROM SD-M1711 Revision: 1005 Serial No: 
Size: 0.00GB <0 bytes>
Media Error: 0 Device Not Ready: 0 No Device: 0 Recoverable: 0
Illegal Request: 4 Predictive Failure Analysis: 0
rmt/0            Soft Errors: 2 Hard Errors: 0 Transport Errors: 0
Vendor: HP       Product: C5683A           Revision: C005 Serial No:    9

c4t0d0 and c5t0d0 are the two harddisks, c5t6d0 is the DVD-ROM and rmt/0 is the tape drive. Next you need to prepare the harddisks. Here is how I configered them as a 'bacula ZFS Pool':

# zpool create bpool c4t0d0 c5t0d0
# zpool status
...
        NAME        STATE     READ WRITE CKSUM
        bpool       ONLINE       0     0     0
          c4t0d0    ONLINE       0     0     0
          c5t0d0    ONLINE       0     0     0
...

Next create two filesystems, one for backups and one for restores (if you don't want to use the D240 as a restore area then don't use the third and fourth command):

# zfs create bpool/backup
# zfs set mountpoint=/local/backup bpool/backup
# zfs create bpool/restore
# zfs set mountpoint=/local/restore bpool/restore

Then check the filesystems:

# df -h
...
bpool/backup            66G    21K    65G     1%    /local/backup
bpool/restore           66G    21K    65G     1%    /local/restore

So far that good. Now comes the bacula part, configuring the D240 into bacula. First go into the bacula configuration directory end edit the bacula storage daemon configuration file:

# cd /opt/bacula/latest/etc
# vi bacula-sd.conf
...
Device {
  Name = D240-File
  Media Type = File
  Archive Device = /local/backup
  LabelMedia = yes;
  Random Access = Yes;
  AutomaticMount = yes;
  RemovableMedia = no;
  AlwaysOpen = no;
}

Device {
  Name = D240-Tape
  Media Type = DDS-4
  Archive Device = /dev/rmt/0n
  AutomaticMount = yes;
  AlwaysOpen = yes;
  RemovableMedia = yes;
  RandomAccess = no;
  Maximum File Size = 24GB
}
...

That's it for the storage daemon, don't forget to restart it:

# pkill -15 `pgrep bacula-sd`
# /opt/bacula/latest/sbin/bacula-sd -c /opt/bacula/latest/etc/bacula-sd.conf

Next configure the storage resource inside the bacula director configuration:

# vi common/storage.conf
...
Storage {
  Name = D240-File
  Address = bck01
  SDPort = 9103
  Password = "QLBrhBa8ebxbTjWwy74qIfvPlTFN44dCfmymfmmL41i8"
  Device = D240-File
  Media Type = File
}

Storage {
  Name = D240-Tape
  Address = bck01
  SDPort = 9103
  Password = "QLBrhBa8ebxbTjWwy74qIfvPlTFN44dCfmymfmmL41i8"
  Device = D240-Tape
  Media Type = DDS-4
  Autochanger = no
}
...

If you want then create a pool for the two new storages:

# vi common/pool.conf
...
Pool {
  Name = D240-File
  Pool Type = Backup
  Recycle = yes
  AutoPrune = yes
  Volume Retention = 14 days
  Maximum Volume Bytes = 10G
  Maximum Volumes = 6
}

Pool {
  Name = D240-Tape
  Pool Type = Backup
  Recycle = yes
  AutoPrune = yes
  Volume Retention = 14 days
  Maximum Volume Bytes = 24G
  Maximum Volumes = 10
}
...

Keep in mind that the ZFS pool bpool has only 66GB left, so creating a bacula pool especially for the D240-File storage with a maximum of six volumes and a maximum f 10G is not unwise (or 2 volumes with 30G, one volume with 60G, whatever).
That's it for the bacula director. Finally you have to create a new job that can use the D240 (or reconfigure an old one):

# vi common/jobs.conf
...
Job {
  Name = "dc01_ldap"
  Type = Backup
  Client = bck01-fd
  Schedule = "WeeklyCycle"
  Storage = D240-File
  Pool = D240-File
  Messages = Standard
  Priority = 10
  Level = Full
  FileSet="ldap"
  RunBeforeJob = "/opt/bacula/latest/etc/scripts/make_ldap_backup.sh"
  RunAfterJob  = "/opt/bacula/latest/etc/scripts/delete_ldap_backup.sh"
}

Job {
  Name = "bck01_etc"
  Type = Backup
  Client = bck01-fd
  Schedule = "etc"
  Storage = D240-Tape
  Pool = D240-Tape
  Messages = Standard
  Priority = 10
  Level = Full
  FileSet="etc"
}
...

The two jobs above will backup my LDAP DIT from the server dc01 to file and the /etc configuration directory from the server bck01 to tape. Then reload the new bacula configuration:

# bconsole
Connecting to Director bck01:9101
1000 OK: bck01-dir Version: 5.2.3 (16 December 2011)
Enter a period to cancel a command.
* reload

Before you can run any job you have the label the storages:

* label
...

After labeling has finished run any job to use the D240:

* run
...

No comments:

Post a Comment