Possible way to identify partially failed, incomplete btrfs send's
- Dominant language
- Perl
- Stars
- 2.1k
- Forks
- 139
- PR merge metrics
- No merged PRs in 30d
Description
While developing some custom btrfs send/receive based backups of my own, I stumbled on to a way to create partially failed, incomplete, btrfs send's, and a way to identify the incomplete snapshots that result.
While doing my usual Google searching for discussion of such, I most often came upon this btrbk tool and discussions. So perhaps what I've noticed will be useful here as well, though more likely it's already well known to btrbk experts and I just haven't happened to come across it here.
To create partially failed send's, use the following shell script **mem_lim_1G**:
```
#!/bin/zsh
# Use cgroup memory control group to limit command to 1G resident memory
cgcreate -g memory:mem_lim_1G
cgset -r memory.limit_in_bytes=1G mem_lim_1G
exec cgexec -g memory:mem_lim_1G "$@"
```
Then prepend this **mem_lim_1G** command to the btrfs or btrbk invocation, as one would with the nice(1) or ionice(1) commands. Fine tune the 1G memory limit to be sufficient to allow the send to start, but insufficient to allow it to complete successfully. You'll notice one of your syslog files gets an entry such as "kernel: Memory cgroup out of memory: Kill process 9999 (yourbtrkbkcmd) score 0 or sacrifice child", and the btrfs send will die at that point.
To identify incomplete snapshots, such as result from the above hack, notice that the received_uuid field in the newly created snapshot on the receiving side will be set to "-", rather than to the proper uuid that it would have been set to, had the operation completed successfully.
The above was done on a 4.11.7-1-MANJARO Linux kernel, if that matters.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the partial btrfs send described with the mem_lim_1G wrapper and inspect the resulting received_uuid value on the receiving side. Review how btrbk invokes btrfs send/receive and determine the intended handling for snapshots whose received_uuid is "-"; done should include a decided behavior and corresponding validation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- linux, perl, zsh
- Domain
- operating-systems, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100