rustic_core icon indicating copy to clipboard operation
rustic_core copied to clipboard

If I want a backup block device (bytes array), can it support it?

Open zhuxiujia opened this issue 1 year ago • 3 comments

If I want a backup block device (bytes array), can it support it?

  • maybe need change and restore params(source: PathList tosource: FileSystem ) ?
pub fn backup(
        &self,
        opts: &BackupOptions,
        source: PathList,
        snap: SnapshotFile,
    ) -> RusticResult<SnapshotFile> {
        commands::backup::backup(self, opts, source, snap)
    }

zhuxiujia avatar Dec 23 '23 13:12 zhuxiujia

Piping the content to rustic backup - should do what you want. Note there ist also --stdin-filename

aawsome avatar Dec 23 '23 14:12 aawsome

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...

aawsome avatar Dec 26 '23 20:12 aawsome

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...

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

zhuxiujia avatar Dec 27 '23 14:12 zhuxiujia