rustic_core
rustic_core copied to clipboard
If I want a backup block device (bytes array), can it support it?
If I want a backup block device (bytes array), can it support it?
- maybe need change and restore params(
source: PathListtosource: FileSystem) ?
pub fn backup(
&self,
opts: &BackupOptions,
source: PathList,
snap: SnapshotFile,
) -> RusticResult<SnapshotFile> {
commands::backup::backup(self, opts, source, snap)
}
Piping the content to rustic backup - should do what you want. Note there ist also --stdin-filename
In case I wasn't precise. If you use the mentioned method from rustic_core directly, you simply have to use "-" as PathList and the backup method will read stdin and backup the content it will read from there.
Note that rustic will always have to read a single file serially in order to chunk it as we only support the Rabin-based content defined chunker currently. So to backup a block device you anyhow have to treat it as a Reader which allows to sequentially read it.
There is so far no way to directly specify a Reader, but I'm about to change the implementation of backup sources which will allow to specify your own source here...
In case I wasn't precise. If you use the mentioned method from
rustic_coredirectly, you simply have to use "-" as PathList and thebackupmethod will readstdinand backup the content it will read from there.Note that rustic will always have to read a single file serially in order to chunk it as we only support the Rabin-based content defined chunker currently. So to backup a block device you anyhow have to treat it as a
Readerwhich allows to sequentially read it.There is so far no way to directly specify a
Reader, but I'm about to change the implementation of backup sources which will allow to specify your own source here...
For example, if we read disk block device data from a Windows system, we can use just like
let disk0 = std::fs::OpenOptions::new().read(true).write(true).open("\\.\PHYSICALDRIVE0").unwrap();
disk0.seek_write(bytes, offset);
disk0.seek_read(bytes, offset)
I tried calling directly backup function use PathList ,but it's not success. Can you provide an example If the backup block device has already been implemented。 I believe that I can achieve the backup of the entire operating system by combining Windows VSS and backup block devices