cancel
Showing results for 
Search instead for 
Did you mean: 

Backing up ZFS filesytems on FreeBSD with ALL_LOCAL_DRIVES

Dan_Nelson
Level 3

FreeBSD 8.0 included production support for ZFS, and even though Netbackup 7 has support for up to FreeBSD 8.1, the client itself is still a FreeBSD 6.0 binary and doesn't know anything about ZFS.  The list of filesystems included by the ALL_LOCAL_DRIVES selection is hardcoded and can't be changed, but it is possible to fool bpbkar into thinking that zfs filesystems are ufs and backing them up. 

Attached is the source to the solution I came up with.  bpbkar and friends use the getfsstat() libc function to get a list of mounted filesystems, and will ignore unknown filesystem types based on the info that is returned.  Using the LD_PRELOAD linker option, it's possible to intercept calls to getfsstat() and substitute "ufs" for "zfs".  Netbackup will then back the filesystems up as if they were UFS.  Since it just uses a modified tar to back up Unix systems, Netbackup doesn't really care what the underlying filesystem type is as long as it can walk the directory tree and read all the files.

To use, save the attached file, rename it to "fakegetfsstat.c" because the forum interface won't let me attach files ending in .c, and execute it by running "sh fakegetfsstat.c".  If your FreeBSD system is 64-bit, you will need find a 32-bit system to compile it on, since the Netbackup client is 32-bit.  It will build a shared object called "fakegetfsstat.so".  Copy that file into /usr/local/lib/ , edit /usr/local/etc/rc.d/S77netbackup.sh , and add one of the following lines at the top:

(if you are on a 64-bit system)

export LD_32_PRELOAD=/usr/local/lib/fakegetfsstat.so 

(if you are on a 32-bit system)

export LD_PRELOAD=/usr/local/lib/fakegetfsstat.so

That will insert the wrapper shared object into every Netbackup process.  Then run a backup and verify that your ZFS filesystems are getting backed up.

1 ACCEPTED SOLUTION

Accepted Solutions

AbdulRasheed
Level 6
Employee Accredited Certified

Hi Dan,

  Hope you don't mind me putting a warning note about this for the community. 

  bpbkar has intelligence to handle file system specific attributes (those attributes which are not mandated for POSIX compliance) on a file system type basis. For example, ACLs are implemented differently on different types of file systems. For supported file systems, Symantec ensures that file system type specific calls are used for collecting those attributes. 

  In your workaround, you are fooling bpbkar that the file system is ufs when it is not. For those users who make use of file system specific attributes (e.g. ACLs), bpbkar will try to use the methods specific to ufs in this example. The results are unpredictable for such operations. 

  If a user is using the file system just for the normal POSIX complaint storage, there is no problem with this approach. Thank you for sharing! 

Warm regards,

Rasheed

View solution in original post

3 REPLIES 3

AbdulRasheed
Level 6
Employee Accredited Certified

Hi Dan,

  Hope you don't mind me putting a warning note about this for the community. 

  bpbkar has intelligence to handle file system specific attributes (those attributes which are not mandated for POSIX compliance) on a file system type basis. For example, ACLs are implemented differently on different types of file systems. For supported file systems, Symantec ensures that file system type specific calls are used for collecting those attributes. 

  In your workaround, you are fooling bpbkar that the file system is ufs when it is not. For those users who make use of file system specific attributes (e.g. ACLs), bpbkar will try to use the methods specific to ufs in this example. The results are unpredictable for such operations. 

  If a user is using the file system just for the normal POSIX complaint storage, there is no problem with this approach. Thank you for sharing! 

Warm regards,

Rasheed

Dan_Nelson
Level 3

Certainly; when tricking a program into doing what it normally wouldn't do, there are always risks.  In this particular case, though, according to the latest OS support document, Netbackup 7 on FreeBSD cannot back up either ACLs or extended attributes on a UFS filesystem, so there is no loss of documented functionality when backing up a ZFS filesystem :)

http://www.symantec.com/business/support/index?page=content&id=TECH76648

AbdulRasheed
Level 6
Employee Accredited Certified

Good point, Dan.

Warm regards,

Rasheed