stafwag Blog

staf wagemakers blog

Bacula on FreeBSD (Part 3 Storage Setup)

"bacula setup"

I finally got the time to continue with my bacula backup setup. See my previous posts about the start of my bacula setup.

Storage setup

I created a new zfs pool “bigpool” with some old harddisks I probably need to replace them with bigger harddisk in the further.

zfs filesystem

First we create a zfs filesystem for our bacula storage.

1
2
root@rataplan:~ # zfs create bigpool/bacula
root@rataplan:~ # 

delegate to jail

jailed

We want to use the zfs dataset in the bacula jail so we need to delegate the control to the dataset into the bacula jail.

1
2
root@rataplan:~ # zfs set jailed=on bigpool/bacula
root@rataplan:~ # zfs jail stafbacula bigpool/bacula

verify

When we logon to the jail we see that the zfs dateset is available.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
root@rataplan:~ # ezjail-admin console stafbacula
Last login: Wed Dec 27 10:52:27 on pts/2
FreeBSD 11.1-RELEASE-p4 (GENERIC) #0: Tue Nov 14 06:12:40 UTC 2017

Welcome to FreeBSD!

Release Notes, Errata: https://www.FreeBSD.org/releases/
Security Advisories:   https://www.FreeBSD.org/security/
FreeBSD Handbook:      https://www.FreeBSD.org/handbook/
FreeBSD FAQ:           https://www.FreeBSD.org/faq/
Questions List: https://lists.FreeBSD.org/mailman/listinfo/freebsd-questions/
FreeBSD Forums:        https://forums.FreeBSD.org/

Documents installed with the system are in the /usr/local/share/doc/freebsd/
directory, or can be installed later with:  pkg install en-freebsd-doc
For other languages, replace "en" with a language code like de or fr.

Show the version of FreeBSD installed:  freebsd-version ; uname -a
Please include that output and any error messages when posting questions.
Introduction to manual pages:  man man
FreeBSD directory layout:      man hier

Edit /etc/motd to change this login announcement.
You have new mail.
root@stafbacula:~ # zfs list
NAME             USED  AVAIL  REFER  MOUNTPOINT
bigpool         1.14M   433G    23K  /bigpool
bigpool/bacula    23K   433G    23K  /bigpool/bacula
root@stafbacula:~ # 

When we restart the jail we see that the dataset isn’t available anymore in the jail

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
root@stafbacula:~ # logout
root@rataplan:~ # /usr/local/etc/rc.d/ezjail restart stafbacula
Stopping jails: stafbacula.
Starting jails: stafbacula.
/etc/rc.d/jail: WARNING: Per-jail configuration via jail_* variables  is obsolete.  Please consider migrating to /etc/jail.conf.
root@rataplan:~ # ezjail-admin console stafbacula
Last login: Wed Dec 27 10:58:33 on pts/2
FreeBSD 11.1-RELEASE-p4 (GENERIC) #0: Tue Nov 14 06:12:40 UTC 2017

Welcome to FreeBSD!

Release Notes, Errata: https://www.FreeBSD.org/releases/
Security Advisories:   https://www.FreeBSD.org/security/
FreeBSD Handbook:      https://www.FreeBSD.org/handbook/
FreeBSD FAQ:           https://www.FreeBSD.org/faq/
Questions List: https://lists.FreeBSD.org/mailman/listinfo/freebsd-questions/
FreeBSD Forums:        https://forums.FreeBSD.org/

Documents installed with the system are in the /usr/local/share/doc/freebsd/
directory, or can be installed later with:  pkg install en-freebsd-doc
For other languages, replace "en" with a language code like de or fr.

Show the version of FreeBSD installed:  freebsd-version ; uname -a
Please include that output and any error messages when posting questions.
Introduction to manual pages:  man man
FreeBSD directory layout:      man hier

Edit /etc/motd to change this login announcement.
You have new mail.
root@stafbacula:~ # zfs list
no datasets available
root@stafbacula:~ # 

make persistent

enable zfs in the jail

When the jail is booted it need to bring the zfs filesystem online. We need to add zfs_enable=YES to the jail rc.conf

1
root@rataplan:~ # vi /usr/jails/stafbacula/etc/rc.conf
1
2
3
bacula_dir="start"
bacula_dir_enable="yes"
zfs_enable="YES"

update the ezjail configuration

ezjail needs to jail the zfs dataset to the jail when it’s start the jail.

1
root@rataplan:~ # vi /usr/local/etc/ezjail/stafbacula

We need to add the dataset to the jail’s zfs_datasets. By default a jail isn’t allowed to mount the zfs dataset so need to update jail’s parmeters.

1
2
export jail_stafbacula_zfs_datasets="bigpool/bacula"
export jail_stafbacula_parameters="enforce_statfs=0 allow.mount=1 allow.mount.zfs=1 allow.mount.procfs=1 allow.mount.devfs=1"

Restart the jail and verify that the zfs filesystem is available inside the jail

1
2
3
4
5
root@rataplan:~ # ezjail-admin restart stafbacula
Stopping jails: stafbacula.
Starting jails: stafbacula.
/etc/rc.d/jail: WARNING: Per-jail configuration via jail_* variables  is obsolete.  Please consider migrating to /etc/jail.conf.
root@rataplan:~ # 

Verify that dataset is mounted

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
root@rataplan:~ # ezjail-admin console stafbacula
Last login: Wed Dec 27 11:36:04 on pts/2
FreeBSD 11.1-RELEASE-p4 (GENERIC) #0: Tue Nov 14 06:12:40 UTC 2017

Welcome to FreeBSD!

Release Notes, Errata: https://www.FreeBSD.org/releases/
Security Advisories:   https://www.FreeBSD.org/security/
FreeBSD Handbook:      https://www.FreeBSD.org/handbook/
FreeBSD FAQ:           https://www.FreeBSD.org/faq/
Questions List: https://lists.FreeBSD.org/mailman/listinfo/freebsd-questions/
FreeBSD Forums:        https://forums.FreeBSD.org/

Documents installed with the system are in the /usr/local/share/doc/freebsd/
directory, or can be installed later with:  pkg install en-freebsd-doc
For other languages, replace "en" with a language code like de or fr.

Show the version of FreeBSD installed:  freebsd-version ; uname -a
Please include that output and any error messages when posting questions.
Introduction to manual pages:  man man
FreeBSD directory layout:      man hier

Edit /etc/motd to change this login announcement.
You have new mail.
root@stafbacula:~ # zfs list
NAME             USED  AVAIL  REFER  MOUNTPOINT
bigpool         1.14M   433G    23K  /bigpool
bigpool/bacula    23K   433G    23K  /bigpool/bacula
root@stafbacula:~ # df -h /bigpool/bacula
Filesystem                    Size    Used   Avail Capacity  Mounted on
zroot/usr/jails/stafbacula    2.6T    618M    2.6T     0%    /usr/jails/stafbacula
root@stafbacula:~ # 

Links

Comments