OneDrive
Bacula Enterprise Microsoft 365 Plugin can protect OneDrive Business units associated to users, groups or sites. It is possible to utilize advanced selection methods to decide exactly what is backed up, as well as control precisely which items to restore and their destinations. The information protected with this service is:
Files
File versions
Items M365 metadata (files and folders)
Shared permissions
Files will keep their names in the catalog and will be included in a path like this:
/@m365/tenant.name/entitykind/ownerentityname/drives/unitname/root:/path/to/file/name-file.extension
(where
entitykind
can be users, sites or groups)
Version History
OneDrive and SharePoint can be configured to retain the history for files/items.
Onedrive hash check
Onedrive service stores a hash for every file hosted, using Microsoft algorithm QuickXOR. Bacula Enterprise Microsoft 365 Plugin calculates this hash and compares it to the Microsoft hashes at backup time, and also at restore time in order to ensure data integrity. Debug mode shows information about these hashes.
Backup parameters
The list below shows the specific backup parameters that can be set up in order to control the behavior of the drive module.
In order to select the drive module, the common service parameter must be equals or be containing the value drive.
Entities that can include one drive units are: users, groups or sites.
Option |
Required |
Default |
Values |
Example |
Description |
---|---|---|---|---|---|
drives |
No |
Valid names or ids of existing drives on the selected tenant belonging to the selected entity (user, group or site) separated by , |
documents, images, b!12344490zcdfs09ewrqwf |
Will backup only selected drive units belonging to the specified entity (user, group or site) |
|
drives_exclude |
No |
Valid names or ids of existing drives on the selected tenant belonging to the selected entity (user, group or site) separated by , |
onedrive |
Will backup all drives except the excluded in this lists, belonging to the specified entity (user, group or site) |
|
drives_regex_include |
No |
Valid regex |
*.pages |
Backup matching drive units (based in the drive unit name) |
|
drives_regex_exclude |
No |
Valid regex |
^site.* |
Exclude matching drive units (based in the drive unit name) |
|
drive_files |
No |
Strings representing existing folders for the given users separated by , |
Customers, Partners |
Backup only specified folders belonging to the selected users |
|
drive_files_exclude |
No |
Strings representing existing folders for the given users separated by , |
Personal |
Exclude selected folders belonging to the selected users |
|
drive_files_regex_include |
No |
Valid regex |
.*Company |
Backup matching drive files or folders. If you provide list parameters (files + files_exclude) combined with regex ones, be aware that regex ones are applied after list parameters |
|
drive_files_regex_exclude |
No |
Valid regex |
.*Plan |
Exclude matching drive files or folders from the selection. If you provide list parameters (files + files_exclude) combined with regex ones, be aware that regex ones are applied after list parameters. If this is the only parameter found for selection, all elements will be included and this list will be excluded. |
|
drive_system_include |
No |
No |
0, no, No, false, FALSE, false, off ; 1, yes, Yes, TRUE, true, on |
Yes |
Include system documentLibraries of sharepoint (sitepages, siteassets, etc). |
drive_shared_with_me |
No |
No |
0, no, No, false, FALSE, false, off ; 1, yes, Yes, TRUE, true, on |
Yes |
Include SharedWithMe elements of every target entity in the backup process |
drive_version_history |
No |
No |
0, no, No, false, FALSE, false, off ; 1, yes, Yes, TRUE, true, on |
Yes |
Include Onedrive former versions of every file into the backup process |
drive_permissions |
No |
Yes |
0, no, No, false, FALSE, false, off ; 1, yes, Yes, TRUE, true, on |
No |
Include Onedrive files sharing permissions as part of the backup. If you need higher performance, it is recommended to disable this option |
drive_disable_hashcheck |
No |
No |
0, no, No, false, FALSE, false, off ; 1, yes, Yes, TRUE, true, on |
No |
Disable the hash checking mechanism for each file downloaded. This is only recommended for documment libraries where the hash stored at M365 level is detected to be incorrect for an important number of files (specially in sharepoint jobs) |
Note: In previous versions, instead of drive_files* parameters, it was possible to use files_* parameters. They are deprecated parameters now as we recommend to use module specific parameters in order to have better control and more possibilities inside a single fileset. However, jobs using files_* parameters will still work.
Note: In previous versions, drive_shared_with_me was enabled by default. However, Microsoft changed at some point the permissions of these elements and now they are only accessible through delegated permissions. Delegated permissions require a more complex operation, while sharedWithMe elements are only needed in some particular
use cases (such as protecting only a sub-set of users). Therefore, this now disabled by default (since Bacula 18.0.4)
Restore
The list below shows the subset of restore parameters that can be used to control the behavior of onedrive module restore operations:
destination_user, destination_group, destination_site, destination_drive, destination_path, send_report, allow_duplicates
drive_skip_sharedwitme, skip_versions, restore_share_permissions, drive_send_invitations, drive_invitations_message
debug, foreign_container_generation
Use cases
The following restore scenarios are supported:
Restore files, directories, or file versions to original entity drive or to a different entity drive
Restore parameters implied: destination_user, destination_group, destination_site
Restore file(s)/dir(s) or file version(s) to original path or to a different path
Restore parameters implied: destination_path
Restore file(s)/dir(s) or file version(s) to original drive unit or to a different drive unit
Restore parameters implied: destination_drive
Restore file(s)/dir(s) or file version(s) to local file system (general restore where parameter must be set to a path)
It is possible to make general restore selections, but avoid restoring versions
Restore parameters implied: skip_versions
It is possible to restore sharing permissions of implied files
Restore parameters implied: restore_shared_permissions, drive_send_invitations, drive_invitations_message
It is possible to make general restore selections, but specify if backed up shared elements must be considered
Restore parameters implied: drive_skip_sharedwitme
It is possible to control whether or not duplicate elements are allowed (based on file id):
Restore parameters implied: allow_duplicates
Particularities:
If no destination entity is provided, the destination entity will be looked for inside the backed up path, so the destination user will be the same as the original one
If no destination_path is provided, the destination path will be the same as the original one
If a destination entity was provided, but no destination_path was provided and the selected file did not belong to the destination entity:
A new folder will automatically be created inside the target entity
For each ‘foreign’ entity, a new folder will be created
Inside each ‘foreign’ entity folder, the original path structure will be preserved when restoring the files
*Unless the parameter foreign_container_generation is disabled
For more details about the behavior of each parameter, please check the general section of restore parameters.
Fileset examples
Full OneDrive of one user:
FileSet {
Name = fs-m365-drive-adelev
Include {
Options { signature = MD5 }
Plugin = "m365: service=drive tenant=57uia43-d107-17a2-a2g2-aa53c10tdahc objectid=56ddf1h9-eb5d-
42nf-bac7-7b019fd284g5 user=adelev@baculaenterprise.onmicrosoft.com"
}
}
Folders of one user, but include sharedWithMe elements:
FileSet {
Name = fs-m365-drive-adelev-shared
Include {
Options { signature = MD5 }
Plugin = "m365: service=drive tenant=57uia43-d107-17a2-a2g2-aa53c10tdahc objectid=56ddf1h9-eb5d-
42nf-bac7-7b019fd284g5 user=adelev@baculaenterprise.onmicrosoft.com drive_files=\"dir1,dir2\"
drive_shared_with_me=yes"
}
}
Full OneDrive of one group, include version history:
FileSet {
Name = fs-m365-drive-devteam-versions
Include {
Options { signature = MD5 }
Plugin = "m365: service=drive tenant=57uia43-d107-17a2-a2g2-aa53c10tdahc objectid=56ddf1h9-eb5d-
42nf-bac7-7b019fd284g5 group=\"Dev Team\" drive_version_history=true"
}
}
Full OneDrive of one sharepoint site:
FileSet {
Name = fs-m365-drive-live
Include {
Options { signature = MD5 }
Plugin = "m365: service=drive tenant=57uia43-d107-17a2-a2g2-aa53c10tdahc objectid=56ddf1h9-eb5d-
42nf-bac7-7b019fd284g5 site=\"Live @ MyEnterprise\""
}
}
Specific drives of a sharepoint site, including some system:
FileSet {
Name = fs-m365-drive-live-2-drives
Include {
Options { signature = MD5 }
Plugin = "m365: service=drive tenant=57uia43-d107-17a2-a2g2-aa53c10tdahc objectid=56ddf1h9-eb5d-
42nf-bac7-7b019fd284g5 site=\"Live @ MyEnterprise\" drive_system_include=yes drives=b!7Tf3z7izSES7kjOHD-YM-
0kScgNXL6lFnL4O2LWLMy4yH2tqunhTSpSwmPR5a0hq,b!7Tf3z7izSES7kjOHD-YM-0kScgNXL6lFnL4O2LWLMy41XlWc2E0pTKfPzlKxhztE"
}
}
Exclude directories of two users:
FileSet {
Name = fs-m365-drive-adjon-users-notemp
Include {
Options { signature = MD5 }
Plugin = "m365: service=drive tenant=57uia43-d107-17a2-a2g2-aa53c10tdahc objectid=56ddf1h9-eb5d-
42nf-bac7-7b019fd284g5 user=\"adelev@baculaenterprise.onmicrosoft.com,jonis@baculaenterprise.onmicrosoft.com\"
drive_files_exclude=\".*.temporary\""
}
}
Exclude mp3 files and avi files:
FileSet {
Name = fs-m365-drive-exclude
Include {
Options { signature = MD5 }
Plugin = "m365: service=drive tenant=57uia43-d107-17a2-a2g2-aa53c10tdahc objectid=56ddf1h9-eb5d-
42nf-bac7-7b019fd284g5 user=\"adelev@baculaenterprise.onmicrosoft.com,jonis@baculaenterprise.onmicrosoft.com\"
drive_files_exclude=\".*.mp3|.*.avi\""
}
}