2

I use a command like btrfs restore -iv /dev/sdc1 /RESTORED

estimated time of running it is few days

In every hour of running I see a lot of prompts like:

We seem to be looping a lot on /path/to/some/file, do you want to keep going on?
(y/N/a)

I'd like to say N to all remaining prompts, but there is no such option (according to man btrfs-restore and btrfs )

I think I need this: yes N | btrfs restore -iv /dev/sdc1 /RESTORED (which will start restore again)

Is any way to pause a running task (not cancel) and then resume within a pipe like

ctrl+Z + $ yes N | fg

(the above return fg no job control). fg here is only to show what I mean.

  • Interesting question, but I don't think it is possible to redirect standard input on the fly. One work around could be to use xdotool or xvkbd to simulate repeatedly pressing N. A script doing that could be launched with a shortcut key when the command is running and starts to ask confirmations. – vanadium Jun 27 '21 at 14:28
  • This is really a job for expect. – muru Jun 27 '21 at 15:17
  • Try this one: https://gitlab.com/44100Hz/btrfs-file-restorer Gonna make it musch easier to restore files from dead btrfs partition – user2304656 Sep 13 '24 at 11:33

1 Answers1

0

I found a workaround like this:

simply I generated a list of N (for example by yes N)

copied that and paste into running task

It is of course limited, so in my case, I've copied 10K lines of N.

the list must be with a single N per line.