Aug-27-2020, 09:03 AM
i have a requirement to run badblocks on a raspberry pi checking a usb stick. this is not my requirement so please don't advise to change this as i cant do that.
what i would like help with is to run a python script that runs badblocks and can either monitor the text on the screen for progression reasons or write the information to a text file where i can read it at any point. i dont need help with reading the file as i can do this already.
i can create a script to run it locally or run it remotely but i am unable to pragmatically get the progress (it takes about 1 hour to complete the task)
i have tried a simple redirect >> to a file but this is no good as i ether get an empty file or it does nothing at all.
below is the command and i want to continuously or on demand get the percentage and or errors using python.
sudo badblocks -swv -t 0XAA /dev/sda1
Checking for bad blocks in read-write mode
From block 0 to 60088303
Testing with pattern 0xaa: 28.62% done, 19:38 elapsed. (0/0/0 errors)
i don't have any code to share because i don't know where to start on this so would appreciate any help anyone can give me.
what i would like help with is to run a python script that runs badblocks and can either monitor the text on the screen for progression reasons or write the information to a text file where i can read it at any point. i dont need help with reading the file as i can do this already.
i can create a script to run it locally or run it remotely but i am unable to pragmatically get the progress (it takes about 1 hour to complete the task)
i have tried a simple redirect >> to a file but this is no good as i ether get an empty file or it does nothing at all.
below is the command and i want to continuously or on demand get the percentage and or errors using python.
sudo badblocks -swv -t 0XAA /dev/sda1
Checking for bad blocks in read-write mode
From block 0 to 60088303
Testing with pattern 0xaa: 28.62% done, 19:38 elapsed. (0/0/0 errors)
i don't have any code to share because i don't know where to start on this so would appreciate any help anyone can give me.