]>
git.proxmox.com Git - proxmox-backup.git/blob - src/tape/mod.rs
1 use anyhow
::{format_err, Error}
;
3 use proxmox
::tools
::fs
::{
11 pub use tape_write
::*;
28 mod media_state_database
;
29 pub use media_state_database
::*;
31 mod online_status_map
;
32 pub use online_status_map
::*;
35 pub use media_pool
::*;
37 /// Directory path where we store all tape status information
38 pub const TAPE_STATUS_DIR
: &str = "/var/lib/proxmox-backup/tape";
40 /// We limit chunk archive size, so that we can faster restore a
41 /// specific chunk (The catalog only store file numbers, so we
42 /// need to read the whole archive to restore a single chunk)
43 pub const MAX_CHUNK_ARCHIVE_SIZE
: usize = 4*1024*1024*1024; // 4GB for now
45 /// To improve performance, we need to avoid tape drive buffer flush.
46 pub const COMMIT_BLOCK_SIZE
: usize = 128*1024*1024*1024; // 128 GiB
49 /// Create tape status dir with correct permission
50 pub fn create_tape_status_dir() -> Result
<(), Error
> {
51 let backup_user
= crate::backup
::backup_user()?
;
52 let mode
= nix
::sys
::stat
::Mode
::from_bits_truncate(0o0640);
53 let opts
= CreateOptions
::new()
55 .owner(backup_user
.uid
)
56 .group(backup_user
.gid
);
58 create_path(TAPE_STATUS_DIR
, None
, Some(opts
))
59 .map_err(|err
: Error
| format_err
!("unable to create tape status dir - {}", err
))?
;