Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
zhuxiujia opened this issue Dec 23, 2023 · 3 comments
Open

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

zhuxiujia opened this issue Dec 23, 2023 · 3 comments
Labels
A-api Area: Related to API design of rustic_core C-discussion Category: Not an issue still, tbd!

Comments

@zhuxiujia
Copy link

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)
    }
@github-actions github-actions bot added the S-triage Status: Waiting for a maintainer to triage this issue/PR label Dec 23, 2023
@aawsome
Copy link
Member

aawsome commented Dec 23, 2023

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

@aawsome
Copy link
Member

aawsome commented Dec 26, 2023

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

@simonsan simonsan added C-discussion Category: Not an issue still, tbd! A-api Area: Related to API design of rustic_core and removed S-triage Status: Waiting for a maintainer to triage this issue/PR labels Dec 26, 2023
@zhuxiujia
Copy link
Author

zhuxiujia commented Dec 27, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-api Area: Related to API design of rustic_core C-discussion Category: Not an issue still, tbd!
Projects
None yet
Development

No branches or pull requests

3 participants